oci_database_db_system

This resource provides the Db System resource in Oracle Cloud Infrastructure Database service.

Creates a new DB system in the specified compartment and availability domain. The Oracle Database edition that you specify applies to all the databases on that DB system. The selected edition cannot be changed.

An initial database is created on the DB system based on the request parameters you provide and some default options. For detailed information about default options, see Bare metal and virtual machine DB system default options.

Note: Deprecated for Exadata Cloud Service systems. Use the new resource model APIs instead.

For Exadata Cloud Service instances, support for this API will end on May 15th, 2021. See Switching an Exadata DB System to the New Resource Model and APIs for details on converting existing Exadata DB systems to the new resource model.

Use the CreateCloudExadataInfrastructure and CreateCloudVmCluster APIs to provision a new Exadata Cloud Service instance.

Important: When auto_backup_enabled is not present in the configuration or set to true, the auto_backup_window and auto_full_backup_window will be ignored

Example Usage

resource "oci_database_db_system" "test_db_system" {
    #Required
    availability_domain = var.db_system_availability_domain
    compartment_id = var.compartment_id
    db_home {
        #Required
        database {
            #Required
            admin_password = var.db_system_db_home_database_admin_password

            #Optional
            backup_id = oci_database_backup.test_backup.id
            backup_tde_password = var.db_system_db_home_database_backup_tde_password
            character_set = var.db_system_db_home_database_character_set
            database_id = oci_database_database.test_database.id
            database_software_image_id = oci_database_database_software_image.test_database_software_image.id
            db_backup_config {

                #Optional
                auto_backup_enabled = var.db_system_db_home_database_db_backup_config_auto_backup_enabled
                auto_backup_window = var.db_system_db_home_database_db_backup_config_auto_backup_window
                auto_full_backup_day = var.db_system_db_home_database_db_backup_config_auto_full_backup_day
                auto_full_backup_window = var.db_system_db_home_database_db_backup_config_auto_full_backup_window
                backup_deletion_policy = var.db_system_db_home_database_db_backup_config_backup_deletion_policy
                backup_destination_details {

                    #Optional
                    dbrs_policy_id = oci_identity_policy.test_policy.id
                    id = var.db_system_db_home_database_db_backup_config_backup_destination_details_id
                    type = var.db_system_db_home_database_db_backup_config_backup_destination_details_type
                }
                recovery_window_in_days = var.db_system_db_home_database_db_backup_config_recovery_window_in_days
                run_immediate_full_backup = var.db_system_db_home_database_db_backup_config_run_immediate_full_backup
            }
            db_domain = var.db_system_db_home_database_db_domain
            db_name = var.db_system_db_home_database_db_name
            db_workload = var.db_system_db_home_database_db_workload
            defined_tags = var.db_system_db_home_database_defined_tags
            freeform_tags = var.db_system_db_home_database_freeform_tags
            kms_key_id = oci_kms_key.test_key.id
            kms_key_version_id = oci_kms_key_version.test_key_version.id
            ncharacter_set = var.db_system_db_home_database_ncharacter_set
            pdb_name = var.db_system_db_home_database_pdb_name
            pluggable_databases = var.db_system_db_home_database_pluggable_databases
            sid_prefix = var.db_system_db_home_database_sid_prefix
            tde_wallet_password = var.db_system_db_home_database_tde_wallet_password
            time_stamp_for_point_in_time_recovery = var.db_system_db_home_database_time_stamp_for_point_in_time_recovery
            vault_id = oci_kms_vault.test_vault.id
        }

        #Optional
        database_software_image_id = oci_database_database_software_image.test_database_software_image.id
        db_version = var.db_system_db_home_db_version
        defined_tags = var.db_system_db_home_defined_tags
        display_name = var.db_system_db_home_display_name
        freeform_tags = var.db_system_db_home_freeform_tags
    }
    hostname = var.db_system_hostname
    shape = var.db_system_shape
    ssh_public_keys = var.db_system_ssh_public_keys
    subnet_id = oci_core_subnet.test_subnet.id

    #Optional
    backup_network_nsg_ids = var.db_system_backup_network_nsg_ids
    backup_subnet_id = oci_core_subnet.test_subnet.id
    cluster_name = var.db_system_cluster_name
    cpu_core_count = var.db_system_cpu_core_count
    data_collection_options {

        #Optional
        is_diagnostics_events_enabled = var.db_system_data_collection_options_is_diagnostics_events_enabled
        is_health_monitoring_enabled = var.db_system_data_collection_options_is_health_monitoring_enabled
        is_incident_logs_enabled = var.db_system_data_collection_options_is_incident_logs_enabled
    }
    data_storage_percentage = var.db_system_data_storage_percentage
    data_storage_size_in_gb = var.db_system_data_storage_size_in_gb
    database_edition = var.db_system_database_edition
    db_system_options {

        #Optional
        storage_management = var.db_system_db_system_options_storage_management
    }
    defined_tags = var.db_system_defined_tags
    disk_redundancy = var.db_system_disk_redundancy
    display_name = var.db_system_display_name
    domain = var.db_system_domain
    fault_domains = var.db_system_fault_domains
    freeform_tags = {"Department"= "Finance"}
    kms_key_id = oci_kms_key.test_key.id
    kms_key_version_id = oci_kms_key_version.test_key_version.id
    license_model = var.db_system_license_model
    maintenance_window_details {

        #Optional
        custom_action_timeout_in_mins = var.db_system_maintenance_window_details_custom_action_timeout_in_mins
        days_of_week {

            #Optional
            name = var.db_system_maintenance_window_details_days_of_week_name
        }
        hours_of_day = var.db_system_maintenance_window_details_hours_of_day
        is_custom_action_timeout_enabled = var.db_system_maintenance_window_details_is_custom_action_timeout_enabled
        is_monthly_patching_enabled = var.db_system_maintenance_window_details_is_monthly_patching_enabled
        lead_time_in_weeks = var.db_system_maintenance_window_details_lead_time_in_weeks
        months {

            #Optional
            name = var.db_system_maintenance_window_details_months_name
        }
        patching_mode = var.db_system_maintenance_window_details_patching_mode
        preference = var.db_system_maintenance_window_details_preference
        weeks_of_month = var.db_system_maintenance_window_details_weeks_of_month
    }
    node_count = var.db_system_node_count
    nsg_ids = var.db_system_nsg_ids
    private_ip = var.db_system_private_ip
    source = var.db_system_source
    source_db_system_id = oci_database_db_system.test_db_system.id
    sparse_diskgroup = var.db_system_sparse_diskgroup
    storage_volume_performance_mode = var.db_system_storage_volume_performance_mode
    time_zone = var.db_system_time_zone
}

Argument Reference

The following arguments are supported:

** IMPORTANT ** Any change to a property that does not support update will force the destruction and recreation of the resource with the new property values

Attributes Reference

The following attributes are exported: md5-cbf74b4a9871e74e9c09f44b4a7c2a53

These subnets are used by the Oracle Clusterware private interconnect on the database instance. Specifying an overlapping subnet will cause the private interconnect to malfunction. This restriction applies to both the client subnet and backup subnet.

  • time_created - The date and time the DB system was created.
  • time_zone - The time zone of the DB system. For details, see DB System Time Zones.
  • version - The Oracle Database version of the DB system.
  • vip_ids - The OCID of the virtual IP (VIP) addresses associated with the DB system. The Cluster Ready Services (CRS) creates and maintains one VIP address for each node in the DB system to enable failover. If one node fails, the VIP is reassigned to another active node in the cluster.

    Note: For a single-node DB system, this list is empty.

  • zone_id - The OCID of the zone the DB system is associated with.
  • Timeouts

    The timeouts block allows you to specify timeouts for certain operations: * create - (Defaults to 2 hours), when creating the Db System * update - (Defaults to 2 hours), when updating the Db System * delete - (Defaults to 2 hours), when destroying the Db System

    Import

    DbSystems can be imported using the id, e.g.

    $ terraform import oci_database_db_system.test_db_system "id"
    

    Import is only supported for source=NONE

    db_home.0.database.0.admin_password is not returned by the service for security reasons. To avoid a force new of the db_home on the next apply, add the following to the resource:

        lifecycle {
            ignore_changes = ["db_home.0.database.0.admin_password"]
        }
    

    You may also need to add hostname to the ignore_changes list if you see a diff on a subsequent apply

    If the oci_database_db_system being imported is missing a primary db_home, an empty placeholder for db_home will be set in the Terraform state. To keep configurations consistent with the imported state, add an empty placeholder for db_home to your configuration like this:

      # Add this placeholder into your oci_database_db_system configuration to indicate that the primary db home is empty.
      db_home {
        database {
          admin_password = ""
        }
      }