Thursday, September 24, 2020


Clone Pluggable database

==========================

SQL> select name,open_mode from v$pdbs;

NAME        OPEN_MODE

------------------------------ ----------

PDB$SEED        READ ONLY

MIGPDB         READ WRITE


SQL> alter session set container=MIGPDB;

Session altered.


SQL> select file_name from dba_data_files;

SQL> select file_name from dba_data_files;

FILE_NAME

--------------------------------------------------------------------------------

/u02/oradata/MIGCDB/AFF38B6D8283019AE053AC10028C9AE1/datafile/o1_mf_system_hpojb1ry_.dbf

/u02/oradata/MIGCDB/AFF38B6D8283019AE053AC10028C9AE1/datafile/o1_mf_sysaux_hpojb1s2_.dbf

/u02/oradata/MIGCDB/AFF38B6D8283019AE053AC10028C9AE1/datafile/o1_mf_undotbs1_hpojb1s2_.dbf  etc...


SQL> show con_name

CON_NAME

------------------------------

MIGPDB


SQL> shutdown immediate;

Pluggable Database closed.

 

SQL> startup open read only

Pluggable Database opened.

 

# mkdir /u02/oradata/MIGCDB/demopdb


SQL > alter session set container=cdb$root;


SQL > show con_name


CON_NAME

------------------------------

CDB$ROOT


SQL> alter system set db_create_file_dest='/u02/oradata/MIGCDB/demopdb';


SQL> create pluggable database DEMOPDB from MIGPDB FILE_NAME_CONVERT=('/u02/oradata/MIGCDB/AFF38B6D8283019AE053AC10028C9AE1/datafile/','/u02/oradata/MIGCDB/demopdb');

 

SQL> select name,open_mode from v$pdbs;

 

NAME        OPEN_MODE

------------------------------ ----------

PDB$SEED          READ ONLY

MIGPDB              READ ONLY

DEMOPDB          MOUNTED

 

SQL> alter session set CONTAINER=MIGPDB;

 

Session altered.

 

SQL> shutdown immediate;

Pluggable Database closed.

SQL> startup

Pluggable Database opened.

SQL> show con_name

---------------------------------------------

SQL> alter session set container=DEMOPDB;

 

Session altered.

 

SQL> startup

Pluggable Database opened.


  SQL> alter session set container=cdb$root;

Connected.

SQL> select name,open_mode from v$pdbs;

 

NAME        OPEN_MODE

------------------------------ ----------

PDB$SEED        READ ONLY

MIGPDB             READ WRITE

DEMOPDB         READ WRITE

No comments:

Post a Comment

  RMAN-20207: UNTIL TIME or RECOVERY WINDOW is before RESETLOGS time https://shivanandarao-oracle.com/2012/12/05/rman-20207-until-time-or-re...