# This is an automatically generated code sample.
# To make this code sample work in your Oracle Cloud tenancy,
# please replace the values for any parameters whose current values do not fit
# your use case (such as resource IDs, strings containing ‘EXAMPLE’ or ‘unique_id’, and
# boolean, number, and enum parameters with values not fitting your use case).

require 'oci'

# Create a default config using DEFAULT profile in default location
# Refer to https://docs.cloud.oracle.com/en-us/iaas/Content/API/Concepts/sdkconfig.htm#SDK_and_CLI_Configuration_File for more info
config = OCI::ConfigFileLoader.load_config

# Initialize service client with default config file
database_client = OCI::Database::DatabaseClient.new(config: config)

# Send the request to service, some parameters are not required, see API doc for more info
launch_db_system_response =
  database_client.launch_db_system(
    OCI::Database::Models::LaunchDbSystemDetails.new(
      source: 'NONE',
      compartment_id: 'ocid1.test.oc1..<unique_ID>EXAMPLE-compartmentId-Value',
      availability_domain: 'EXAMPLE-availabilityDomain-Value',
      subnet_id: 'ocid1.test.oc1..<unique_ID>EXAMPLE-subnetId-Value',
      shape: 'EXAMPLE-shape-Value',
      ssh_public_keys: %w[EXAMPLE--Value],
      hostname: 'EXAMPLE-hostname-Value',
      cpu_core_count: 2,
      db_home:
        OCI::Database::Models::CreateDbHomeDetails.new(
          db_version: 'EXAMPLE-dbVersion-Value',
          database:
            OCI::Database::Models::CreateDatabaseDetails.new(
              db_name: 'EXAMPLE-dbName-Value',
              admin_password: 'EXAMPLE-adminPassword-Value',
              db_unique_name: 'EXAMPLE-dbUniqueName-Value',
              database_software_image_id:
                'ocid1.test.oc1..<unique_ID>EXAMPLE-databaseSoftwareImageId-Value',
              pdb_name: 'EXAMPLE-pdbName-Value',
              tde_wallet_password: 'EXAMPLE-tdeWalletPassword-Value',
              character_set: 'EXAMPLE-characterSet-Value',
              ncharacter_set: 'EXAMPLE-ncharacterSet-Value',
              db_workload: 'DSS',
              db_backup_config:
                OCI::Database::Models::DbBackupConfig.new(
                  auto_backup_enabled: true,
                  recovery_window_in_days: 12,
                  auto_backup_window: 'SLOT_THREE',
                  auto_full_backup_window: 'SLOT_TEN',
                  auto_full_backup_day: 'SUNDAY',
                  run_immediate_full_backup: false,
                  backup_destination_details: [
                    OCI::Database::Models::BackupDestinationDetails.new(
                      type: 'DBRS',
                      id: 'ocid1.test.oc1..<unique_ID>EXAMPLE-id-Value',
                      vpc_user: 'EXAMPLE-vpcUser-Value',
                      vpc_password: 'EXAMPLE-vpcPassword-Value',
                      internet_proxy: 'EXAMPLE-internetProxy-Value',
                      dbrs_policy_id:
                        'ocid1.test.oc1..<unique_ID>EXAMPLE-dbrsPolicyId-Value'
                    )
                  ],
                  backup_deletion_policy: 'DELETE_IMMEDIATELY'
                ),
              freeform_tags: {
                'EXAMPLE_KEY_hynzz' => 'EXAMPLE_VALUE_X90A7flFTsCIjla0JGQK'
              },
              defined_tags: {
                'EXAMPLE_KEY_Dlfpr' => {
                  'EXAMPLE_KEY_2BTPd' => 'EXAMPLE--Value'
                }
              },
              kms_key_id: 'ocid1.test.oc1..<unique_ID>EXAMPLE-kmsKeyId-Value',
              kms_key_version_id:
                'ocid1.test.oc1..<unique_ID>EXAMPLE-kmsKeyVersionId-Value',
              vault_id: 'ocid1.test.oc1..<unique_ID>EXAMPLE-vaultId-Value',
              sid_prefix: 'EXAMPLE-sidPrefix-Value',
              key_store_id:
                'ocid1.test.oc1..<unique_ID>EXAMPLE-keyStoreId-Value',
              encryption_key_location_details:
                OCI::Database::Models::ExternalHsmEncryptionDetails.new(
                  provider_type: 'EXTERNAL',
                  hsm_password: 'EXAMPLE-hsmPassword-Value'
                )
            ),
          display_name: 'EXAMPLE-displayName-Value',
          database_software_image_id:
            'ocid1.test.oc1..<unique_ID>EXAMPLE-databaseSoftwareImageId-Value',
          freeform_tags: {
            'EXAMPLE_KEY_oVNkK' => 'EXAMPLE_VALUE_jjPILSVuswYVUeE3Q6Jr'
          },
          defined_tags: {
            'EXAMPLE_KEY_UP7c3' => { 'EXAMPLE_KEY_uilNP' => 'EXAMPLE--Value' }
          },
          is_unified_auditing_enabled: true
        ),
      database_edition: 'ENTERPRISE_EDITION_HIGH_PERFORMANCE',
      fault_domains: %w[EXAMPLE--Value],
      display_name: 'EXAMPLE-displayName-Value',
      backup_subnet_id:
        'ocid1.test.oc1..<unique_ID>EXAMPLE-backupSubnetId-Value',
      nsg_ids: %w[EXAMPLE--Value],
      backup_network_nsg_ids: %w[EXAMPLE--Value],
      time_zone: 'EXAMPLE-timeZone-Value',
      db_system_options:
        OCI::Database::Models::DbSystemOptions.new(storage_management: 'LVM'),
      storage_volume_performance_mode: 'HIGH_PERFORMANCE',
      sparse_diskgroup: false,
      domain: 'EXAMPLE-domain-Value',
      cluster_name: 'EXAMPLE-clusterName-Value',
      data_storage_percentage: 71,
      initial_data_storage_size_in_gb: 321,
      kms_key_id: 'ocid1.test.oc1..<unique_ID>EXAMPLE-kmsKeyId-Value',
      kms_key_version_id:
        'ocid1.test.oc1..<unique_ID>EXAMPLE-kmsKeyVersionId-Value',
      node_count: 789,
      freeform_tags: {
        'EXAMPLE_KEY_Dyn0d' => 'EXAMPLE_VALUE_DNsVNBMvcfCpsbUJxxez'
      },
      defined_tags: {
        'EXAMPLE_KEY_8TS5B' => { 'EXAMPLE_KEY_qRmDM' => 'EXAMPLE--Value' }
      },
      security_attributes: {
        'EXAMPLE_KEY_XPuhn' => { 'EXAMPLE_KEY_gyfDD' => 'EXAMPLE--Value' }
      },
      private_ip: 'EXAMPLE-privateIp-Value',
      private_ip_v6: 'EXAMPLE-privateIpV6-Value',
      data_collection_options:
        OCI::Database::Models::DataCollectionOptions.new(
          is_diagnostics_events_enabled: true,
          is_health_monitoring_enabled: true,
          is_incident_logs_enabled: true
        ),
      disk_redundancy: 'HIGH',
      license_model: 'BRING_YOUR_OWN_LICENSE',
      maintenance_window_details:
        OCI::Database::Models::MaintenanceWindow.new(
          preference: 'CUSTOM_PREFERENCE',
          patching_mode: 'ROLLING',
          is_custom_action_timeout_enabled: false,
          custom_action_timeout_in_mins: 74,
          is_monthly_patching_enabled: true,
          months: [OCI::Database::Models::Month.new(name: 'JUNE')],
          weeks_of_month: [2],
          days_of_week: [
            OCI::Database::Models::DayOfWeek.new(name: 'THURSDAY')
          ],
          hours_of_day: [7],
          lead_time_in_weeks: 2,
          skip_ru: [True, False]
        )
    )
  )

# Get the data from response
puts "#{launch_db_system_response.data}"

Was this article helpful?