Wednesday, June 18, 2014

duplicate database from backup location

1.Script for performing duplicate database from backup location and place all the backup of the source database in the backup location specified in the duplicate database command.No connection to source database or the recover catalog.
run
 {
 duplicate database 'newdb' to 'dupdb'
 nofilenamecheck
 backup location '/u03/backup_db2';
 }

2.Output of script execution

[oracle@ol6-112-rac2 rman]$ rman auxiliary="sys/sys123@dupdb"

Recovery Manager: Release 11.2.0.3.0 - Production on Wed Jun 18 22:54:29 2014

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

connected to auxiliary database: DUPDB (not mounted)

RMAN> @ rman_duplicate_fs_7.cmd

RMAN> run
2> {
3> duplicate database 'newdb' to 'dupdb'
4> nofilenamecheck
5> spfile
6> backup location '/u03/backup_db2';
7> }
Starting Duplicate Db at 18-JUN-14

contents of Memory Script:
{
   restore clone spfile to  '/u01/app/orcl/oracle/product/11.2.0.3/db_1/dbs/spfiledupdb.ora' from
 '/u03/backup_db2/c-3090890366-20140618-00';
   sql clone "alter system set spfile= ''/u01/app/orcl/oracle/product/11.2.0.3/db_1/dbs/spfiledupdb.ora''";
}
executing Memory Script

Starting restore at 18-JUN-14
allocated channel: ORA_AUX_DISK_1
channel ORA_AUX_DISK_1: SID=19 device type=DISK

channel ORA_AUX_DISK_1: restoring spfile from AUTOBACKUP /u03/backup_db2/c-3090890366-20140618-00
channel ORA_AUX_DISK_1: SPFILE restore from AUTOBACKUP complete
Finished restore at 18-JUN-14

sql statement: alter system set spfile= ''/u01/app/orcl/oracle/product/11.2.0.3/db_1/dbs/spfiledupdb.ora''

contents of Memory Script:
{
   sql clone "alter system set  db_name =
 ''DUPDB'' comment=
 ''duplicate'' scope=spfile";
   shutdown clone immediate;
   startup clone nomount;
}
executing Memory Script

sql statement: alter system set  db_name =  ''DUPDB'' comment= ''duplicate'' scope=spfile

Oracle instance shut down

connected to auxiliary database (not started)
Oracle instance started

Total System Global Area     275578880 bytes

Fixed Size                     2227584 bytes
Variable Size                104858240 bytes
Database Buffers             163577856 bytes
Redo Buffers                   4915200 bytes

contents of Memory Script:
{
   sql clone "alter system set  db_name =
 ''NEWDB'' comment=
 ''Modified by RMAN duplicate'' scope=spfile";
   sql clone "alter system set  db_unique_name =
 ''DUPDB'' comment=
 ''Modified by RMAN duplicate'' scope=spfile";
   shutdown clone immediate;
   startup clone force nomount
   restore clone primary controlfile from  '/u03/backup_db2/c-3090890366-20140618-00';
   alter clone database mount;
}
executing Memory Script

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

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

Oracle instance shut down

Oracle instance started

Total System Global Area     275578880 bytes

Fixed Size                     2227584 bytes
Variable Size                104858240 bytes
Database Buffers             163577856 bytes
Redo Buffers                   4915200 bytes

Starting restore at 18-JUN-14
allocated channel: ORA_AUX_DISK_1
channel ORA_AUX_DISK_1: SID=18 device type=DISK

channel ORA_AUX_DISK_1: restoring control file
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:03
output file name=/u03/oradata/newdb/control01.ctl
output file name=/u03/fra/newdb/control02.ctl
Finished restore at 18-JUN-14

database mounted
released channel: ORA_AUX_DISK_1
allocated channel: ORA_AUX_DISK_1
channel ORA_AUX_DISK_1: SID=18 device type=DISK
allocated channel: ORA_AUX_DISK_2
channel ORA_AUX_DISK_2: SID=20 device type=DISK
allocated channel: ORA_AUX_DISK_3
channel ORA_AUX_DISK_3: SID=21 device type=DISK
allocated channel: ORA_AUX_DISK_4
channel ORA_AUX_DISK_4: SID=22 device type=DISK
allocated channel: ORA_AUX_DISK_5
channel ORA_AUX_DISK_5: SID=23 device type=DISK
allocated channel: ORA_AUX_DISK_6
channel ORA_AUX_DISK_6: SID=24 device type=DISK
allocated channel: ORA_AUX_DISK_7
channel ORA_AUX_DISK_7: SID=25 device type=DISK
allocated channel: ORA_AUX_DISK_8
channel ORA_AUX_DISK_8: SID=26 device type=DISK
allocated channel: ORA_AUX_DISK_9
channel ORA_AUX_DISK_9: SID=27 device type=DISK
allocated channel: ORA_AUX_DISK_10
channel ORA_AUX_DISK_10: SID=28 device type=DISK

contents of Memory Script:
{
   set until scn  1214733;
   set newname for datafile  1 to
 "/u03/oradata/dupdb/system01.dbf";
   set newname for datafile  2 to
 "/u03/oradata/dupdb/sysaux01.dbf";
   set newname for datafile  3 to
 "/u03/oradata/dupdb/undotbs01.dbf";
   set newname for datafile  4 to
 "/u03/oradata/dupdb/users01.dbf";
   set newname for datafile  5 to
 "/u03/oradata/dupdb/example01.dbf";
   restore
   clone database
   ;
}
executing Memory Script

executing command: SET until clause

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

Starting restore at 18-JUN-14
using channel ORA_AUX_DISK_1
using channel ORA_AUX_DISK_2
using channel ORA_AUX_DISK_3
using channel ORA_AUX_DISK_4
using channel ORA_AUX_DISK_5
using channel ORA_AUX_DISK_6
using channel ORA_AUX_DISK_7
using channel ORA_AUX_DISK_8
using channel ORA_AUX_DISK_9
using channel ORA_AUX_DISK_10

channel ORA_AUX_DISK_1: starting datafile backup set restore
channel ORA_AUX_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_AUX_DISK_1: restoring datafile 00001 to /u03/oradata/dupdb/system01.dbf
channel ORA_AUX_DISK_1: reading from backup piece /u03/backup_db2/22pb67l3_1_1
channel ORA_AUX_DISK_2: starting datafile backup set restore
channel ORA_AUX_DISK_2: specifying datafile(s) to restore from backup set
channel ORA_AUX_DISK_2: restoring datafile 00002 to /u03/oradata/dupdb/sysaux01.dbf
channel ORA_AUX_DISK_2: reading from backup piece /u03/backup_db2/23pb67l3_1_1
channel ORA_AUX_DISK_3: starting datafile backup set restore
channel ORA_AUX_DISK_3: specifying datafile(s) to restore from backup set
channel ORA_AUX_DISK_3: restoring datafile 00003 to /u03/oradata/dupdb/undotbs01.dbf
channel ORA_AUX_DISK_3: reading from backup piece /u03/backup_db2/25pb67l4_1_1
channel ORA_AUX_DISK_4: starting datafile backup set restore
channel ORA_AUX_DISK_4: specifying datafile(s) to restore from backup set
channel ORA_AUX_DISK_4: restoring datafile 00004 to /u03/oradata/dupdb/users01.dbf
channel ORA_AUX_DISK_4: reading from backup piece /u03/backup_db2/26pb67l4_1_1
channel ORA_AUX_DISK_5: starting datafile backup set restore
channel ORA_AUX_DISK_5: specifying datafile(s) to restore from backup set
channel ORA_AUX_DISK_5: restoring datafile 00005 to /u03/oradata/dupdb/example01.dbf
channel ORA_AUX_DISK_5: reading from backup piece /u03/backup_db2/24pb67l3_1_1
channel ORA_AUX_DISK_4: piece handle=/u03/backup_db2/26pb67l4_1_1 tag=TAG20140618T213947
channel ORA_AUX_DISK_4: restored backup piece 1
channel ORA_AUX_DISK_4: restore complete, elapsed time: 00:00:01
channel ORA_AUX_DISK_3: piece handle=/u03/backup_db2/25pb67l4_1_1 tag=TAG20140618T213947
channel ORA_AUX_DISK_3: restored backup piece 1
channel ORA_AUX_DISK_3: restore complete, elapsed time: 00:00:45
channel ORA_AUX_DISK_5: piece handle=/u03/backup_db2/24pb67l3_1_1 tag=TAG20140618T213947
channel ORA_AUX_DISK_5: restored backup piece 1
channel ORA_AUX_DISK_5: restore complete, elapsed time: 00:00:55
channel ORA_AUX_DISK_2: piece handle=/u03/backup_db2/23pb67l3_1_1 tag=TAG20140618T213947
channel ORA_AUX_DISK_2: restored backup piece 1
channel ORA_AUX_DISK_2: restore complete, elapsed time: 00:01:45
channel ORA_AUX_DISK_1: piece handle=/u03/backup_db2/22pb67l3_1_1 tag=TAG20140618T213947
channel ORA_AUX_DISK_1: restored backup piece 1
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:02:45
Finished restore at 18-JUN-14

contents of Memory Script:
{
   switch clone datafile all;
}
executing Memory Script

datafile 1 switched to datafile copy
input datafile copy RECID=6 STAMP=850604270 file name=/u03/oradata/dupdb/system01.dbf
datafile 2 switched to datafile copy
input datafile copy RECID=7 STAMP=850604270 file name=/u03/oradata/dupdb/sysaux01.dbf
datafile 3 switched to datafile copy
input datafile copy RECID=8 STAMP=850604270 file name=/u03/oradata/dupdb/undotbs01.dbf
datafile 4 switched to datafile copy
input datafile copy RECID=9 STAMP=850604270 file name=/u03/oradata/dupdb/users01.dbf
datafile 5 switched to datafile copy
input datafile copy RECID=10 STAMP=850604270 file name=/u03/oradata/dupdb/example01.dbf

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

executing command: SET until clause

Starting recover at 18-JUN-14
using channel ORA_AUX_DISK_1
using channel ORA_AUX_DISK_2
using channel ORA_AUX_DISK_3
using channel ORA_AUX_DISK_4
using channel ORA_AUX_DISK_5
using channel ORA_AUX_DISK_6
using channel ORA_AUX_DISK_7
using channel ORA_AUX_DISK_8
using channel ORA_AUX_DISK_9
using channel ORA_AUX_DISK_10

starting media recovery

channel ORA_AUX_DISK_1: starting archived log restore to default destination
channel ORA_AUX_DISK_1: restoring archived log
archived log thread=1 sequence=37
channel ORA_AUX_DISK_1: reading from backup piece /u03/backup_db2/27pb67nr_1_1
channel ORA_AUX_DISK_1: piece handle=/u03/backup_db2/27pb67nr_1_1 tag=FULL_ARCH_BKP
channel ORA_AUX_DISK_1: restored backup piece 1
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:01
archived log file name=/u03/fra/1_37_850479107.dbf thread=1 sequence=37
channel clone_default: deleting archived log(s)
archived log file name=/u03/fra/1_37_850479107.dbf RECID=1 STAMP=850604271
media recovery complete, elapsed time: 00:00:02
Finished recover at 18-JUN-14
Oracle instance started

Total System Global Area     275578880 bytes

Fixed Size                     2227584 bytes
Variable Size                109052544 bytes
Database Buffers             159383552 bytes
Redo Buffers                   4915200 bytes

contents of Memory Script:
{
   sql clone "alter system set  db_name =
 ''DUPDB'' 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

sql statement: alter system set  db_name =  ''DUPDB'' 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     275578880 bytes

Fixed Size                     2227584 bytes
Variable Size                109052544 bytes
Database Buffers             159383552 bytes
Redo Buffers                   4915200 bytes
sql statement: CREATE CONTROLFILE REUSE SET DATABASE "DUPDB" RESETLOGS ARCHIVELOG
  MAXLOGFILES     16
  MAXLOGMEMBERS      3
  MAXDATAFILES      100
  MAXINSTANCES     8
  MAXLOGHISTORY      292
 LOGFILE
  GROUP   1  SIZE 50 M ,
  GROUP   2  SIZE 50 M ,
  GROUP   3  SIZE 50 M
 DATAFILE
  '/u03/oradata/dupdb/system01.dbf'
 CHARACTER SET AL32UTF8


contents of Memory Script:
{
   set newname for tempfile  1 to
 "/u03/oradata/newdb/temp01.dbf";
   switch clone tempfile all;
   catalog clone datafilecopy  "/u03/oradata/dupdb/sysaux01.dbf",
 "/u03/oradata/dupdb/undotbs01.dbf",
 "/u03/oradata/dupdb/users01.dbf",
 "/u03/oradata/dupdb/example01.dbf";
   switch clone datafile all;
}
executing Memory Script

executing command: SET NEWNAME

renamed tempfile 1 to /u03/oradata/newdb/temp01.dbf in control file

cataloged datafile copy
datafile copy file name=/u03/oradata/dupdb/sysaux01.dbf RECID=1 STAMP=850604298
cataloged datafile copy
datafile copy file name=/u03/oradata/dupdb/undotbs01.dbf RECID=2 STAMP=850604299
cataloged datafile copy
datafile copy file name=/u03/oradata/dupdb/users01.dbf RECID=3 STAMP=850604299
cataloged datafile copy
datafile copy file name=/u03/oradata/dupdb/example01.dbf RECID=4 STAMP=850604299

datafile 2 switched to datafile copy
input datafile copy RECID=1 STAMP=850604298 file name=/u03/oradata/dupdb/sysaux01.dbf
datafile 3 switched to datafile copy
input datafile copy RECID=2 STAMP=850604299 file name=/u03/oradata/dupdb/undotbs01.dbf
datafile 4 switched to datafile copy
input datafile copy RECID=3 STAMP=850604299 file name=/u03/oradata/dupdb/users01.dbf
datafile 5 switched to datafile copy
input datafile copy RECID=4 STAMP=850604299 file name=/u03/oradata/dupdb/example01.dbf

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

database opened
Finished Duplicate Db at 18-JUN-14

RMAN> **end-of-file**


No comments: