different ways to create the pdb in oracle 12c

#different ways to create the pdb in oracle 12c

1)      You can create it by using dbca gui tool
Database Configuration Assistant (DBCA)
Below is the link for create on oracle-base

2)Now another method is by creating manually
Now for that you firstly have to log in into CDB$ROOT
By using

SQL> ALTER SESSION SET CONTAINER = CDB$ROOT;
Now you have to create it manually by using command
CREATE PLUGGABLE DATABASE PDB9
ADMIN USER PDB002_ADMIN IDENTIFIED BY oracle
storage (maxsize 5G MAX_SHARED_TEMP_SIZE 500M)
DEFAULT TABLESPACE sales
datafile '/opt/app/oracle/sale.dbf' SIZE 250M AUTOEXTEND ON
FILE_NAME_CONVERT = ('/opt/app/oracle/oradata/anand_poc/','/opt/app/oracle/new')


FILE_NAME_CONVERT for new location of datafiles which it only create system and sysaux tablespace into the new locations that is from above command is ( /opt/app/oracle/new).

Now its is also not mandatory to create new tablespace every time

CREATE PLUGGABLE DATABASE PDB9
ADMIN USER PDB002_ADMIN IDENTIFIED BY oracle
FILE_NAME_CONVERT = ('/opt/app/oracle/oradata/anand_poc/','/opt/app/oracle/new')


This above command also work as the new location is of new CDB$ROOT datafile locations.

3) Execute unplug command to detach PDB from auxiliary CDB

SQL>  alter pluggable database testpdb unplug into '/tmp/testpdb.xml';
Pluggable database altered.

Plug PDB into Target database

·     Check existing PDBs

SQL> show pdbs

    CON_ID        CON_NAME                              OPEN MODE     RESTRICTED
----------          ------------------------------      ----------          ----------
         2             PDB$SEED                               READ ONLY       NO

Execute create pluggable database using XML file created through unplug command. Use copy command to move pdb data files to new location

SQL>  create pluggable database testpdb using '/tmp/testpdb.xml'
COPY   2  ;
Pluggable database created.

SQL> show pdbs

    CON_ID        CON_NAME                              OPEN MODE     RESTRICTED
----------          ------------------------------      ----------          ----------
         2             PDB$SEED                               READ ONLY       NO
         3             TESTPDB                                  MOUNTED


4)Metadata Clone
Perform a metadata-only clone of the PDB using the NO DATA clause.
CONN / AS SYSDBA

ALTER PLUGGABLE DATABASE pdb10 CLOSE;
ALTER PLUGGABLE DATABASE pdb10 OPEN READ ONLY;

CREATE PLUGGABLE DATABASE pdb11 FROM pdb10
  FILE_NAME_CONVERT=('/u01/app/oracle/oradata/cdb1/pdb10/','/u01/app/oracle/oradata/cdb1/pdb11/')
  NO DATA;

ALTER PLUGGABLE DATABASE pdb11 OPEN READ WRITE;

-- Switch the source PDB back to read/write
ALTER PLUGGABLE DATABASE pdb10 CLOSE;
ALTER PLUGGABLE DATABASE pdb10 OPEN READ WRITE;



dont forget to comment and share

thanks cheers !!

Comments

Post a Comment

Popular posts from this blog

Query for Tablespace usage with Autoextend

How to configure multiple Oracle listeners

sheel script - automatic tablespace addition in oracle 11g