Oracle has introduced new Multitenant Option from Oracle 12cR1 and this option allows a single container database (CDB) to host multiple pluggable databases.
Related articles:
Create Container Database (CDB) in Oracle 12c using DBCA
Create Container database (CDB) in silent mode
Drop a container database in silent mode
In this post I will describe how to create a pluggable database (PDB) from seed. We will cover the following steps:
- Create a directory to store new PDB datafiles
- Create PDB database using SQL*PLUS
- Check the newly created PDB status
- Open the PDB database
1. Create a directory to store new PDB Datafiles
mkdir /u01/app/oracle/oradata/cdb2/pdb2
2. Create PDB database using SQL*PLUS
CREATE PLUGGABLE DATABASE pdb2
ADMIN USER admin_user IDENTIFIED BY Oracle_#123
CREATE_FILE_DEST='/u01/app/oracle/oradata/cdb2/pdb2';
Output:
SQL> CREATE PLUGGABLE DATABASE pdb2
2 ADMIN USER admin_user IDENTIFIED BY Oracle_#123
3 CREATE_FILE_DEST='/u01/app/oracle/oradata/cdb2/pdb2';
Pluggable database created.
SQL>
3. Check the newly created pdb status
Status of the PDBs can be checked using v$pdbs view,
select name, open_mode from v$pdbs;
show pdbs;
SQL> select name, open_mode from v$pdbs;
NAME OPEN_MODE
--------------- ----------
PDB$SEED READ ONLY
PDB1 READ WRITE
PDB2 MOUNTED
SQL> show pdbs;
CON_ID CON_NAME OPEN MODE RESTRICTED
---------- ------------------------------ ---------- ----------
2 PDB$SEED READ ONLY NO
3 PDB1 READ WRITE NO
4 PDB2 MOUNTED
SQL>
4. Open the PDB database in read-write mode
alter pluggable database pdb2 open;
select name, open_mode from v$pdbs;
Output:
SQL> alter pluggable database pdb2 open;
Pluggable database altered.
SQL> select name, open_mode from v$pdbs;
NAME OPEN_MODE
--------------- ----------
PDB$SEED READ ONLY
PDB1 READ WRITE
PDB2 READ WRITE
We have created a new PDB pdb2 from seed database and opened it in read-write mode.
Hope this helps…