Disclaimer

Tuesday, 26 November 2024

DUPLICATE TARGET DATABASE TO TESTDB FROM ACTIVE DATABASE;

 

DUPLICATE TARGET DATABASE TO TESTDB FROM ACTIVE DATABASE;


[oracle@ibm ~]$ rman target / auxiliary sys/welcome@testdb

[oracle@ibm ~]$ rman target / auxiliary sys/welcome@testdb

Recovery Manager: Release 12.2.0.1.0 - Production on Thu Sep 20 00:56:10 2024

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

connected to target database: CATDB (DBID=2255031832)
connected to auxiliary database: TESTDB (not mounted)

RMAN>

RMAN>

RMAN>

RMAN>

RMAN> DUPLICATE TARGET DATABASE TO TESTDB FROM ACTIVE DATABASE;

Starting Duplicate Db at 24-OCT-15
using target database control file instead of recovery catalog
allocated channel: ORA_AUX_DISK_1
channel ORA_AUX_DISK_1: SID=20 device type=DISK

contents of Memory Script:
{
   sql clone "create spfile from memory";
}
executing Memory Script

sql statement: create spfile from memory

contents of Memory Script:
{
   shutdown clone immediate;
   startup clone nomount;
}
executing Memory Script

Oracle instance shut down

connected to auxiliary database (not started)
Oracle instance started

Total System Global Area     523108352 bytes

Fixed Size                     1337632 bytes
Variable Size                343934688 bytes
Database Buffers             171966464 bytes
Redo Buffers                   5869568 bytes

contents of Memory Script:
{
   sql clone "alter system set  db_name =
 ''CATDB'' comment=
 ''Modified by RMAN duplicate'' scope=spfile";
   sql clone "alter system set  db_unique_name =
 ''TESTDB'' comment=
 ''Modified by RMAN duplicate'' scope=spfile";
   shutdown clone immediate;
   startup clone force nomount
   backup as copy current controlfile auxiliary format  '/prod/testdb/control1.ctl';
   alter clone database mount;
}
executing Memory Script

sql statement: alter system set  db_name =  ''CATDB'' comment= ''Modified by RMAN duplicate'' scope=spfile

sql statement: alter system set  db_unique_name =  ''TESTDB'' comment= ''Modified by RMAN duplicate'' scope=spfile

Oracle instance shut down

Oracle instance started

Total System Global Area     523108352 bytes

Fixed Size                     1337632 bytes
Variable Size                343934688 bytes
Database Buffers             171966464 bytes
Redo Buffers                   5869568 bytes

Starting backup at 24-OCT-15
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=35 device type=DISK
channel ORA_DISK_1: starting datafile copy
copying current control file
output file name=/backup/rman_bkp_catdb/snapcf_catdb.f tag=TAG20151024T230203 RECID=3 STAMP=893977329
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:08
Finished backup at 24-OCT-15

database mounted

contents of Memory Script:
{
   set newname for datafile  1 to
 "/prod/testdb/system.dbf";
   set newname for datafile  2 to
 "/prod/testdb/sysaux.dbf";
   set newname for datafile  3 to
 "/prod/testdb/undotbs.dbf";
   set newname for datafile  4 to
 "/prod/testdb/userdata.dbf";
   set newname for datafile  5 to
 "/prod/testdb/test_ts_01.dbf";
   set newname for datafile  6 to
 "/prod/testdb/test_ts_02.dbf";
   set newname for datafile  7 to
 "/prod/testdb/amit_ts2.dbf";
   set newname for datafile  8 to
 "/prod/testdb/priya_ts.dbf";
   set newname for datafile  9 to
 "/prod/testdb/priya_ts1.dbf";
   set newname for datafile  10 to
 "/prod/testdb/dev_ts_01.dbf";
   set newname for datafile  11 to
 "/prod/testdb/dev_ts_02.dbf";
   set newname for datafile  12 to
 "/prod/testdb/dev_ts_03.dbf";
   set newname for datafile  13 to
 "/prod/testdb/pcw_ts_01.dbf";
   set newname for datafile  14 to
 "/prod/testdb/read_only.dbf";
   backup as copy reuse
   datafile  1 auxiliary format
 "/prod/testdb/system.dbf"   datafile
 2 auxiliary format
 "/prod/testdb/sysaux.dbf"   datafile
 3 auxiliary format
 "/prod/testdb/undotbs.dbf"   datafile
 4 auxiliary format
 "/prod/testdb/userdata.dbf"   datafile
 5 auxiliary format
 "/prod/testdb/test_ts_01.dbf"   datafile
 6 auxiliary format
 "/prod/testdb/test_ts_02.dbf"   datafile
 7 auxiliary format
 "/prod/testdb/amit_ts2.dbf"   datafile
 8 auxiliary format
 "/prod/testdb/priya_ts.dbf"   datafile
 9 auxiliary format
 "/prod/testdb/priya_ts1.dbf"   datafile
 10 auxiliary format
 "/prod/testdb/dev_ts_01.dbf"   datafile
 11 auxiliary format
 "/prod/testdb/dev_ts_02.dbf"   datafile
 12 auxiliary format
 "/prod/testdb/dev_ts_03.dbf"   datafile
 13 auxiliary format
 "/prod/testdb/pcw_ts_01.dbf"   datafile
 14 auxiliary format
 "/prod/testdb/read_only.dbf"   ;
   sql 'alter system archive log current';
}
executing Memory Script

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

Starting backup at 24-OCT-15
using channel ORA_DISK_1
channel ORA_DISK_1: starting datafile copy
input datafile file number=00001 name=/data1/oradata/amit/system.dbf
output file name=/prod/testdb/system.dbf tag=TAG20151024T230219
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:10:39
channel ORA_DISK_1: starting datafile copy
input datafile file number=00004 name=/data2/oradata/amit/userdata.dbf
output file name=/prod/testdb/userdata.dbf tag=TAG20151024T230219
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:28:03
channel ORA_DISK_1: starting datafile copy
input datafile file number=00013 name=/data1/oradata/amit/pcw_ts_01.dbf
output file name=/prod/testdb/pcw_ts_01.dbf tag=TAG20151024T230219
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:26:39
channel ORA_DISK_1: starting datafile copy
input datafile file number=00002 name=/data1/oradata/amit/sysaux.dbf
output file name=/prod/testdb/sysaux.dbf tag=TAG20151024T230219
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:16:36
channel ORA_DISK_1: starting datafile copy
input datafile file number=00003 name=/data1/oradata/amit/undotbs.dbf
output file name=/prod/testdb/undotbs.dbf tag=TAG20151024T230219
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:14:21
channel ORA_DISK_1: starting datafile copy
input datafile file number=00010 name=/data1/oradata/amit/dev_ts_01.dbf
output file name=/prod/testdb/dev_ts_01.dbf tag=TAG20151024T230219
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:09:35
channel ORA_DISK_1: starting datafile copy
input datafile file number=00005 name=/data1/oradata/amit/test_ts_01.dbf
output file name=/prod/testdb/test_ts_01.dbf tag=TAG20151024T230219
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:05:04
channel ORA_DISK_1: starting datafile copy
input datafile file number=00006 name=/data1/oradata/amit/test_ts_02.dbf
output file name=/prod/testdb/test_ts_02.dbf tag=TAG20151024T230219
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:05:03
channel ORA_DISK_1: starting datafile copy
input datafile file number=00009 name=/data1/oradata/amit/priya_ts1.dbf
output file name=/prod/testdb/priya_ts1.dbf tag=TAG20151024T230219
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:02:45
channel ORA_DISK_1: starting datafile copy
input datafile file number=00007 name=/data1/oradata/amit/amit_ts2.dbf
output file name=/prod/testdb/amit_ts2.dbf tag=TAG20151024T230219
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:02:33
channel ORA_DISK_1: starting datafile copy
input datafile file number=00008 name=/data1/oradata/amit/priya_ts.dbf
output file name=/prod/testdb/priya_ts.dbf tag=TAG20151024T230219
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:02:33
channel ORA_DISK_1: starting datafile copy
input datafile file number=00014 name=/data1/oradata/amit/read_only.dbf
output file name=/prod/testdb/read_only.dbf tag=TAG20151024T230219
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:01:56
channel ORA_DISK_1: starting datafile copy
input datafile file number=00011 name=/data1/oradata/amit/dev_ts_02.dbf
output file name=/prod/testdb/dev_ts_02.dbf tag=TAG20151024T230219
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:42
channel ORA_DISK_1: starting datafile copy
input datafile file number=00012 name=/data1/oradata/amit/dev_ts_03.dbf
output file name=/prod/testdb/dev_ts_03.dbf tag=TAG20151024T230219
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:01:08
Finished backup at 25-OCT-25

sql statement: alter system archive log current

contents of Memory Script:
{
   backup as copy reuse
   archivelog like  "/archive/oradata/amit/arch/1_208_893114161.arch" auxiliary format
 "/prod/testdb/arch/1_208_893114161.arch"   archivelog like
 "/archive/oradata/amit/arch/1_209_893114161.arch" auxiliary format
 "/prod/testdb/arch/1_209_893114161.arch"   ;
   catalog clone archivelog  "/prod/testdb/arch/1_208_893114161.arch";
   catalog clone archivelog  "/prod/testdb/arch/1_209_893114161.arch";
   switch clone datafile all;
}
executing Memory Script

Starting backup at 25-OCT-25
using channel ORA_DISK_1
channel ORA_DISK_1: starting archived log copy
input archived log thread=1 sequence=208 RECID=271 STAMP=893979782
output file name=/prod/testdb/arch/1_208_893114161.arch RECID=0 STAMP=0
channel ORA_DISK_1: archived log copy complete, elapsed time: 00:02:36
channel ORA_DISK_1: starting archived log copy
input archived log thread=1 sequence=209 RECID=272 STAMP=893985198
output file name=/prod/testdb/arch/1_209_893114161.arch RECID=0 STAMP=0
channel ORA_DISK_1: archived log copy complete, elapsed time: 00:00:18
Finished backup at 25-OCT-25

cataloged archived log
archived log file name=/prod/testdb/arch/1_208_893114161.arch RECID=271 STAMP=893982440

cataloged archived log
archived log file name=/prod/testdb/arch/1_209_893114161.arch RECID=272 STAMP=893982446

datafile 1 switched to datafile copy
input datafile copy RECID=3 STAMP=893982453 file name=/prod/testdb/system.dbf
datafile 2 switched to datafile copy
input datafile copy RECID=4 STAMP=893982454 file name=/prod/testdb/sysaux.dbf
datafile 3 switched to datafile copy
input datafile copy RECID=5 STAMP=893982454 file name=/prod/testdb/undotbs.dbf
datafile 4 switched to datafile copy
input datafile copy RECID=6 STAMP=893982456 file name=/prod/testdb/userdata.dbf
datafile 5 switched to datafile copy
input datafile copy RECID=7 STAMP=893982463 file name=/prod/testdb/test_ts_01.dbf
datafile 6 switched to datafile copy
input datafile copy RECID=8 STAMP=893982468 file name=/prod/testdb/test_ts_02.dbf
datafile 7 switched to datafile copy
input datafile copy RECID=9 STAMP=893982468 file name=/prod/testdb/amit_ts2.dbf
datafile 8 switched to datafile copy
input datafile copy RECID=10 STAMP=893982468 file name=/prod/testdb/priya_ts.dbf
datafile 9 switched to datafile copy
input datafile copy RECID=11 STAMP=893982468 file name=/prod/testdb/priya_ts1.dbf
datafile 10 switched to datafile copy
input datafile copy RECID=12 STAMP=893982468 file name=/prod/testdb/dev_ts_01.dbf
datafile 11 switched to datafile copy
input datafile copy RECID=13 STAMP=893982469 file name=/prod/testdb/dev_ts_02.dbf
datafile 12 switched to datafile copy
input datafile copy RECID=14 STAMP=893982472 file name=/prod/testdb/dev_ts_03.dbf
datafile 13 switched to datafile copy
input datafile copy RECID=15 STAMP=893982472 file name=/prod/testdb/pcw_ts_01.dbf
datafile 14 switched to datafile copy
input datafile copy RECID=16 STAMP=893982472 file name=/prod/testdb/read_only.dbf

contents of Memory Script:
{
   set until scn  892802;
   recover
   clone database
    delete archivelog
   ;
}
executing Memory Script

executing command: SET until clause

Starting recover at 25-OCT-25
allocated channel: ORA_AUX_DISK_1
channel ORA_AUX_DISK_1: SID=19 device type=DISK

starting media recovery

archived log for thread 1 with sequence 208 is already on disk as file /prod/testdb/arch/1_208_893114161.arch
archived log for thread 1 with sequence 209 is already on disk as file /prod/testdb/arch/1_209_893114161.arch
archived log file name=/prod/testdb/arch/1_208_893114161.arch thread=1 sequence=208
archived log file name=/prod/testdb/arch/1_209_893114161.arch thread=1 sequence=209
media recovery complete, elapsed time: 00:02:14
Finished recover at 25-OCT-25

contents of Memory Script:
{
   shutdown clone immediate;
   startup clone nomount;
   sql clone "alter system set  db_name =
 ''TESTDB'' comment=
 ''Reset to original value by RMAN'' scope=spfile";
   sql clone "alter system reset  db_unique_name scope=spfile";
   shutdown clone immediate;
   startup clone nomount;
}
executing Memory Script

database dismounted
Oracle instance shut down

connected to auxiliary database (not started)
Oracle instance started

Total System Global Area     523108352 bytes

Fixed Size                     1337632 bytes
Variable Size                343934688 bytes
Database Buffers             171966464 bytes
Redo Buffers                   5869568 bytes

sql statement: alter system set  db_name =  ''TESTDB'' comment= ''Reset to original value by RMAN'' scope=spfile

sql statement: alter system reset  db_unique_name scope=spfile

Oracle instance shut down

connected to auxiliary database (not started)
Oracle instance started

Total System Global Area     523108352 bytes

Fixed Size                     1337632 bytes
Variable Size                343934688 bytes
Database Buffers             171966464 bytes
Redo Buffers                   5869568 bytes
sql statement: CREATE CONTROLFILE REUSE SET DATABASE "TESTDB" RESETLOGS ARCHIVELOG
  MAXLOGFILES     16
  MAXLOGMEMBERS      2
  MAXDATAFILES       30
  MAXINSTANCES     1
  MAXLOGHISTORY      292
 LOGFILE
  GROUP  1 ( '/prod/testdb/redo1a.log' ) SIZE 4 M  REUSE,
  GROUP  2 ( '/prod/testdb/redo2a.log' ) SIZE 4 M  REUSE
 DATAFILE
  '/prod/testdb/system.dbf'
 CHARACTER SET US7ASCII


contents of Memory Script:
{
   set newname for tempfile  1 to
 "/prod/testdb/temp.dbf";
   switch clone tempfile all;
   catalog clone datafilecopy  "/prod/testdb/sysaux.dbf",
 "/prod/testdb/undotbs.dbf",
 "/prod/testdb/userdata.dbf",
 "/prod/testdb/test_ts_01.dbf",
 "/prod/testdb/test_ts_02.dbf",
 "/prod/testdb/amit_ts2.dbf",
 "/prod/testdb/priya_ts.dbf",
 "/prod/testdb/priya_ts1.dbf",
 "/prod/testdb/dev_ts_01.dbf",
 "/prod/testdb/dev_ts_02.dbf",
 "/prod/testdb/dev_ts_03.dbf",
 "/prod/testdb/pcw_ts_01.dbf",
 "/prod/testdb/read_only.dbf";
   switch clone datafile all;
}
executing Memory Script

executing command: SET NEWNAME

renamed tempfile 1 to /prod/testdb/temp.dbf in control file

cataloged datafile copy
datafile copy file name=/prod/testdb/sysaux.dbf RECID=1 STAMP=893982851
cataloged datafile copy
datafile copy file name=/prod/testdb/undotbs.dbf RECID=2 STAMP=893982851
cataloged datafile copy
datafile copy file name=/prod/testdb/userdata.dbf RECID=3 STAMP=893982852
cataloged datafile copy
datafile copy file name=/prod/testdb/test_ts_01.dbf RECID=4 STAMP=893982852
cataloged datafile copy
datafile copy file name=/prod/testdb/test_ts_02.dbf RECID=5 STAMP=893982852
cataloged datafile copy
datafile copy file name=/prod/testdb/amit_ts2.dbf RECID=6 STAMP=893982852
cataloged datafile copy
datafile copy file name=/prod/testdb/priya_ts.dbf RECID=7 STAMP=893982852
cataloged datafile copy
datafile copy file name=/prod/testdb/priya_ts1.dbf RECID=8 STAMP=893982852
cataloged datafile copy
datafile copy file name=/prod/testdb/dev_ts_01.dbf RECID=9 STAMP=893982852
cataloged datafile copy
datafile copy file name=/prod/testdb/dev_ts_02.dbf RECID=10 STAMP=893982852
cataloged datafile copy
datafile copy file name=/prod/testdb/dev_ts_03.dbf RECID=11 STAMP=893982852
cataloged datafile copy
datafile copy file name=/prod/testdb/pcw_ts_01.dbf RECID=12 STAMP=893982852
cataloged datafile copy
datafile copy file name=/prod/testdb/read_only.dbf RECID=13 STAMP=893982852

datafile 2 switched to datafile copy
input datafile copy RECID=1 STAMP=893982851 file name=/prod/testdb/sysaux.dbf
datafile 3 switched to datafile copy
input datafile copy RECID=2 STAMP=893982851 file name=/prod/testdb/undotbs.dbf
datafile 4 switched to datafile copy
input datafile copy RECID=3 STAMP=893982852 file name=/prod/testdb/userdata.dbf
datafile 5 switched to datafile copy
input datafile copy RECID=4 STAMP=893982852 file name=/prod/testdb/test_ts_01.dbf
datafile 6 switched to datafile copy
input datafile copy RECID=5 STAMP=893982852 file name=/prod/testdb/test_ts_02.dbf
datafile 7 switched to datafile copy
input datafile copy RECID=6 STAMP=893982852 file name=/prod/testdb/amit_ts2.dbf
datafile 8 switched to datafile copy
input datafile copy RECID=7 STAMP=893982852 file name=/prod/testdb/priya_ts.dbf
datafile 9 switched to datafile copy
input datafile copy RECID=8 STAMP=893982852 file name=/prod/testdb/priya_ts1.dbf
datafile 10 switched to datafile copy
input datafile copy RECID=9 STAMP=893982852 file name=/prod/testdb/dev_ts_01.dbf
datafile 11 switched to datafile copy
input datafile copy RECID=10 STAMP=893982852 file name=/prod/testdb/dev_ts_02.dbf
datafile 12 switched to datafile copy
input datafile copy RECID=11 STAMP=893982852 file name=/prod/testdb/dev_ts_03.dbf
datafile 13 switched to datafile copy
input datafile copy RECID=12 STAMP=893982852 file name=/prod/testdb/pcw_ts_01.dbf
datafile 14 switched to datafile copy
input datafile copy RECID=13 STAMP=893982852 file name=/prod/testdb/read_only.dbf

contents of Memory Script:
{
   Alter clone database open resetlogs;
}
executing Memory Script

database opened
Finished Duplicate Db at 25-OCT-25

RMAN>

RMAN> exit


Recovery Manager complete.

date

[oracle@ibm ~]$
[oracle@ibm ~]$ date
Sun Oct 25 01:48:09 IST 2015
[oracle@ibm ~]$

No comments:

Post a Comment

How to recovery PDB when PDB database is dropped in Oracle

  How to recovery PDB when PDB database is dropped :) [oracle@rac01 ~]$ sqlplus '/as sysdba' SQL*Plus: Release 21.0.0.0.0 - Product...