How to create a PDB in Oracle (pluggable database)

To create a Pluggable Database (PDB) in Oracle, you will need to first create a Container Database (CDB). A CDB is a special type of Oracle database that can host one or more PDBs within it. Here's a simplified example of the steps involved in setting up a PDB:

1. Create a new Container Database (CDB) using the CREATE DATABASE command. For example:

CREATE DATABASE cdb1
 ADMIN USER admin IDENTIFIED BY password
 DEFAULT TABLESPACE users
 DATAFILE '/u01/app/oracle/oradata/cdb1/system01.dbf' SIZE 50M REUSE
 SYSAUX DATAFILE '/u01/app/oracle/oradata/cdb1/sysaux01.dbf' SIZE 50M REUSE
 DEFAULT TEMPORARY TABLESPACE temp UNDO TABLESPACE undotbs1
 LOGFILE GROUP 1 '/u01/app/oracle/oradata/cdb1/redo01.log' SIZE 50M, '/u01/app/oracle/oradata/cdb1/redo02.log' SIZE 50M, '/u01/app/oracle/oradata/cdb1/redo03.log' SIZE 50M;

2. Once the CDB has been created, you can create a new PDB within it using the CREATE PLUGGABLE DATABASE command. For example:

CREATE PLUGGABLE DATABASE pdb1
 ADMIN USER admin IDENTIFIED BY password
 DEFAULT TABLESPACE users DATAFILE '/u01/app/oracle/oradata/pdb1/system01.dbf' SIZE 50M REUSE
 SYSAUX DATAFILE '/u01/app/oracle/oradata/pdb1/sysaux01.dbf' SIZE 50M REUSE
 DEFAULT TEMPORARY TABLESPACE temp UNDO TABLESPACE undotbs1 LOGFILE GROUP 1 '/u01/app/oracle/oradata/pdb1/redo01.log' SIZE 50M, '/u01/app/oracle/oradata/pdb1/redo02.log' SIZE 50M, '/u01/app/oracle/oradata/pdb1/redo03.log' SIZE 50M;

3. Once the PDB has been created, you can connect to it using the CONNECT command.For example:

CONNECT admin@pdb1

That's a simplified example of how to set up a PDB in Oracle. Keep in mind that there are many additional options and parameters that you can use when creating a CDB or PDB, and you may need to adjust these commands to fit your specific needs.

Comments

Popular posts from this blog

Auditing user logon and logoff in Oracle

RMAN Restore vs. Recovery - what's the difference?

Use rsync on Unix to backup your archive logs