oracle.oci.oci_database_management_managed_database_actions – Perform actions on a ManagedDatabase resource in Oracle Cloud Infrastructure

Note

This plugin is part of the oracle.oci collection (version 4.13.0).

You might already have this collection installed if you are using the ansible package. It is not included in ansible-core. To check whether it is installed, run ansible-galaxy collection list.

To install it, use: ansible-galaxy collection install oracle.oci.

To use it in a playbook, specify: oracle.oci.oci_database_management_managed_database_actions.

New in version 2.9.0: of oracle.oci

Synopsis

  • Perform actions on a ManagedDatabase resource in Oracle Cloud Infrastructure

  • For action=clone_sql_tuning_task, clones and runs a SQL tuning task in the database.

  • For action=drop_sql_tuning_task, drops a SQL tuning task and its related results from the database.

  • For action=start_sql_tuning_task, starts a SQL tuning task for a given set of SQL statements from the active session history top SQL statements.

Requirements

The below requirements are needed on the host that executes this module.

Parameters

Parameter Choices/Defaults Comments
action
string / required
    Choices:
  • clone_sql_tuning_task
  • drop_sql_tuning_task
  • start_sql_tuning_task
The action to perform on the ManagedDatabase.
api_user
string
The OCID of the user, on whose behalf, OCI APIs are invoked. If not set, then the value of the OCI_USER_ID environment variable, if any, is used. This option is required if the user is not specified through a configuration file (See config_file_location). To get the user's OCID, please refer https://docs.us-phoenix-1.oraclecloud.com/Content/API/Concepts/apisigningkey.htm.
api_user_fingerprint
string
Fingerprint for the key pair being used. If not set, then the value of the OCI_USER_FINGERPRINT environment variable, if any, is used. This option is required if the key fingerprint is not specified through a configuration file (See config_file_location). To get the key pair's fingerprint value please refer https://docs.us-phoenix-1.oraclecloud.com/Content/API/Concepts/apisigningkey.htm.
api_user_key_file
string
Full path and filename of the private key (in PEM format). If not set, then the value of the OCI_USER_KEY_FILE variable, if any, is used. This option is required if the private key is not specified through a configuration file (See config_file_location). If the key is encrypted with a pass-phrase, the api_user_key_pass_phrase option must also be provided.
api_user_key_pass_phrase
string
Passphrase used by the key referenced in api_user_key_file, if it is encrypted. If not set, then the value of the OCI_USER_KEY_PASS_PHRASE variable, if any, is used. This option is required if the key passphrase is not specified through a configuration file (See config_file_location).
auth_purpose
string
    Choices:
  • service_principal
The auth purpose which can be used in conjunction with 'auth_type=instance_principal'. The default auth_purpose for instance_principal is None.
auth_type
string
    Choices:
  • api_key ←
  • instance_principal
  • instance_obo_user
  • resource_principal
The type of authentication to use for making API requests. By default auth_type="api_key" based authentication is performed and the API key (see api_user_key_file) in your config file will be used. If this 'auth_type' module option is not specified, the value of the OCI_ANSIBLE_AUTH_TYPE, if any, is used. Use auth_type="instance_principal" to use instance principal based authentication when running ansible playbooks within an OCI compute instance.
cert_bundle
string
The full path to a CA certificate bundle to be used for SSL verification. This will override the default CA certificate bundle. If not set, then the value of the OCI_ANSIBLE_CERT_BUNDLE variable, if any, is used.
config_file_location
string
Path to configuration file. If not set then the value of the OCI_CONFIG_FILE environment variable, if any, is used. Otherwise, defaults to ~/.oci/config.
config_profile_name
string
The profile to load from the config file referenced by config_file_location. If not set, then the value of the OCI_CONFIG_PROFILE environment variable, if any, is used. Otherwise, defaults to the "DEFAULT" profile in config_file_location.
credential_details
dictionary / required
password
string
The database user's password encoded using BASE64 scheme.
Required when sql_tuning_task_credential_type is 'PASSWORD'
password_secret_id
string
The OCID of the Secret where the database password is stored.
Required when sql_tuning_task_credential_type is 'SECRET'
role
string / required
    Choices:
  • NORMAL
  • SYSDBA
The role of the database user.
sql_tuning_task_credential_type
string / required
    Choices:
  • SECRET
  • PASSWORD
The type of credential for the SQL tuning task.
username
string / required
The user name used to connect to the database.
managed_database_id
string / required
The OCID of the Managed Database.

aliases: id
original_task_id
integer
The identifier of the SQL tuning task being cloned. This is not the OCID. It can be retrieved from the following endpoint ListSqlTuningAdvisorTasks.
Required for action=clone_sql_tuning_task.
region
string
The Oracle Cloud Infrastructure region to use for all OCI API requests. If not set, then the value of the OCI_REGION variable, if any, is used. This option is required if the region is not specified through a configuration file (See config_file_location). Please refer to https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/regions.htm for more information on OCI regions.
scope
string
    Choices:
  • LIMITED
  • COMPREHENSIVE
The scope for the SQL tuning task. For LIMITED scope, the SQL profile recommendation is excluded, so the task is executed faster. For COMPREHENSIVE scope, the SQL profile recommendation is included.
Required for action=start_sql_tuning_task.
sql_details
list / elements=dictionary
The details of the SQL statement on which tuning is performed. To obtain the details of the SQL statement, you must provide either the sqlTuningSet or the tuple of sqlDetails/timeStarted/timeEnded.
Applicable only for action=start_sql_tuning_task.
sql_id
string / required
The identifier of a SQL statement.
sql_tuning_set
dictionary
Applicable only for action=start_sql_tuning_task.
name
string / required
The name of the SQL tuning set.
owner
string / required
The owner of the SQL tuning set.
statement_time_limit_in_minutes
integer
The time limit per SQL statement (in minutes). This is for a task with the COMPREHENSIVE scope. The time limit per SQL statement should not be more than the total time limit.
Applicable only for action=start_sql_tuning_task.
task_description
string
The description of the SQL tuning task.
Applicable only for action=clone_sql_tuning_taskaction=start_sql_tuning_task.
task_id
integer
The identifier of the SQL tuning task being dropped. This is not the OCID. It can be retrieved from the following endpoint ListSqlTuningAdvisorTasks.
Required for action=drop_sql_tuning_task.
task_name
string
The name of the SQL tuning task. The name is unique per user in a database, and it is case-sensitive.
Required for action=clone_sql_tuning_task, action=start_sql_tuning_task.
tenancy
string
OCID of your tenancy. If not set, then the value of the OCI_TENANCY variable, if any, is used. This option is required if the tenancy OCID is not specified through a configuration file (See config_file_location). To get the tenancy OCID, please refer https://docs.us-phoenix-1.oraclecloud.com/Content/API/Concepts/apisigningkey.htm
time_ended
string
The end time of the period in which SQL statements are running.
Applicable only for action=start_sql_tuning_task.
time_started
string
The start time of the period in which SQL statements are running.
Applicable only for action=start_sql_tuning_task.
total_time_limit_in_minutes
integer
The time limit for running the SQL tuning task.
Required for action=start_sql_tuning_task.

Examples

- name: Perform action clone_sql_tuning_task on managed_database
  oci_database_management_managed_database_actions:
    # required
    original_task_id: 56
    managed_database_id: "ocid1.manageddatabase.oc1..xxxxxxEXAMPLExxxxxx"
    task_name: task_name_example
    credential_details:
      # required
      password_secret_id: "ocid1.passwordsecret.oc1..xxxxxxEXAMPLExxxxxx"
      sql_tuning_task_credential_type: SECRET
      username: username_example
      role: NORMAL
    action: clone_sql_tuning_task

    # optional
    task_description: task_description_example

- name: Perform action drop_sql_tuning_task on managed_database
  oci_database_management_managed_database_actions:
    # required
    task_id: 56
    managed_database_id: "ocid1.manageddatabase.oc1..xxxxxxEXAMPLExxxxxx"
    credential_details:
      # required
      password_secret_id: "ocid1.passwordsecret.oc1..xxxxxxEXAMPLExxxxxx"
      sql_tuning_task_credential_type: SECRET
      username: username_example
      role: NORMAL
    action: drop_sql_tuning_task

- name: Perform action start_sql_tuning_task on managed_database
  oci_database_management_managed_database_actions:
    # required
    managed_database_id: "ocid1.manageddatabase.oc1..xxxxxxEXAMPLExxxxxx"
    task_name: task_name_example
    credential_details:
      # required
      password_secret_id: "ocid1.passwordsecret.oc1..xxxxxxEXAMPLExxxxxx"
      sql_tuning_task_credential_type: SECRET
      username: username_example
      role: NORMAL
    total_time_limit_in_minutes: 56
    scope: LIMITED
    action: start_sql_tuning_task

    # optional
    task_description: task_description_example
    statement_time_limit_in_minutes: 56
    sql_tuning_set:
      # required
      name: name_example
      owner: owner_example
    sql_details:
    - # required
      sql_id: "ocid1.sql.oc1..xxxxxxEXAMPLExxxxxx"
    time_started: time_started_example
    time_ended: time_ended_example

Return Values

Common return values are documented here, the following are the fields unique to this module:

Key Returned Description
managed_database
complex
on success
Details of the ManagedDatabase resource acted upon by the current operation

Sample:
{'additional_details': {}, 'compartment_id': 'ocid1.compartment.oc1..xxxxxxEXAMPLExxxxxx', 'database_status': 'UP', 'database_sub_type': 'CDB', 'database_type': 'EXTERNAL_SIDB', 'deployment_type': 'ONPREMISE', 'id': 'ocid1.resource.oc1..xxxxxxEXAMPLExxxxxx', 'instance_count': 56, 'instance_details': [{'host_name': 'host_name_example', 'id': 56, 'name': 'name_example', 'status': 'UP'}], 'is_cluster': True, 'managed_database_groups': [{'compartment_id': 'ocid1.compartment.oc1..xxxxxxEXAMPLExxxxxx', 'id': 'ocid1.resource.oc1..xxxxxxEXAMPLExxxxxx', 'name': 'name_example'}], 'management_option': 'BASIC', 'name': 'name_example', 'parent_container_compartment_id': 'ocid1.parentcontainercompartment.oc1..xxxxxxEXAMPLExxxxxx', 'parent_container_id': 'ocid1.parentcontainer.oc1..xxxxxxEXAMPLExxxxxx', 'parent_container_name': 'parent_container_name_example', 'pdb_count': 56, 'pdb_status': [{'count': 56, 'status': 'UP'}], 'time_created': '2013-10-20T19:20:30+01:00', 'workload_type': 'OLTP'}
 
additional_details
dictionary
on success
The additional details specific to a type of database defined in `{"key": "value"}` format. Example: `{"bar-key": "value"}`

 
compartment_id
string
on success
The OCID of the compartment.

Sample:
ocid1.compartment.oc1..xxxxxxEXAMPLExxxxxx
 
database_status
string
on success
The status of the Oracle Database. Indicates whether the status of the database is UP, DOWN, or UNKNOWN at the current time.

Sample:
UP
 
database_sub_type
string
on success
The subtype of the Oracle Database. Indicates whether the database is a Container Database, Pluggable Database, Non-container Database, Autonomous Database, or Autonomous Container Database.

Sample:
CDB
 
database_type
string
on success
The type of Oracle Database installation.

Sample:
EXTERNAL_SIDB
 
deployment_type
string
on success
The infrastructure used to deploy the Oracle Database.

Sample:
ONPREMISE
 
id
string
on success
The OCID of the Managed Database.

Sample:
ocid1.resource.oc1..xxxxxxEXAMPLExxxxxx
 
instance_count
integer
on success
The number of Oracle Real Application Clusters (Oracle RAC) database instances.

Sample:
56
 
instance_details
complex
on success
The details of the Oracle Real Application Clusters (Oracle RAC) database instances.

   
host_name
string
on success
The name of the host of the Oracle RAC database instance.

Sample:
host_name_example
   
id
integer
on success
The ID of the Oracle RAC database instance.

Sample:
56
   
name
string
on success
The name of the Oracle RAC database instance.

Sample:
name_example
   
status
string
on success
The status of the Oracle RAC database instance.

Sample:
UP
 
is_cluster
boolean
on success
Indicates whether the Oracle Database is part of a cluster.

Sample:
True
 
managed_database_groups
complex
on success
A list of Managed Database Groups that the Managed Database belongs to.

   
compartment_id
string
on success
The OCID of the compartment in which the Managed Database Group resides.

Sample:
ocid1.compartment.oc1..xxxxxxEXAMPLExxxxxx
   
id
string
on success
The OCID of the Managed Database Group.

Sample:
ocid1.resource.oc1..xxxxxxEXAMPLExxxxxx
   
name
string
on success
The name of the Managed Database Group.

Sample:
name_example
 
management_option
string
on success
The management option used when enabling Database Management.

Sample:
BASIC
 
name
string
on success
The name of the Managed Database.

Sample:
name_example
 
parent_container_compartment_id
string
on success
The OCID of the compartment in which the parent Container Database resides, if the Managed Database is a Pluggable Database (PDB).

Sample:
ocid1.parentcontainercompartment.oc1..xxxxxxEXAMPLExxxxxx
 
parent_container_id
string
on success
The OCID of the parent Container Database if Managed Database is a Pluggable Database.

Sample:
ocid1.parentcontainer.oc1..xxxxxxEXAMPLExxxxxx
 
parent_container_name
string
on success
The name of the parent Container Database.

Sample:
parent_container_name_example
 
pdb_count
integer
on success
The number of PDBs in the Container Database.

Sample:
56
 
pdb_status
complex
on success
The status of the PDB in the Container Database.

   
count
integer
on success
The number of PDBs with this status.

Sample:
56
   
status
string
on success
The status of the PDBs with this count.

Sample:
UP
 
time_created
string
on success
The date and time the Managed Database was created.

Sample:
2013-10-20T19:20:30+01:00
 
workload_type
string
on success
The workload type of the Autonomous Database.

Sample:
OLTP


Authors

  • Oracle (@oracle)