oracle.oci.oci_database_database – Manage a Database resource in Oracle Cloud Infrastructure

Note

This plugin is part of the oracle.oci collection (version 5.3.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_database.

New in version 2.9.0: of oracle.oci

Synopsis

  • This module allows the user to create, update and delete a Database resource in Oracle Cloud Infrastructure

  • For state=present, creates a new database in the specified Database Home. If the database version is provided, it must match the version of the Database Home. Applies to Exadata and Exadata Cloud@Customer systems.

  • This resource has the following action operations in the oracle.oci.oci_database_database_actions module: precheck, upgrade, rollback.

Requirements

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

Parameters

Parameter Choices/Defaults Comments
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
  • security_token
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.
compartment_id
string
The compartment OCID.
Required for create using state=present.
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.
database
dictionary
Required for create using state=present.
admin_password
string / required
A strong password for SYS, SYSTEM, and PDB Admin. The password must be at least nine characters and contain at least two uppercase, two lowercase, two numbers, and two special characters. The special characters must be _, #, or -.
backup_id
string
The backup OCID.
Required when source is 'DB_BACKUP'
backup_tde_password
string
The password to open the TDE wallet.
Applicable when source is 'DB_BACKUP'
character_set
string
The character set for the database. The default is AL32UTF8. Allowed values are:
AL32UTF8, AR8ADOS710, AR8ADOS720, AR8APTEC715, AR8ARABICMACS, AR8ASMO8X, AR8ISO8859P6, AR8MSWIN1256, AR8MUSSAD768, AR8NAFITHA711, AR8NAFITHA721, AR8SAKHR706, AR8SAKHR707, AZ8ISO8859P9E, BG8MSWIN, BG8PC437S, BLT8CP921, BLT8ISO8859P13, BLT8MSWIN1257, BLT8PC775, BN8BSCII, CDN8PC863, CEL8ISO8859P14, CL8ISO8859P5, CL8ISOIR111, CL8KOI8R, CL8KOI8U, CL8MACCYRILLICS, CL8MSWIN1251, EE8ISO8859P2, EE8MACCES, EE8MACCROATIANS, EE8MSWIN1250, EE8PC852, EL8DEC, EL8ISO8859P7, EL8MACGREEKS, EL8MSWIN1253, EL8PC437S, EL8PC851, EL8PC869, ET8MSWIN923, HU8ABMOD, HU8CWI2, IN8ISCII, IS8PC861, IW8ISO8859P8, IW8MACHEBREWS, IW8MSWIN1255, IW8PC1507, JA16EUC, JA16EUCTILDE, JA16SJIS, JA16SJISTILDE, JA16VMS, KO16KSC5601, KO16KSCCS, KO16MSWIN949, LA8ISO6937, LA8PASSPORT, LT8MSWIN921, LT8PC772, LT8PC774, LV8PC1117, LV8PC8LR, LV8RST104090, N8PC865, NE8ISO8859P10, NEE8ISO8859P4, RU8BESTA, RU8PC855, RU8PC866, SE8ISO8859P3, TH8MACTHAIS, TH8TISASCII, TR8DEC, TR8MACTURKISHS, TR8MSWIN1254, TR8PC857, US7ASCII, US8PC437, UTF8, VN8MSWIN1258, VN8VN3, WE8DEC, WE8DG, WE8ISO8859P1, WE8ISO8859P15, WE8ISO8859P9, WE8MACROMAN8S, WE8MSWIN1252, WE8NCR4970, WE8NEXTSTEP, WE8PC850, WE8PC858, WE8PC860, WE8ROMAN8, ZHS16CGB231280, ZHS16GBK, ZHT16BIG5, ZHT16CCDC, ZHT16DBT, ZHT16HKSCS, ZHT16MSWIN950, ZHT32EUC, ZHT32SOPS, ZHT32TRIS
Applicable when source is 'NONE'
database_software_image_id
string
The database software image OCID
Applicable when source is 'NONE'
db_backup_config
dictionary
Applicable when source is 'NONE'
auto_backup_enabled
boolean
    Choices:
  • no
  • yes
If set to true, configures automatic backups. If you previously used RMAN or dbcli to configure backups and then you switch to using the Console or the API for backups, a new backup configuration is created and associated with your database. This means that you can no longer rely on your previously configured unmanaged backups to work.
Applicable when source is 'NONE'
auto_backup_window
string
    Choices:
  • SLOT_ONE
  • SLOT_TWO
  • SLOT_THREE
  • SLOT_FOUR
  • SLOT_FIVE
  • SLOT_SIX
  • SLOT_SEVEN
  • SLOT_EIGHT
  • SLOT_NINE
  • SLOT_TEN
  • SLOT_ELEVEN
  • SLOT_TWELVE
Time window selected for initiating automatic backup for the database system. There are twelve available two-hour time windows. If no option is selected, a start time between 12:00 AM to 7:00 AM in the region of the database is automatically chosen. For example, if the user selects SLOT_TWO from the enum list, the automatic backup job will start in between 2:00 AM (inclusive) to 4:00 AM (exclusive).
Example: `SLOT_TWO`
Applicable when source is 'NONE'
auto_full_backup_day
string
    Choices:
  • SUNDAY
  • MONDAY
  • TUESDAY
  • WEDNESDAY
  • THURSDAY
  • FRIDAY
  • SATURDAY
Day of the week the full backup should be applied on the database system. If no option is selected, the value is null and we will default to Sunday.
Applicable when source is 'NONE'
auto_full_backup_window
string
    Choices:
  • SLOT_ONE
  • SLOT_TWO
  • SLOT_THREE
  • SLOT_FOUR
  • SLOT_FIVE
  • SLOT_SIX
  • SLOT_SEVEN
  • SLOT_EIGHT
  • SLOT_NINE
  • SLOT_TEN
  • SLOT_ELEVEN
  • SLOT_TWELVE
Time window selected for initiating full backup for the database system. There are twelve available two-hour time windows. If no option is selected, the value is null and a start time between 12:00 AM to 7:00 AM in the region of the database is automatically chosen. For example, if the user selects SLOT_TWO from the enum list, the automatic backup job will start in between 2:00 AM (inclusive) to 4:00 AM (exclusive).
Example: `SLOT_TWO`
Applicable when source is 'NONE'
backup_deletion_policy
string
    Choices:
  • DELETE_IMMEDIATELY
  • DELETE_AFTER_RETENTION_PERIOD
This defines when the backups will be deleted. - IMMEDIATE option keep the backup for predefined time i.e 72 hours and then delete permanently... - RETAIN will keep the backups as per the policy defined for database backups.
Applicable when source is 'NONE'
backup_destination_details
list / elements=dictionary
Backup destination details.
Applicable when source is 'NONE'
dbrs_policy_id
string
The OCID of the DBRS policy used for backup.
Applicable when source is 'NONE'
id
string
The OCID of the backup destination.
Applicable when source is 'NONE'
internet_proxy
string
Proxy URL to connect to object store.
Applicable when source is 'NONE'
type
string / required
    Choices:
  • NFS
  • RECOVERY_APPLIANCE
  • OBJECT_STORE
  • LOCAL
  • DBRS
Type of the database backup destination.
Required when source is 'NONE'
vpc_password
string
For a RECOVERY_APPLIANCE backup destination, the password for the VPC user that is used to access the Recovery Appliance.
Applicable when source is 'NONE'
vpc_user
string
For a RECOVERY_APPLIANCE backup destination, the Virtual Private Catalog (VPC) user that is used to access the Recovery Appliance.
Applicable when source is 'NONE'
recovery_window_in_days
integer
Number of days between the current and the earliest point of recoverability covered by automatic backups. This value applies to automatic backups only. After a new automatic backup has been created, Oracle removes old automatic backups that are created before the window. When the value is updated, it is applied to all existing automatic backups.
Applicable when source is 'NONE'
run_immediate_full_backup
boolean
    Choices:
  • no
  • yes
If set to true, configures automatic full backups in the local region (the region of the DB system) for the first backup run immediately.
Applicable when source is 'NONE'
db_name
string
The database name. The name must begin with an alphabetic character and can contain a maximum of eight alphanumeric characters. Special characters are not permitted.
Required when source is 'NONE'
db_unique_name
string
The `DB_UNIQUE_NAME` of the Oracle Database being backed up.
db_workload
string
    Choices:
  • OLTP
  • DSS
**Deprecated.** The dbWorkload field has been deprecated for Exadata Database Service on Dedicated Infrastructure, Exadata Database Service on Cloud@Customer, and Base Database Service. Support for this attribute will end in November 2023. You may choose to update your custom scripts to exclude the dbWorkload attribute. After November 2023 if you pass a value to the dbWorkload attribute, it will be ignored.
The database workload type.
Applicable when source is 'NONE'
defined_tags
dictionary
Defined tags for this resource. Each key is predefined and scoped to a namespace. For more information, see Resource Tags.
Applicable when source is 'NONE'
freeform_tags
dictionary
Free-form tags for this resource. Each tag is a simple key-value pair with no predefined name, type, or namespace. For more information, see Resource Tags.
Example: `{"Department": "Finance"}`
Applicable when source is 'NONE'
kms_key_id
string
The OCID of the key container that is used as the master encryption key in database transparent data encryption (TDE) operations.
Applicable when source is 'NONE'
kms_key_version_id
string
The OCID of the key container version that is used in database transparent data encryption (TDE) operations KMS Key can have multiple key versions. If none is specified, the current key version (latest) of the Key Id is used for the operation. Autonomous Database Serverless does not use key versions, hence is not applicable for Autonomous Database Serverless instances.
Applicable when source is 'NONE'
ncharacter_set
string
The national character set for the database. The default is AL16UTF16. Allowed values are: AL16UTF16 or UTF8.
Applicable when source is 'NONE'
pdb_name
string
The name of the pluggable database. The name must begin with an alphabetic character and can contain a maximum of thirty alphanumeric characters. Special characters are not permitted. Pluggable database should not be same as database name.
Applicable when source is 'NONE'
pluggable_databases
list / elements=string
The list of pluggable databases that needs to be restored into new database.
Applicable when source is 'DB_BACKUP'
sid_prefix
string
Specifies a prefix for the `Oracle SID` of the database to be created.
tde_wallet_password
string
The optional password to open the TDE wallet. The password must be at least nine characters and contain at least two uppercase, two lowercase, two numeric, and two special characters. The special characters must be _, #, or -.
Applicable when source is 'NONE'
vault_id
string
The OCID of the Oracle Cloud Infrastructure vault. This parameter and `secretId` are required for Customer Managed Keys.
Applicable when source is 'NONE'
database_id
string
The database OCID.
Required for update using state=present.
Required for delete using state=absent.

aliases: id
db_backup_config
dictionary
This parameter is updatable.
auto_backup_enabled
boolean
    Choices:
  • no
  • yes
If set to true, configures automatic backups. If you previously used RMAN or dbcli to configure backups and then you switch to using the Console or the API for backups, a new backup configuration is created and associated with your database. This means that you can no longer rely on your previously configured unmanaged backups to work.
This parameter is updatable.
auto_backup_window
string
    Choices:
  • SLOT_ONE
  • SLOT_TWO
  • SLOT_THREE
  • SLOT_FOUR
  • SLOT_FIVE
  • SLOT_SIX
  • SLOT_SEVEN
  • SLOT_EIGHT
  • SLOT_NINE
  • SLOT_TEN
  • SLOT_ELEVEN
  • SLOT_TWELVE
Time window selected for initiating automatic backup for the database system. There are twelve available two-hour time windows. If no option is selected, a start time between 12:00 AM to 7:00 AM in the region of the database is automatically chosen. For example, if the user selects SLOT_TWO from the enum list, the automatic backup job will start in between 2:00 AM (inclusive) to 4:00 AM (exclusive).
Example: `SLOT_TWO`
This parameter is updatable.
auto_full_backup_day
string
    Choices:
  • SUNDAY
  • MONDAY
  • TUESDAY
  • WEDNESDAY
  • THURSDAY
  • FRIDAY
  • SATURDAY
Day of the week the full backup should be applied on the database system. If no option is selected, the value is null and we will default to Sunday.
This parameter is updatable.
auto_full_backup_window
string
    Choices:
  • SLOT_ONE
  • SLOT_TWO
  • SLOT_THREE
  • SLOT_FOUR
  • SLOT_FIVE
  • SLOT_SIX
  • SLOT_SEVEN
  • SLOT_EIGHT
  • SLOT_NINE
  • SLOT_TEN
  • SLOT_ELEVEN
  • SLOT_TWELVE
Time window selected for initiating full backup for the database system. There are twelve available two-hour time windows. If no option is selected, the value is null and a start time between 12:00 AM to 7:00 AM in the region of the database is automatically chosen. For example, if the user selects SLOT_TWO from the enum list, the automatic backup job will start in between 2:00 AM (inclusive) to 4:00 AM (exclusive).
Example: `SLOT_TWO`
This parameter is updatable.
backup_deletion_policy
string
    Choices:
  • DELETE_IMMEDIATELY
  • DELETE_AFTER_RETENTION_PERIOD
This defines when the backups will be deleted. - IMMEDIATE option keep the backup for predefined time i.e 72 hours and then delete permanently... - RETAIN will keep the backups as per the policy defined for database backups.
This parameter is updatable.
backup_destination_details
list / elements=dictionary
Backup destination details.
dbrs_policy_id
string
The OCID of the DBRS policy used for backup.
This parameter is updatable.
id
string
The OCID of the backup destination.
This parameter is updatable.
internet_proxy
string
Proxy URL to connect to object store.
This parameter is updatable.
type
string / required
    Choices:
  • NFS
  • RECOVERY_APPLIANCE
  • OBJECT_STORE
  • LOCAL
  • DBRS
Type of the database backup destination.
This parameter is updatable.
vpc_password
string
For a RECOVERY_APPLIANCE backup destination, the password for the VPC user that is used to access the Recovery Appliance.
This parameter is updatable.
vpc_user
string
For a RECOVERY_APPLIANCE backup destination, the Virtual Private Catalog (VPC) user that is used to access the Recovery Appliance.
This parameter is updatable.
recovery_window_in_days
integer
Number of days between the current and the earliest point of recoverability covered by automatic backups. This value applies to automatic backups only. After a new automatic backup has been created, Oracle removes old automatic backups that are created before the window. When the value is updated, it is applied to all existing automatic backups.
This parameter is updatable.
run_immediate_full_backup
boolean
    Choices:
  • no
  • yes
If set to true, configures automatic full backups in the local region (the region of the DB system) for the first backup run immediately.
This parameter is updatable.
db_home_id
string
The OCID of the Database Home.
Required for create using state=present.
This parameter is updatable.
db_version
string
A valid Oracle Database version. For a list of supported versions, use the ListDbVersions operation.
This cannot be updated in parallel with any of the following: licenseModel, dbEdition, cpuCoreCount, computeCount, computeModel, adminPassword, whitelistedIps, isMTLSConnectionRequired, openMode, permissionLevel, dbWorkload, privateEndpointLabel, nsgIds, isRefreshable, dbName, scheduledOperations, dbToolsDetails, isLocalDataGuardEnabled, or isFreeTier.
defined_tags
dictionary
Defined tags for this resource. Each key is predefined and scoped to a namespace. For more information, see Resource Tags.
This parameter is updatable.
force_create
boolean
    Choices:
  • no ←
  • yes
Whether to attempt non-idempotent creation of a resource. By default, create resource is an idempotent operation, and doesn't create the resource if it already exists. Setting this option to true, forcefully creates a copy of the resource, even if it already exists.This option is mutually exclusive with key_by.
freeform_tags
dictionary
Free-form tags for this resource. Each tag is a simple key-value pair with no predefined name, type, or namespace. For more information, see Resource Tags.
Example: `{"Department": "Finance"}`
This parameter is updatable.
key_by
list / elements=string
The list of attributes of this resource which should be used to uniquely identify an instance of the resource. By default, all the attributes of a resource are used to uniquely identify a resource.
kms_key_id
string
The OCID of the key container that is used as the master encryption key in database transparent data encryption (TDE) operations.
kms_key_version_id
string
The OCID of the key container version that is used in database transparent data encryption (TDE) operations KMS Key can have multiple key versions. If none is specified, the current key version (latest) of the Key Id is used for the operation. Autonomous Database Serverless does not use key versions, hence is not applicable for Autonomous Database Serverless instances.
new_admin_password
string
A new strong password for SYS, SYSTEM, and the plugbable database ADMIN user. The password must be at least nine characters and contain at least two uppercase, two lowercase, two numeric, and two special characters. The special characters must be _, #, or -.
This parameter is updatable.
new_tde_wallet_password
string
The new password to open the TDE wallet. The password must be at least nine characters and contain at least two uppercase, two lowercase, two numeric, and two special characters. The special characters must be _, #, or -.
This parameter is updatable.
old_tde_wallet_password
string
The existing TDE wallet password. You must provide the existing password in order to set a new TDE wallet password.
This parameter is updatable.
perform_final_backup
boolean
    Choices:
  • no
  • yes
Whether to perform a final backup of the database or not. Default is false.
If you previously used RMAN or dbcli to configure backups and then you switch to using the Console or the API for backups, a new backup configuration is created and associated with your database. This means that you can no longer rely on your previously configured unmanaged backups to work.
This parameter is used in multiple APIs. Refer to the API description for details on how the operation uses it.
realm_specific_endpoint_template_enabled
boolean
    Choices:
  • no
  • yes
Enable/Disable realm specific endpoint template for service client. By Default, realm specific endpoint template is disabled. If not set, then the value of the OCI_REALM_SPECIFIC_SERVICE_ENDPOINT_TEMPLATE_ENABLED variable, if any, is used.
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.
source
string
    Choices:
  • NONE ←
  • DB_BACKUP
The source of the database: Use `NONE` for creating a new database. Use `DB_BACKUP` for creating a new database by restoring from a backup. The default is `NONE`.
Required for create using state=present.
state
string
    Choices:
  • present ←
  • absent
The state of the Database.
Use state=present to create or update a Database.
Use state=absent to delete a Database.
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
wait
boolean
    Choices:
  • no
  • yes ←
Whether to wait for create or delete operation to complete.
wait_timeout
integer
Time, in seconds, to wait when wait=yes. Defaults to 1200 for most of the services but some services might have a longer wait timeout.

Examples

- name: Create database with source = NONE
  oci_database_database:
    # required
    database:
      # required
      admin_password: example-password

      # optional
      database_software_image_id: "ocid1.databasesoftwareimage.oc1..xxxxxxEXAMPLExxxxxx"
      pdb_name: pdb_name_example
      tde_wallet_password: example-password
      character_set: character_set_example
      ncharacter_set: ncharacter_set_example
      db_workload: OLTP
      db_backup_config:
        # optional
        auto_backup_enabled: true
        recovery_window_in_days: 56
        auto_backup_window: SLOT_ONE
        auto_full_backup_window: SLOT_ONE
        auto_full_backup_day: SUNDAY
        run_immediate_full_backup: true
        backup_destination_details:
        - # required
          type: NFS

          # optional
          id: "ocid1.resource.oc1..xxxxxxEXAMPLExxxxxx"
          vpc_user: vpc_user_example
          vpc_password: example-password
          internet_proxy: internet_proxy_example
          dbrs_policy_id: "ocid1.dbrspolicy.oc1..xxxxxxEXAMPLExxxxxx"
        backup_deletion_policy: DELETE_IMMEDIATELY
      freeform_tags: {'Department': 'Finance'}
      defined_tags: {'Operations': {'CostCenter': 'US'}}
      kms_key_id: "ocid1.kmskey.oc1..xxxxxxEXAMPLExxxxxx"
      kms_key_version_id: "ocid1.kmskeyversion.oc1..xxxxxxEXAMPLExxxxxx"
      vault_id: "ocid1.vault.oc1..xxxxxxEXAMPLExxxxxx"
      backup_id: "ocid1.backup.oc1..xxxxxxEXAMPLExxxxxx"
      backup_tde_password: example-password
      db_unique_name: db_unique_name_example
      db_name: db_name_example
      sid_prefix: sid_prefix_example
      pluggable_databases: [ "pluggable_databases_example" ]
    db_home_id: "ocid1.dbhome.oc1..xxxxxxEXAMPLExxxxxx"

    # optional
    db_version: db_version_example
    source: NONE
    kms_key_id: "ocid1.kmskey.oc1..xxxxxxEXAMPLExxxxxx"
    kms_key_version_id: "ocid1.kmskeyversion.oc1..xxxxxxEXAMPLExxxxxx"

- name: Create database with source = DB_BACKUP
  oci_database_database:
    # required
    source: DB_BACKUP
    database:
      # required
      admin_password: example-password

      # optional
      database_software_image_id: "ocid1.databasesoftwareimage.oc1..xxxxxxEXAMPLExxxxxx"
      pdb_name: pdb_name_example
      tde_wallet_password: example-password
      character_set: character_set_example
      ncharacter_set: ncharacter_set_example
      db_workload: OLTP
      db_backup_config:
        # optional
        auto_backup_enabled: true
        recovery_window_in_days: 56
        auto_backup_window: SLOT_ONE
        auto_full_backup_window: SLOT_ONE
        auto_full_backup_day: SUNDAY
        run_immediate_full_backup: true
        backup_destination_details:
        - # required
          type: NFS

          # optional
          id: "ocid1.resource.oc1..xxxxxxEXAMPLExxxxxx"
          vpc_user: vpc_user_example
          vpc_password: example-password
          internet_proxy: internet_proxy_example
          dbrs_policy_id: "ocid1.dbrspolicy.oc1..xxxxxxEXAMPLExxxxxx"
        backup_deletion_policy: DELETE_IMMEDIATELY
      freeform_tags: {'Department': 'Finance'}
      defined_tags: {'Operations': {'CostCenter': 'US'}}
      kms_key_id: "ocid1.kmskey.oc1..xxxxxxEXAMPLExxxxxx"
      kms_key_version_id: "ocid1.kmskeyversion.oc1..xxxxxxEXAMPLExxxxxx"
      vault_id: "ocid1.vault.oc1..xxxxxxEXAMPLExxxxxx"
      backup_id: "ocid1.backup.oc1..xxxxxxEXAMPLExxxxxx"
      backup_tde_password: example-password
      db_unique_name: db_unique_name_example
      db_name: db_name_example
      sid_prefix: sid_prefix_example
      pluggable_databases: [ "pluggable_databases_example" ]
    db_home_id: "ocid1.dbhome.oc1..xxxxxxEXAMPLExxxxxx"

    # optional
    db_version: db_version_example
    kms_key_id: "ocid1.kmskey.oc1..xxxxxxEXAMPLExxxxxx"
    kms_key_version_id: "ocid1.kmskeyversion.oc1..xxxxxxEXAMPLExxxxxx"

- name: Update database
  oci_database_database:
    # required
    database_id: "ocid1.database.oc1..xxxxxxEXAMPLExxxxxx"

    # optional
    db_backup_config:
      # optional
      auto_backup_enabled: true
      recovery_window_in_days: 56
      auto_backup_window: SLOT_ONE
      auto_full_backup_window: SLOT_ONE
      auto_full_backup_day: SUNDAY
      run_immediate_full_backup: true
      backup_destination_details:
      - # required
        type: NFS

        # optional
        id: "ocid1.resource.oc1..xxxxxxEXAMPLExxxxxx"
        vpc_user: vpc_user_example
        vpc_password: example-password
        internet_proxy: internet_proxy_example
        dbrs_policy_id: "ocid1.dbrspolicy.oc1..xxxxxxEXAMPLExxxxxx"
      backup_deletion_policy: DELETE_IMMEDIATELY
    db_home_id: "ocid1.dbhome.oc1..xxxxxxEXAMPLExxxxxx"
    new_admin_password: example-password
    old_tde_wallet_password: example-password
    new_tde_wallet_password: example-password
    freeform_tags: {'Department': 'Finance'}
    defined_tags: {'Operations': {'CostCenter': 'US'}}

- name: Delete database
  oci_database_database:
    # required
    database_id: "ocid1.database.oc1..xxxxxxEXAMPLExxxxxx"
    state: absent

    # optional
    perform_final_backup: true

Return Values

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

Key Returned Description
database
complex
on success
Details of the Database resource acted upon by the current operation

Sample:
{'character_set': 'character_set_example', 'compartment_id': 'ocid1.compartment.oc1..xxxxxxEXAMPLExxxxxx', 'connection_strings': {'all_connection_strings': {}, 'cdb_default': 'cdb_default_example', 'cdb_ip_default': 'cdb_ip_default_example'}, 'database_management_config': {'management_status': 'ENABLING', 'management_type': 'BASIC'}, 'database_software_image_id': 'ocid1.databasesoftwareimage.oc1..xxxxxxEXAMPLExxxxxx', 'db_backup_config': {'auto_backup_enabled': True, 'auto_backup_window': 'SLOT_ONE', 'auto_full_backup_day': 'SUNDAY', 'auto_full_backup_window': 'SLOT_ONE', 'backup_deletion_policy': 'DELETE_IMMEDIATELY', 'backup_destination_details': [{'dbrs_policy_id': 'ocid1.dbrspolicy.oc1..xxxxxxEXAMPLExxxxxx', 'id': 'ocid1.resource.oc1..xxxxxxEXAMPLExxxxxx', 'internet_proxy': 'internet_proxy_example', 'type': 'NFS', 'vpc_password': 'example-password', 'vpc_user': 'vpc_user_example'}], 'recovery_window_in_days': 56, 'run_immediate_full_backup': True}, 'db_home_id': 'ocid1.dbhome.oc1..xxxxxxEXAMPLExxxxxx', 'db_name': 'db_name_example', 'db_system_id': 'ocid1.dbsystem.oc1..xxxxxxEXAMPLExxxxxx', 'db_unique_name': 'db_unique_name_example', 'db_workload': 'db_workload_example', 'defined_tags': {'Operations': {'CostCenter': 'US'}}, 'freeform_tags': {'Department': 'Finance'}, 'id': 'ocid1.resource.oc1..xxxxxxEXAMPLExxxxxx', 'is_cdb': True, 'key_store_id': 'ocid1.keystore.oc1..xxxxxxEXAMPLExxxxxx', 'key_store_wallet_name': 'key_store_wallet_name_example', 'kms_key_id': 'ocid1.kmskey.oc1..xxxxxxEXAMPLExxxxxx', 'kms_key_version_id': 'ocid1.kmskeyversion.oc1..xxxxxxEXAMPLExxxxxx', 'last_backup_duration_in_seconds': 56, 'last_backup_timestamp': '2013-10-20T19:20:30+01:00', 'last_failed_backup_timestamp': '2013-10-20T19:20:30+01:00', 'lifecycle_details': 'lifecycle_details_example', 'lifecycle_state': 'PROVISIONING', 'ncharacter_set': 'ncharacter_set_example', 'pdb_name': 'pdb_name_example', 'sid_prefix': 'sid_prefix_example', 'source_database_point_in_time_recovery_timestamp': '2013-10-20T19:20:30+01:00', 'time_created': '2013-10-20T19:20:30+01:00', 'vault_id': 'ocid1.vault.oc1..xxxxxxEXAMPLExxxxxx', 'vm_cluster_id': 'ocid1.vmcluster.oc1..xxxxxxEXAMPLExxxxxx'}
 
character_set
string
on success
The character set for the database.

Sample:
character_set_example
 
compartment_id
string
on success
The OCID of the compartment.

Sample:
ocid1.compartment.oc1..xxxxxxEXAMPLExxxxxx
 
connection_strings
complex
on success
The Connection strings used to connect to the Oracle Database.

   
all_connection_strings
dictionary
on success
All connection strings to use to connect to the Database.

   
cdb_default
string
on success
Host name based CDB Connection String.

Sample:
cdb_default_example
   
cdb_ip_default
string
on success
IP based CDB Connection String.

Sample:
cdb_ip_default_example
 
database_management_config
complex
on success

   
management_status
string
on success
The status of the Database Management service.

Sample:
ENABLING
   
management_type
string
on success
The Database Management type.

Sample:
BASIC
 
database_software_image_id
string
on success
The database software image OCID

Sample:
ocid1.databasesoftwareimage.oc1..xxxxxxEXAMPLExxxxxx
 
db_backup_config
complex
on success

   
auto_backup_enabled
boolean
on success
If set to true, configures automatic backups. If you previously used RMAN or dbcli to configure backups and then you switch to using the Console or the API for backups, a new backup configuration is created and associated with your database. This means that you can no longer rely on your previously configured unmanaged backups to work.

Sample:
True
   
auto_backup_window
string
on success
Time window selected for initiating automatic backup for the database system. There are twelve available two-hour time windows. If no option is selected, a start time between 12:00 AM to 7:00 AM in the region of the database is automatically chosen. For example, if the user selects SLOT_TWO from the enum list, the automatic backup job will start in between 2:00 AM (inclusive) to 4:00 AM (exclusive).
Example: `SLOT_TWO`

Sample:
SLOT_ONE
   
auto_full_backup_day
string
on success
Day of the week the full backup should be applied on the database system. If no option is selected, the value is null and we will default to Sunday.

Sample:
SUNDAY
   
auto_full_backup_window
string
on success
Time window selected for initiating full backup for the database system. There are twelve available two-hour time windows. If no option is selected, the value is null and a start time between 12:00 AM to 7:00 AM in the region of the database is automatically chosen. For example, if the user selects SLOT_TWO from the enum list, the automatic backup job will start in between 2:00 AM (inclusive) to 4:00 AM (exclusive).
Example: `SLOT_TWO`

Sample:
SLOT_ONE
   
backup_deletion_policy
string
on success
This defines when the backups will be deleted. - IMMEDIATE option keep the backup for predefined time i.e 72 hours and then delete permanently... - RETAIN will keep the backups as per the policy defined for database backups.

Sample:
DELETE_IMMEDIATELY
   
backup_destination_details
complex
on success
Backup destination details.

     
dbrs_policy_id
string
on success
The OCID of the DBRS policy used for backup.

Sample:
ocid1.dbrspolicy.oc1..xxxxxxEXAMPLExxxxxx
     
id
string
on success
The OCID of the backup destination.

Sample:
ocid1.resource.oc1..xxxxxxEXAMPLExxxxxx
     
internet_proxy
string
on success
Proxy URL to connect to object store.

Sample:
internet_proxy_example
     
type
string
on success
Type of the database backup destination.

Sample:
NFS
     
vpc_password
string
on success
For a RECOVERY_APPLIANCE backup destination, the password for the VPC user that is used to access the Recovery Appliance.

Sample:
example-password
     
vpc_user
string
on success
For a RECOVERY_APPLIANCE backup destination, the Virtual Private Catalog (VPC) user that is used to access the Recovery Appliance.

Sample:
vpc_user_example
   
recovery_window_in_days
integer
on success
Number of days between the current and the earliest point of recoverability covered by automatic backups. This value applies to automatic backups only. After a new automatic backup has been created, Oracle removes old automatic backups that are created before the window. When the value is updated, it is applied to all existing automatic backups.

Sample:
56
   
run_immediate_full_backup
boolean
on success
If set to true, configures automatic full backups in the local region (the region of the DB system) for the first backup run immediately.

Sample:
True
 
db_home_id
string
on success
The OCID of the Database Home.

Sample:
ocid1.dbhome.oc1..xxxxxxEXAMPLExxxxxx
 
db_name
string
on success
The database name.

Sample:
db_name_example
 
db_system_id
string
on success
The OCID of the DB system.

Sample:
ocid1.dbsystem.oc1..xxxxxxEXAMPLExxxxxx
 
db_unique_name
string
on success
A system-generated name for the database to ensure uniqueness within an Oracle Data Guard group (a primary database and its standby databases). The unique name cannot be changed.

Sample:
db_unique_name_example
 
db_workload
string
on success
**Deprecated.** The dbWorkload field has been deprecated for Exadata Database Service on Dedicated Infrastructure, Exadata Database Service on Cloud@Customer, and Base Database Service. Support for this attribute will end in November 2023. You may choose to update your custom scripts to exclude the dbWorkload attribute. After November 2023 if you pass a value to the dbWorkload attribute, it will be ignored.
The database workload type.

Sample:
db_workload_example
 
defined_tags
dictionary
on success
Defined tags for this resource. Each key is predefined and scoped to a namespace. For more information, see Resource Tags.

Sample:
{'Operations': {'CostCenter': 'US'}}
 
freeform_tags
dictionary
on success
Free-form tags for this resource. Each tag is a simple key-value pair with no predefined name, type, or namespace. For more information, see Resource Tags.
Example: `{"Department": "Finance"}`

Sample:
{'Department': 'Finance'}
 
id
string
on success
The OCID of the database.

Sample:
ocid1.resource.oc1..xxxxxxEXAMPLExxxxxx
 
is_cdb
boolean
on success
True if the database is a container database.

Sample:
True
 
key_store_id
string
on success
The OCID of the key store of Oracle Vault.

Sample:
ocid1.keystore.oc1..xxxxxxEXAMPLExxxxxx
 
key_store_wallet_name
string
on success
The wallet name for Oracle Key Vault.

Sample:
key_store_wallet_name_example
 
kms_key_id
string
on success
The OCID of the key container that is used as the master encryption key in database transparent data encryption (TDE) operations.

Sample:
ocid1.kmskey.oc1..xxxxxxEXAMPLExxxxxx
 
kms_key_version_id
string
on success
The OCID of the key container version that is used in database transparent data encryption (TDE) operations KMS Key can have multiple key versions. If none is specified, the current key version (latest) of the Key Id is used for the operation. Autonomous Database Serverless does not use key versions, hence is not applicable for Autonomous Database Serverless instances.

Sample:
ocid1.kmskeyversion.oc1..xxxxxxEXAMPLExxxxxx
 
last_backup_duration_in_seconds
integer
on success
The duration when the latest database backup created.

Sample:
56
 
last_backup_timestamp
string
on success
The date and time when the latest database backup was created.

Sample:
2013-10-20T19:20:30+01:00
 
last_failed_backup_timestamp
string
on success
The date and time when the latest database backup failed.

Sample:
2013-10-20T19:20:30+01:00
 
lifecycle_details
string
on success
Additional information about the current lifecycle state.

Sample:
lifecycle_details_example
 
lifecycle_state
string
on success
The current state of the database.

Sample:
PROVISIONING
 
ncharacter_set
string
on success
The national character set for the database.

Sample:
ncharacter_set_example
 
pdb_name
string
on success
The name of the pluggable database. The name must begin with an alphabetic character and can contain a maximum of thirty alphanumeric characters. Special characters are not permitted. Pluggable database should not be same as database name.

Sample:
pdb_name_example
 
sid_prefix
string
on success
Specifies a prefix for the `Oracle SID` of the database to be created.

Sample:
sid_prefix_example
 
source_database_point_in_time_recovery_timestamp
string
on success
Point in time recovery timeStamp of the source database at which cloned database system is cloned from the source database system, as described in RFC 3339

Sample:
2013-10-20T19:20:30+01:00
 
time_created
string
on success
The date and time the database was created.

Sample:
2013-10-20T19:20:30+01:00
 
vault_id
string
on success
The OCID of the Oracle Cloud Infrastructure vault. This parameter and `secretId` are required for Customer Managed Keys.

Sample:
ocid1.vault.oc1..xxxxxxEXAMPLExxxxxx
 
vm_cluster_id
string
on success
The OCID of the VM cluster.

Sample:
ocid1.vmcluster.oc1..xxxxxxEXAMPLExxxxxx


Authors

  • Oracle (@oracle)