Thursday, 4 July 2019

ORACLE NEW PLUGGABLE DATABASE CREATION


I> Login to DB server and sudo to oracle.

                   
SQL> ssh pestlinux3
          SQL> sudo su – oracle

I> Go to container datadir path and create pluggable DB directory.

                    SQL> cd /databases/oradata/ORA121
          SQL> mkdir Tertio8Demo

I> Login to DB as sysdba user and make sure it’s a container Database.

                    SQL>  sqlplus / as sysdba
             SQL> show con_name;


I> Execute following command to create a pluggable database Tertio8Demo.

CREATE PLUGGABLE DATABASE Tertio8Demo ADMIN USER tertio8db identified by "tertio8db"
DEFAULT TABLESPACE USERS
DATAFILE '/databases/oradata/ORA121/Tertio8Demo/Tertio8Demo_01.dbf'
SIZE 250M AUTOEXTEND ON;

I> Execute following command to check pluggable database has been created.

                 SQL> select con_id,name,open_mode from v$Pdbs;

I> Alter pluggable database to open mode.

                 SQL> alter pluggable database Tertio8Demo open;

I> Check the status.

                 SQL> select con_id,name,open_mode from v$pdbs;

I> Change the container DB to pluggable Database.

                 SQL> alter session set container=Tertio8Demo;
         SQL> show con_name;


I> Add tns entry in tnsnames.ora file.

Tertio8Demo =
  (DESCRIPTION =
    (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = TCP)(HOST = pestlinux3)(PORT = 1521))
    )
    (CONNECT_DATA =
      (SERVICE_NAME = Tertio8Demo)
    )
  )