Search This Blog

Total Pageviews

Monday, 19 September 2022

Oracle >18c Rman Duplication of a PDB To another CDB

Oracle >18c Rman Duplication of a PDB To another CDB ..



Oracle >18c Rman Duplication of a PDB To another CDB

PDB Duplication



source = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.211)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (sid = orclcdb) ) )
dest = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.209)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (sid = orclcdb) ) )




#rman target sys/oracle@source auxiliary sys/oracle@dest


tnsping dest

TNS Ping Utility for Linux: Version 19.0.0.0.0 - Production on 19-SEP-2022 03:50:51

Copyright (c) 1997, 2019, Oracle.  All rights reserved.

Used parameter files:
/u01/app/oracle/product/version/db_1/network/admin/sqlnet.ora


Used TNSNAMES adapter to resolve the alias
Attempting to contact (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.209)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (sid = orclcdb)))
OK (10 msec)



[oracle@Vihaan admin]$ tnsping source

TNS Ping Utility for Linux: Version 19.0.0.0.0 - Production on 19-SEP-2022 03:50:59

Copyright (c) 1997, 2019, Oracle.  All rights reserved.

Used parameter files:
/u01/app/oracle/product/version/db_1/network/admin/sqlnet.ora


Used TNSNAMES adapter to resolve the alias
Attempting to contact (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.211)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (sid = orclcdb)))
OK (340 msec)


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


check below 
sqlplus 'sys/oracle@source as sysdba'
sqlplus 'sys/oracle@dest as sysdba'


on 192.168.1.211

SQL> show pdbs

    CON_ID CON_NAME                       OPEN MODE  RESTRICTED
---------- ------------------------------ ---------- ----------
         2 PDB$SEED                       READ ONLY  NO
         3 ORCL                           READ WRITE NO
         4 ORCL1                          READ WRITE NO  >>>>> create duplicate to ORCLD on 192.168.1.209




on 192.168.1.209 i.e dest

alter system set remote_recovery_file_dest='/u01/app/oracle/Remote_Recovery' scope=both;


Create directory for new PDB:

 mkdir -p /u01/app/oracle/oradata/ORCLCDB/orcld




rman

Recovery Manager: Release 19.0.0.0.0 - Production on Mon Sep 19 04:01:27 2022
Version 19.3.0.0.0

Copyright (c) 1982, 2019, Oracle and/or its affiliates.  All rights reserved.

RMAN> connect target sys/oracle@source

connected to target database: ORCLCDB (DBID=2780785463)

RMAN> connect auxiliary sys/oracle@dest

connected to auxiliary database: ORCLCDB (DBID=2780785463)

RMAN>



RMAN> connect target sys/oracle@source
RMAN> connect auxiliary sys/oracle@dest



DUPLICATE PLUGGABLE DATABASE ORCL1 as ORCLD TO orclcdb DB_FILE_NAME_CONVERT('orcl1','orcld') FROM ACTIVE DATABASE SECTION SIZE 10M;




                                              [Instance i.e dest] 
DUPLICATE PLUGGABLE DATABASE ORCL1 as ORCLD TO orclcdb    DB_FILE_NAME_CONVERT('orcl1','orcld') FROM ACTIVE DATABASE SECTION SIZE 10M;

RMAN>
RMAN>

Starting Duplicate PDB at 19-SEP-22
using target database control file instead of recovery catalog
allocated channel: ORA_AUX_DISK_1
channel ORA_AUX_DISK_1: SID=22 device type=DISK
current log archived
duplicating Online logs to Oracle Managed File (OMF) location

contents of Memory Script:
{
   set newname for datafile  16 to
 "/u01/app/oracle/oradata/ORCLCDB/orcld/system01.dbf";
   set newname for datafile  17 to
 "/u01/app/oracle/oradata/ORCLCDB/orcld/sysaux01.dbf";
   set newname for datafile  18 to
 "/u01/app/oracle/oradata/ORCLCDB/orcld/undotbs01.dbf";
   set newname for datafile  19 to
 "/u01/app/oracle/oradata/ORCLCDB/orcld/orcld.dbf";
   restore
   from  nonsparse   section size
 10 m   clone foreign pluggable database
    "ORCL1"
   from service  'source'   ;
}
executing Memory Script

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

Starting restore at 19-SEP-22
using channel ORA_AUX_DISK_1

channel ORA_AUX_DISK_1: starting datafile backup set restore
channel ORA_AUX_DISK_1: using network backup set from service source
channel ORA_AUX_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_AUX_DISK_1: restoring section 1 of 27
channel ORA_AUX_DISK_1: restoring foreign file 16 to /u01/app/oracle/oradata/ORCLCDB/orcld/system01.dbf
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:07
channel ORA_AUX_DISK_1: starting datafile backup set restore
channel ORA_AUX_DISK_1: using network backup set from service source
channel ORA_AUX_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_AUX_DISK_1: restoring section 2 of 27
channel ORA_AUX_DISK_1: restoring foreign file 16 to /u01/app/oracle/oradata/ORCLCDB/orcld/system01.dbf
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:03
channel ORA_AUX_DISK_1: starting datafile backup set restore
channel ORA_AUX_DISK_1: using network backup set from service source
channel ORA_AUX_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_AUX_DISK_1: restoring section 3 of 27
channel ORA_AUX_DISK_1: restoring foreign file 16 to /u01/app/oracle/oradata/ORCLCDB/orcld/system01.dbf
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:08
channel ORA_AUX_DISK_1: starting datafile backup set restore
channel ORA_AUX_DISK_1: using network backup set from service source
channel ORA_AUX_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_AUX_DISK_1: restoring section 4 of 27
channel ORA_AUX_DISK_1: restoring foreign file 16 to /u01/app/oracle/oradata/ORCLCDB/orcld/system01.dbf
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:07
channel ORA_AUX_DISK_1: starting datafile backup set restore
channel ORA_AUX_DISK_1: using network backup set from service source
channel ORA_AUX_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_AUX_DISK_1: restoring section 5 of 27
.
.
.
.

channel ORA_AUX_DISK_1: restoring section 21 of 25
channel ORA_AUX_DISK_1: restoring foreign file 19 to /u01/app/oracle/oradata/ORCLCDB/orcld/orcld.dbf
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:02
channel ORA_AUX_DISK_1: starting datafile backup set restore
channel ORA_AUX_DISK_1: using network backup set from service source
channel ORA_AUX_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_AUX_DISK_1: restoring section 22 of 25
channel ORA_AUX_DISK_1: restoring foreign file 19 to /u01/app/oracle/oradata/ORCLCDB/orcld/orcld.dbf
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:01
channel ORA_AUX_DISK_1: starting datafile backup set restore
channel ORA_AUX_DISK_1: using network backup set from service source
channel ORA_AUX_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_AUX_DISK_1: restoring section 23 of 25
channel ORA_AUX_DISK_1: restoring foreign file 19 to /u01/app/oracle/oradata/ORCLCDB/orcld/orcld.dbf
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:01
channel ORA_AUX_DISK_1: starting datafile backup set restore
channel ORA_AUX_DISK_1: using network backup set from service source
channel ORA_AUX_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_AUX_DISK_1: restoring section 24 of 25
channel ORA_AUX_DISK_1: restoring foreign file 19 to /u01/app/oracle/oradata/ORCLCDB/orcld/orcld.dbf
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:01
channel ORA_AUX_DISK_1: starting datafile backup set restore
channel ORA_AUX_DISK_1: using network backup set from service source
channel ORA_AUX_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_AUX_DISK_1: restoring section 25 of 25
channel ORA_AUX_DISK_1: restoring foreign file 19 to /u01/app/oracle/oradata/ORCLCDB/orcld/orcld.dbf
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:02
Finished restore at 19-SEP-22
current log archived

contents of Memory Script:
{
   set archivelog destination to  '/u01/app/oracle/Remote_Recovery';
   restore clone force from service  'source'
           foreign archivelog from scn  3145371;
}
executing Memory Script

executing command: SET ARCHIVELOG DESTINATION

Starting restore at 19-SEP-22
using channel ORA_AUX_DISK_1

channel ORA_AUX_DISK_1: starting archived log restore to user-specified destination
archived log destination=/u01/app/oracle/Remote_Recovery
channel ORA_AUX_DISK_1: using network backup set from service source
channel ORA_AUX_DISK_1: restoring archived log
archived log thread=1 sequence=26
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:02
channel ORA_AUX_DISK_1: starting archived log restore to user-specified destination
archived log destination=/u01/app/oracle/Remote_Recovery
channel ORA_AUX_DISK_1: using network backup set from service source
channel ORA_AUX_DISK_1: restoring archived log
archived log thread=1 sequence=27
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:04
Finished restore at 19-SEP-22

Performing import of metadata...
Finished Duplicate PDB at 19-SEP-22


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


SQL> show pdbs

    CON_ID CON_NAME                       OPEN MODE  RESTRICTED
---------- ------------------------------ ---------- ----------
         2 PDB$SEED                       READ ONLY  NO
         3 ORCL                           READ WRITE NO
         4 ORCLD                          READ WRITE NO


set linesize 300
col NAME for a70
select con_id,name from v$datafile where con_id=4;

  CON_ID NAME
---------- ----------------------------------------------------------------------
         4 /u01/app/oracle/oradata/ORCLCDB/orcld/system01.dbf
         4 /u01/app/oracle/oradata/ORCLCDB/orcld/sysaux01.dbf
         4 /u01/app/oracle/oradata/ORCLCDB/orcld/undotbs01.dbf
         4 /u01/app/oracle/oradata/ORCLCDB/orcld/orcld.dbf





set linesize 300
COLUMN time FORMAT A30
COLUMN name FORMAT A30
COLUMN cause FORMAT A30
COLUMN message FORMAT A30
col ACTION for a70
select name, cause, type, status,action,message,time from pdb_plug_in_violations;


NAME                           CAUSE                          TYPE      STATUS    ACTION                                                                 MESSAGE                        TIME
------------------------------ ------------------------------ --------- --------- ---------------------------------------------------------------------- ------------------------------ ------------------------------
PDB$SEED                       SQL Patch                      ERROR     RESOLVED  Call datapatch to install in the PDB or the CDB                        '19.3.0.0.0 Release_Update 190 31-MAY-19 03.17.50.323190 PM
                                                                                                                                                         4101227' is installed in the C
                                                                                                                                                         DB but no release updates are
                                                                                                                                                         installed in the PDB

No comments:

Oracle DBA

anuj blog Archive