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 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:

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 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:

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 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

curl -k -H "x-auth-token: 0c54b74643093d03f79be0f8feea5946" https://my.bda.manager.com/bda/rest/api/1.0/patches/2/templates?scope=oracle

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 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:

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 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:

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 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:

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
Was this page helpful? Yes No Submitting... Thank you

Comments