DataBaseGuru

databases


How to Set Up CDB/PDB in Oracle Database

Oracle Database 12c introduced a new architecture called Multitenant, which allows multiple independent databases to be run within a single Oracle Database instance. This architecture is known as Container Database (CDB) and Pluggable Database (PDB).

A CDB is a single Oracle Database instance that can contain multiple PDBs. A PDB is a self-contained database that can be created, dropped, and moved independently of other PDBs in the same CDB.

To set up a CDB/PDB in Oracle Database, you can use the following steps:

  1. Create a CDB. You can create a CDB using the DBCA (Database Configuration Assistant) or by using the CREATE CDB statement.
  2. Create a PDB. Once you have created a CDB, you can create PDBs using the CREATE PLUGGABLE DATABASE statement.
  3. Configure the PDB. Once you have created a PDB, you need to configure it by setting the appropriate initialization parameters and creating the necessary users and roles.
  4. Start the PDB. Once you have configured the PDB, you can start it using the START PLUGGABLE DATABASE statement.

Here are some examples of how to set up CDB/PDB in Oracle Database:

Creating a CDB using DBCA

To create a CDB using DBCA, follow these steps:

  1. Open DBCA.
  2. Select the “Create a Container Database” option.
  3. Enter the name of the CDB.
  4. Select the location of the CDB datafiles.
  5. Select the operating system user that will own the CDB.
  6. Click “Next”.
  7. Select the options for the PDBs that you want to create.
  8. Click “Finish”.

Creating a PDB using the CREATE PLUGGABLE DATABASE statement

To create a PDB using the CREATE PLUGGABLE DATABASE statement, follow these steps:

  1. Connect to the CDB.
  2. Run the following command:
CREATE PLUGGABLE DATABASE my_pdb
AS TEMPLATE=pdb$seed

This will create a PDB named “my_pdb” that is based on the template PDB (pdb$seed).

  1. Configure the PDB.
  2. Start the PDB.

OR , you can use DBCA like below.

To create a PDB, you can use the DBCA. To do this, follow these steps:

  1. Open the DBCA.
  2. Select “Create a Pluggable Database”.
  3. Select the CDB that you want to create the PDB in.
  4. Enter the name of the PDB.
  5. Select the database version.
  6. Select the character set.
  7. Select the time zone.
  8. Select the database files.
  9. Click “Next”.

The DBCA will create the PDB and the necessary database files.

Configure the PDB

After you have created a PDB, you need to configure it. You can do this by running the following SQL statements:

ALTER PLUGGABLE DATABASE pdb_name OPEN;

This will open the PDB for use.

ALTER PLUGGABLE DATABASE pdb_name SET CONTAINER;

This will make the PDB a container for other PDBs.

Start the PDB

To start a PDB, you can use the following steps:

  1. Connect to the CDB as the SYS user.
  2. Run the following SQL statement:
START PLUGGABLE DATABASE pdb_name;

Once you have completed these steps, you will have successfully setup a CDB/PDB in Oracle Database.

Benefits of Using CDB/PDB

There are a number of benefits to using CDB/PDB, including:

  • Improved resource utilization: Multiple databases can share the same physical resources, such as CPU, memory, and storage. This can lead to significant cost savings, especially for organizations that have a large number of databases.
  • Simplified management: CDB/PDB makes it easier to manage multiple databases. For example, backups, updates, and patching can be performed for all databases in a single operation.
  • Increased security: CDB/PDB isolates each database from the others, which helps to protect data from unauthorized access.

Conclusion

CDB/PDB is a powerful tool that can help organizations to improve the performance, scalability, security, and manageability of their Oracle Databases. If you are considering using CDB/PDB, I encourage you to contact Oracle to learn more about the benefits and features of this technology.



Leave a comment

Design a site like this with WordPress.com
Get started