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:
Patches List
Lists the available patches for a database.
Syntax
Method
GET
Required parameters
scope — Returns patches within a specific scope. Available scope is oracle.
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:
Candidates List
Returns a list of candidates on which a specific patch can be installed or rolled back.
Syntax
Method
GET
Required parameters
- Scope — Returns a list of candidates within a specific scope. Available scope is oracle.
Optional parameters
- 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:
To get a list of candidates on which the patch with id=5 can be installed:
Templates list
Lists the templates for a specific patch.
Syntax
Method
GET
Required parameters
Scope — Returns a list of candidates within a specific scope. Available scope is oracle.
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
Pre-stage Patches
Pre-stages a specific patch on a list of object candidates.
Syntax
Method
POST
Required parameters
- scope — Pre-stages patches within a specific scope. Available scope is oracle.
- 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 to true 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 valees 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:
Install Patch
Installs a specific patch on a set of object candidates using a specified template.
Syntax
Method
POST
Required parameters
- scope — Installs patches within a specific scope. Available scope is oracle.
- 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
- 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 to true 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:
To install a patch with id=4 on two candidates
Rollback Patch
Rolls back a specific patch.
Syntax
Method
POST
Required parameters
- scope — Rolls back patches within a specific scope. Available scope is oracle.
- 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 to true 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: