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:
- Create a CDB. You can create a CDB using the DBCA (Database Configuration Assistant) or by using the CREATE CDB statement.
- Create a PDB. Once you have created a CDB, you can create PDBs using the CREATE PLUGGABLE DATABASE statement.
- 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.
- 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:
- Open DBCA.
- Select the “Create a Container Database” option.
- Enter the name of the CDB.
- Select the location of the CDB datafiles.
- Select the operating system user that will own the CDB.
- Click “Next”.
- Select the options for the PDBs that you want to create.
- Click “Finish”.
Creating a PDB using the CREATE PLUGGABLE DATABASE statement
To create a PDB using the CREATE PLUGGABLE DATABASE statement, follow these steps:
- Connect to the CDB.
- 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).
- Configure the PDB.
- 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:
- Open the DBCA.
- Select “Create a Pluggable Database”.
- Select the CDB that you want to create the PDB in.
- Enter the name of the PDB.
- Select the database version.
- Select the character set.
- Select the time zone.
- Select the database files.
- 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:
- Connect to the CDB as the SYS user.
- 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