Patching functions
The following sections detail the REST API commands you can use to perform functions with BMC Database Automation (BDA) patches.
Base URL for the API is:
https://ManagerhostName/bda/rest/api
Patches List
Lists the available patches for a database.
Syntax
/1.0/patches
Method
GET
Required parameter
scope
— Returns patches within a specific scope. Available scopes are oracle, sqlserver, db2, sybase_ds and sybase_rs.
Optional parameters
None
Response
{
"status": "success",
"status_code": 200,
"data": {"patches": [
{
"id": "4",
"name": "QA STD - Oracle 12.1.0.2 Generic Patch for Linux",
"description": "Generic RDBMS patch for Oracle 12.1.0.2 on Linux",
"app_patch_number": "18795927",
"can_rollback": "true"
},
{
"id": "10",
"name": "GIPSU-Oct2017-11.2.0.4-Linux-x86_64",
"description": "GIPSU-Oct2017-11.2.0.4-Linux-x86_64",
"app_patch_number": "26392168",
"can_rollback": "true"
},
]}
}
Example
To get a list of all available patches:
curl -k -H "x-auth-token: b4c37d824039a5f87244e17ba0d1df05" https://my.bda.manager.com/bda/rest/api/1.0/patches?scope=oracle
Candidates List
Returns a list of candidates on which a specific patch can be installed or rolled back.
Syntax
/1.0/patches/{patch_id}/candidates
Method
GET
Required parameter
scope
— Returns a list of candidates within a specific scope. Available scopes are oracle, sqlserver, db2, sybase_ds and sybase_rs.
Optional parameter
operation_type
— Returns the list of candidates on which a specific patch can either be installed or rolled back. Valid values are install and rollback. If you do not provide this parameter, the list of candidates on which the patch can installed, is returned.
Response
{
"status": "success",
"status_code": 200,
"data": {"candidates": [
"172.19.25.246|/app/oracle/DBCM/product/12.2.0.1",
"172.19.25.246|/app/oracle/DBCM/product/12.2.0.1"
]}
}
Example
To get a list of candidates on which the patch with id=2 can be rolled back:
curl -k -H "x-auth-token: 0c54b74643093d03f79be0f8feea5946" "https://my.bda.manager.com/bda/rest/api/1.0/patches/2/candidates?scope=oracle&operation_type=rollback"
To get a list of candidates on which the patch with id=5 can be installed:
curl -k -H "x-auth-token: 0c54b74643093d03f79be0f8feea5946" "https://my.bda.manager.com/bda/rest/api/1.0/patches/5/candidates?scope=oracle"
Templates list
Lists the templates for a specific patch.
Syntax
/1.0/patches/{patch_id}/templates
Method
GET
Required parameter
scope
— Returns a list of candidates within a specific scope. Available scopes are oracle, sqlserver, db2, sybase_ds and sybase_rs.
Optional parameters
None
Response
{
"status": "success",
"status_code": 200,
"data": {"templates": [
"qa-defaults",
"qa-defaults-windows"
]}
}
Example
To get a list of templates for the patch id=2
curl -k -H "x-auth-token: 0c54b74643093d03f79be0f8feea5946" https://my.bda.manager.com/bda/rest/api/1.0/patches/2/templates?scope=oracle
Conflicts Patches
This API checks for conflicts between the patch and an Oracle database.
Note
This API is applicable to Oracle patches only.
Syntax
/1.0/patches/{patch_Id}/conflicts_check
Method
POST
Required parameters
scope
— Check conflicts of a patch within a specific scope. Available scope is oracle.template
— Use the patch template.candidates
— A comma-separated list of object candidates.upgrade_opatch
— Use this parameter to select whether to upgrade OPatch that is installed on the target node as part of the patch package rollback. Valid values are true and false (default).
Optional parameters
cleanup_prestaged_patch
—Use this parameter to remove the pre-staged patch media after rolling back the patch even if the rollback was successful or not. Valid values are true and false (default).fix_inv_perms
— Whether to modify the inventory permissions for the specified Oinstall user and bypass associated verification checks. BDA expects the Oracle user inventory directory permissions to be set to 770. If permissions are not set to 770, set this parameter totrue
to update the permission setting, thereby preventing a pre-staging error. Valid values are true and false (default).cleanup_agent_logs
— Whether to automatically remove logs that are generated by BDA on the Agent after the job is complete. Valid values are true and false (default).skip_verification
— Whether to pre-stage the patch media without having first run the pre-verification steps. Valid values are true and false (default).
Response
{
"status": "success",
"status_code": 200,
"data": {
"job_id": "779",
"result": " Conflict check '7' executed successfully."
}
}
Example
curl -k -H "x-auth-token: ad7aaa89fbf0ef648ddd1607007e819f" –data " scope=oracle& template=qa-defaults&node=<node_fqn>& candidates=172.19.18.212|/app/oracle/apitest1/product/12.1.0.1,172.19.18.213|/app/oracle/apitest2/product/12.1.0.1&cleanup_prestaged_patch=true&upgrade_opatch=true& fix_inv_perms=true&cleanup_agent_logs=true&skip_verification=false& override_values=option1=value1,option2=value2" https://my.bda.manager.com/bda/rest/api/1.0/patches/{patch_id}/conflicts_check
Pre-stage Patches
Pre-stages a specific patch on a list of object candidates.
Syntax
/1.0/patches/{patch_Id}/prestage
Method
POST
Required parameters
scope
— Pre-stages patches within a specific scope. Available scopes are oracle, sqlserver, db2, sybase_ds and sybase_rs.candidates
— A comma-separated list of object candidates.
Optional parameters
fix_inv_perms
— Whether to modify the inventory permissions for the specified Oinstall user and bypass associated verification checks. BMC Database Automation expects the Oracle user inventory directory permissions to be set to 770. If permissions are not set to 770, set this parameter totrue
to update the permission setting, thereby preventing a pre-staging error. Valid values are true and false (default).cleanup_agent_logs
— Whether to automatically remove logs that are generated by BMC Database Automation on the Agent after the job is complete. Valid values are true and false (default).skip_verification
— Whether to pre-stage the patch media without having first run the pre-verification steps. Valid values are true and false (default).
Response
{
"status": "success",
"status_code": 200,
"data": {
"job_id": "835",
"result": "Patch prestage '7' executed successfully."
}
}
Examples
To pre-stage a patch with id=20 on a candidate, 172.19.18.212:
curl -k -H "x-auth-token:0c54b74643093d03f79be0f8feea5946" --form "scope=oracle" --form "candidates=172.19.18.212|/app/oracle/apitest1/product/12.1.0.1" --form "fix_inv_perms=true" --form "cleanup_agent_logs=true" --form "skip_verification=true" https://my.bda.manager.com/bda/rest/api/1.0/patches/20/prestage
Install Patch
Installs a specific patch on a set of object candidates using a specified template.
Syntax
/api/1.0/patches/{patch_Id}/install
Method
POST
Required parameters
scope
— Installs patches within a specific scope. Available scopes are oracle, sqlserver, db2, sybase_ds and sybase_rs.template
— Patch template.candidates
— A comma-separated list of object candidates.patching_method
– The method to install the patch: parallel (default), serial, or rolling (RAC only).upgrade_opatch
— Whether to upgrade the version of OPatch that is installed on the target node as part of the patch package installation. Valid values are true and false (default). If you have selected the Upgrade Opatch option during database provisioning, this parameter is optional.
Optional parameters
use_globl_sa_password
— This field is required only for Sybase patching.global_sa_password
— This field is required only for Sybase patching. It will be used for sa_password for all Sybase candidates.cleanup_prestaged_patch
— Whether you want to remove the pre-staged patch media after installation of the patch irrespective of whether the installation was successful or not. Valid values are true and false (default).fix_inv_perms
— Whether to modify the inventory permissions for the specified Oinstall user and bypass associated verification checks. BMC Database Automation expects the Oracle user inventory directory permissions to be set to 770. If permissions are not set to 770, set this parameter totrue
to update the permission setting, thereby preventing an installation error. Valid values are true and false (default).cleanup_agent_logs
— Whether to automatically remove logs that are generated by BMC Database Automation on the Agent after the job is complete. Valid values are true and false (default).skip_verification
— Whether to install the patch without having first run the pre-verification steps. Valid values are true and false (default).override_values
— Values to override the custom field values in the supplied Patch template. If the custom fields are defined as required in the template and you have not provided the default values in the template, then it is mandatory to provide the values here.
Response
{
"status": "success",
"status_code": 200,
"data": {
"job_id": "836",
"result": "Patch '7' executed successfully."
}
}
Example
To install a patch with id=20:
curl -k -H "x-auth-token:0c54b74643093d03f79be0f8feea5946" --form "scope=oracle" --form "template=qa-defaults" --form "patching_method=parallel" --form "candidates=172.19.18.212|/app/oracle/apitest1/product/12.1.0.1" --form "cleanup_prestaged_patch=true" --form "upgrade_opatch=true" --form "override_values=option1=value1,option2=value2" https://my.bda.manager.com/bda/rest/api/1.0/patches/20/install
To install a patch with id=4 on two candidates
curl -k -H "x-auth-token:0c54b74643093d03f79be0f8feea5946" --form "scope=oracle" --form "template=qa-defaults" --form "patching_method=parallel" --form "candidates=172.19.18.212|/app/oracle/apitest1/product/12.1.0.1,172.19.18.213|/app/oracle/apitest2/product/12.1.0.1" --form "cleanup_prestaged_patch=true" --form "upgrade_opatch=true" --form "skip_verification=false" --form "override_values=option1=value1,option2=value2" https://my.bda.manager.com/bda/rest/api/1.0/patches/4/install
Rollback Patch
Rolls back a specific patch.
Syntax
/1.0/patches/{patch_Id}/rollback
Method
POST
Required parameters
scope
— Rolls back patches within a specific scope. Available scopes are oracle, sqlserver, and db2.template
— Patch template.candidates
— A comma-separated list of object candidates.patching_method
– The method to roll back the patch: parallel, serial, or rolling (RAC only).
Optional parameters
cleanup_prestaged_patch
— Whether you want to remove the pre-staged patch media after rolling back the patch irrespective of whether the rollback was successful or not. Valid values are true and false (default).upgrade_opatch
— Whether to upgrade the version of OPatch that is installed on the target node as part of the patch package rollback. Valid values are true and false (default).fix_inv_perms
— Whether to modify the inventory permissions for the specified Oinstall user and bypass associated verification checks. BMC Database Automation expects the Oracle user inventory directory permissions to be set to 770. If permissions are not set to 770, set this parameter totrue
to update the permission setting, thereby preventing a provisioning error. Valid values are true and false (default).cleanup_agent_logs
— Whether to automatically remove logs that are generated by BMC Database Automation on the Agent after the job is complete. Valid values are true and false (default).skip_verification
— Whether to roll back the patch without having first run the pre-verification steps. Valid values are true and false (default).
Response
{
"status": "success",
"status_code": 200,
"data": {
"job_id": "836",
"result": "Patch '7' executed successfully."
}
}
Example
To roll back a patch with id=1 from two candidates:
curl -k -H "x-auth-token:0c54b74643093d03f79be0f8feea5946" --form "scope=oracle" --form "template=qa-defaults" --form "patching_method=parallel" --form "candidates=172.19.18.212|/app/oracle/apitest1/product/12.1.0.1,172.19.18.213|/app/oracle/apitest2/product/12.1.0.1" --form "cleanup_prestaged_patch=true" --form "upgrade_opatch=true" --form "fix_inv_perms=true" --form "cleanup_agent_logs=true" --form "skip_verification=false" --form "override_values=option1=value1,option2=value2" https://my.bda.manager.com/bda/rest/api/1.0/patches/1/rollback
Comments
Log in or register to comment.