Thursday, 19 July 2018

Creating PDBs from Seed in Container Databases

Creation of PDBs:
Pluggable database is created inside the container database and PDBs has its own directory with datafiles in it, and with 12cr2 onwards it can have its undo datafile. There is no specific controlfile or spfile for the portable database. Creation of Portable / pluggable databases in container databases (CDB) can be done in 3 different ways. i.e
  1. DBCA
  2.  SQL through sql command
  3. SQL Developer
Here in this blog i'll create portable databases through dbca and through sql script.
1- Database Configuration Assistant (DBCA).
    As in normal databases installation and configurations, we invoke dbca and create databases similarly while creating portable database we will use dbca:
$ dbca









Pluggable database name:




Creation of pluggable database is started and it will take less than a minute:



Now database is created with name PDB2_1, let check physically the location where the database folders and files are created:


Eventhough in dbca you can specify the location where you want to create the portable database, but default location can be seen in above images is $ORACLE_BASE/oradata/cdb2/PORTABLE_DB_NAME as shown in above image.

We can view the datafile created in new pluggable database.


After all checking we have to create local net service to connect/login to newly created pluggable database, which can be done through netca:

All images are self explanatory here.







Name of service through which pluggable database can be access:



After creation of service we can check the new pluggable database by loggin in container database, if we query name,open_mode from v$pdbs, it will be noted that newly created pluggable database is in read and write mode, one thing to be noted here, that by default when you start the cdb pluggable database is in mount state, but when you create pluggable database through DBCA, it will create not only database for you but will also open it for you once the creation is completed.



2- SQL through sql command
    Now creating new pluggable database through sql script manually, first we have to create a directory manually as show below:

$ mkdir -p $ORACLE_BASE/oradata/cdb2/pdb2


After creation of directory login to cdb and run create command mentioning the pdb name ,admin user and location where the pdb is to be created as below:

SQL> create pluggable database pdb2 admin user adminuser identified by oracle roles=(CONNECT) create_file_dest='/u01/app/oracle/oradata/cdb2/pdb2';

Above command will take less than a minute and will create the scripted PDB.


Portable database created through sql script will be in mounted state after creation, so we will have to open the database manually.


Open the new created portable database:



Now to connect to PDB2 we net to have local net service name, which can be done through netca and explain/shown above.

Installing Oracle 11g on Linux

Unpack Files Unzip the files. # 11.2.0.1 unzip linux.x64_11gR2_database_1of2.zip unzip linux.x64_11gR2_database_2of2.zip #11.2.0.2 u...