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
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
}
The following arguments are supported:
availability_domain
- (Required) The availability domain where the DB system is located.backup_network_nsg_ids
- (Optional) (Updatable) A list of the OCIDs of the network security groups (NSGs) that the backup network of this DB system belongs to. Setting this to an empty array after the list is created removes the resource from all NSGs. For more information about NSGs, see Security Rules. Applicable only to Exadata systems. backup_subnet_id
- (Optional) The OCID of the backup network subnet the DB system is associated with. Applicable only to Exadata DB systems.
Subnet Restrictions: See the subnet restrictions information for subnetId.
cluster_name
- (Optional) The cluster name for Exadata and 2-node RAC virtual machine DB systems. The cluster name must begin with an alphabetic character, and may contain hyphens (-). Underscores (_) are not permitted. The cluster name can be no longer than 11 characters and is not case sensitive. compartment_id
- (Required) (Updatable) The OCID of the compartment the DB system belongs in.cpu_core_count
- (Optional) (Updatable) The number of CPU cores to enable for a bare metal or Exadata DB system or AMD VMDB Systems. The valid values depend on the specified shape:
This parameter is not used for INTEL virtual machine DB systems because virtual machine DB systems have a set number of cores for each shape. For information about the number of cores for a virtual machine DB system shape, see Virtual Machine DB Systems
data_collection_options
- (Optional) (Updatable) Indicates user preferences for the various diagnostic collection options for the VM cluster/Cloud VM cluster/VMBM DBCS.
md5-66490f6ef2796730e0ebe26c0ded4da5
To get a list of shapes, use the ListDbSystemShapes operation.
source
- (Optional) 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. Use DATABASE
for creating a new database from an existing database, including archive redo log data. The default is NONE
. source_db_system_id
- (Required when source=DB_SYSTEM) The OCID of the DB system.sparse_diskgroup
- (Optional) If true, Sparse Diskgroup is configured for Exadata dbsystem. If False, Sparse diskgroup is not configured. Only applied for Exadata shape.ssh_public_keys
- (Required) (Updatable) The public key portion of the key pair to use for SSH access to the DB system. Multiple public keys can be provided. The length of the combined keys cannot exceed 40,000 characters.storage_volume_performance_mode
- (Optional) The block storage volume performance level. Valid values are BALANCED
and HIGH_PERFORMANCE
. See Block Volume Performance for more information. subnet_id
- (Required) The OCID of the subnet the DB system is associated with.
Subnet Restrictions:
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 the backup subnet.
time_zone
- (Optional) The time zone to use for the DB system. For details, see DB System Time Zones.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. 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
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 = ""
}
}