Hot Cloning of a Remote PDB in 12c

 The remote CDB is in local undo mode and archivelog mode, we don’t need to turn the remote database into read-only mode
CDB1 – The remote container database which used for cloing a particular PDB named PSDBT.
CDB2 – The container database where we going to clone a PDB.
Step 1. Connect to the CDB.
    cdb1> select name, log_mode, cdb from v$database;
    NAME      LOG_MODE               CDB
    ———           ————                  —
    CBD1      ARCHIVELOG              YES

Step 2. check Local Undo Mode of Remote CDB.
    cdb1> select property_name, property_value
      2  from database_properties
      3  where property_name=’LOCAL_UNDO_ENABLED’;
    ———————                      —————–

Step 3. Connect to the another CDB.
    cdb2> select name, log_mode, cdb from v$database;
    NAME          LOG_MODE                CDB
    ——–             ————                      —
    CDB2      NOARCHIVELOG             YES

Step 4. Check Local Undo Mode of source CDB.
    cdb2> select property_name, property_value
      2  from database_properties
      3  where property_name=’LOCAL_UNDO_ENABLED’;
    ———————                          —————–

Step 5. Check tnsping between network.
    chech net configuration between source and remote server.
     tnsping cdb1 2
     tnsping cdb2 2
     [oracle@ramkumar ~]$ tnsping psdbt 2
    TNS Ping Utility for Linux: Version – Production on 25-JUN-2018 09:56:14
    Copyright (c) 1997, 2016, Oracle.  All rights reserved.
    Used parameter files:

    Used TNSNAMES adapter to resolve the alias
    Attempting to contact (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST =   
acs.localdomain)(PORT = 1521))) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME =   
    OK (0 msec)
    OK (0 msec)

Step 6. Create database link in source CDB.
        Create database link name as cdb_ln using
    a user and password of existing user in target CDB.
    cdb2>create database link cdb_ln
      2  connect to c##ram
      3  identified by oracle
      4  using ‘psdbt’;
    Database link created.
Step 7. Check the link
    cdb2> column DB_LINK format a10
    cdb2> column username format a10
    cdb2> column host format a10
    cdb2> select db_link,username,host from dba_db_links;
    ———- ———- ———-
    SYS_HUB               CDB2
    CDB_LN     C##RAM    psdbt

Step 8. Check the PDB datafile path using link.
    cdb2>select name from v$datafile@cdb_ln;
Step 9. Create a directory in responsible place in OS.
    [oracle@ramkumar ~]$ mkdir /u02/app/oracle/oradata/pdbnew
    [oracle@ramkumar ~]$ exit
Step 10. Clone the Remote PDB using database link.
    cdb2>create pluggable database pdbnew
      2  from psdbt@cdb_ln
      3  file_name_convert=  
    Pluggable database created.
Step 11. Check the Pluggable database mode
    cdb2>show pdbs
        CON_ID         CON_NAME                      OPEN MODE          RESTRICTED
    ———-         ——————————                ———-                     ———-
             2            PDB$SEED                       READ ONLY                    NO
             3            LONEPDB                         MOUNTED
             4            LTWOPDB                         MOUNTED
             5            PDBNEW                          MOUNTED
Step 12. Open the Cloned PDB in read only mode
    cdb2>alter pluggable database pdbnew open read only;
    Pluggable database altered.
    cdb2>show pdbs
        CON_ID       CON_NAME                       OPEN MODE                RESTRICTED
    —————    ————————                   ———-                              ———-
             2          PDB$SEED                              READ ONLY                         NO
             3          LONEPDB                                MOUNTED
             4          LTWOPDB                                MOUNTED
             5          PDBNEW                                  READ ONLY                        YES
Step 13. Change the session to Newly cloned PDB.

    cdb2>alter session set container=pdbnew;
    Session altered.

Step 14. Check the Consistency of cloned records.
    cdb2>show con_name;

    cdb2>select count(*) from dba_tables;
Step 15. Connect session to CDB. 
    cdb2>alter session set container=cdb$root;
    Session altered.
Step 16. Check the consistency of records by dblinks.
    cdb2>select count(*) from dba_tables@cdb_ln;



Step 17. Close the read only mode and open it normaly.    
    cdb2>alter pluggable database pdbnew close immediate;
    Pluggable database altered.
  • June 25, 2018 | 17 views
  • Comments