Configuring an RDS for Oracle CDB - Amazon Relational Database Service

Configuring an RDS for Oracle CDB

Configuring a CDB is similar to configuring a non-CDB.

Creating an RDS for Oracle CDB instance

In RDS for Oracle, creating a CDB is almost identical to creating a non-CDB. The difference is that you choose the Oracle multitenant architecture when creating your DB instance and also choose an architecture configuration: multi-tenant or single-tenant. If you create tags when you create a CDB in the multi-tenant configuration, RDS propagates the tags to the initial tenant database. To create a CDB, use the AWS Management Console, the AWS CLI, or the RDS API.

To create a CDB instance
  1. Sign in to the AWS Management Console and open the Amazon RDS console at https://console.aws.amazon.com/rds/.

  2. In the upper-right corner of the Amazon RDS console, choose the AWS Region in which you want to create the CDB instance.

  3. In the navigation pane, choose Databases.

  4. Choose Create database.

  5. In Choose a database creation method, select Standard Create.

  6. In Engine options, choose Oracle.

  7. For Database management type, choose Amazon RDS.

  8. For Architecture settings, choose Oracle multitenant architecture.

  9. For Architecture configuration, do either of the following:

    • Choose Multi-tenant configuration and proceed to the next step.

    • Choose Single-tenant configuration and skip to Step 11.

  10. (Multi-tenant configuration) For Tenant database settings, make the following changes:

    • For Tenant database name, enter the name of your initial PDB. The PDB name must be different from the CDB name, which defaults to RDSCDB.

    • For Tenant database master username, enter the master username of your PDB. You can't use the tenant database master username to log in to the CDB itself.

    • Either enter a password in Tenant database master password or choose Auto generate a password.

    • For Tenant database character set, choose a character set for the PDB. You can choose a tenant database character set that is different from the CDB character set.

      The default PDB character set is AL32UTF8. If you choose a nondefault PDB character set, CDB creation might be slower.

    Note

    You can't create multiple tenant databases as part of the CDB creation process. You can only add PDBs to an already existing CDB.

  11. (Single-tenant configuration) Choose the settings that you want based on the options listed in Settings for DB instances. Note the following:

    • For Master username, enter the name for a local user in your PDB. You can't use the master username to log in to the CDB root.

    • For Initial database name, enter the name of your PDB. You can't name the CDB, which has the default name RDSCDB.

  12. Choose Create database.

To create a CDB in the multi-tenant configuration, use the create-db-instance command with the following parameters:

  • --db-instance-identifier

  • --db-instance-class

  • --engine { oracle-ee-cdb | oracle-se2-cdb }

  • --master-username

  • --master-user-password

  • --multi-tenant (for the single-tenant configuration, either don't specify multi-tenant or specify --no-multi-tenant)

  • --allocated-storage

  • --backup-retention-period

For information about each setting, see Settings for DB instances.

This following example creates an RDS for Oracle DB instance named my-cdb-inst in the multi-tenant configuration. If you specify --no-multi-tenant or don't specify --multi-tenant, the default CDB configuration is single-tenant. The engine is oracle-ee-cdb: a command that specifies oracle-ee and --multi-tenant fails with an error. The initial tenant database is named mypdb.

Example

For Linux, macOS, or Unix:

aws rds create-db-instance \ --engine oracle-ee-cdb \ --db-instance-identifier my-cdb-inst \ --multi-tenant \ --db-name mypdb \ --allocated-storage 250 \ --db-instance-class db.t3.large \ --master-username pdb_admin \ --master-user-password pdb_admin_password \ --backup-retention-period 3

For Windows:

aws rds create-db-instance ^ --engine oracle-ee-cdb ^ --db-instance-identifier my-cdb-inst ^ --multi-tenant ^ --db-name mypdb ^ --allocated-storage 250 ^ --db-instance-class db.t3.large ^ --master-username pdb_admin ^ --master-user-password pdb_admin_password ^ --backup-retention-period 3
Note

Specify a password other than the prompt shown here as a security best practice.

This command produces output similar to the following. The database name, character set, national character set, and master user aren't included in the output. You can view this information by using the CLI command describe-tenant-databases.

{ "DBInstance": { "DBInstanceIdentifier": "my-cdb-inst", "DBInstanceClass": "db.t3.large", "MultiTenant": true, "Engine": "oracle-ee-cdb", "DBResourceId": "db-ABCDEFGJIJKLMNOPQRSTUVWXYZ", "DBInstanceStatus": "creating", "AllocatedStorage": 250, "PreferredBackupWindow": "04:59-05:29", "BackupRetentionPeriod": 3, "DBSecurityGroups": [], "VpcSecurityGroups": [ { "VpcSecurityGroupId": "sg-0a1bcd2e", "Status": "active" } ], "DBParameterGroups": [ { "DBParameterGroupName": "default.oracle-ee-cdb-19", "ParameterApplyStatus": "in-sync" } ], "DBSubnetGroup": { "DBSubnetGroupName": "default", "DBSubnetGroupDescription": "default", "VpcId": "vpc-1234567a", "SubnetGroupStatus": "Complete", ...

To create a DB instance by using the Amazon RDS API, call the CreateDBInstance operation.

For information about each setting, see Settings for DB instances.

Connecting to a PDB in your RDS for Oracle CDB

You can use a utility like SQL*Plus to connect to a PDB. To download Oracle Instant Client, which includes a standalone version of SQL*Plus, see Oracle Instant Client Downloads.

To connect SQL*Plus to your PDB, you need the following information:

  • PDB name

  • Database user name and password

  • Endpoint for your DB instance

  • Port number

For information about finding the preceding information, see Finding the endpoint of your RDS for Oracle DB instance.

Example To connect to your PDB using SQL*Plus

In the following examples, substitute your master user for master_user_name. Also, substitute the endpoint for your DB instance, and then include the port number and the Oracle SID. The SID value is the name of the PDB that you specified when you created your DB instance, and not the DB instance identifier.

For Linux, macOS, or Unix:

sqlplus 'master_user_name@(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=endpoint)(PORT=port))(CONNECT_DATA=(SID=pdb_name)))'

For Windows:

sqlplus master_user_name@(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=endpoint)(PORT=port))(CONNECT_DATA=(SID=pdb_name)))

You should see output similar to the following.

SQL*Plus: Release 19.0.0.0.0 Production on Mon Aug 21 09:42:20 2021

After you enter the password for the user, the SQL prompt appears.

SQL>
Note

The shorter format connection string (Easy connect or EZCONNECT), such as sqlplus username/password@LONGER-THAN-63-CHARS-RDS-ENDPOINT-HERE:1521/database-identifier, might encounter a maximum character limit and should not be used to connect.