RMAN duplicate using until time/backup set:
RMAN> show all;
using target database control file instead of recovery catalog
RMAN configuration parameters for database with db_unique_name DLFA01 are:
CONFIGURE RETENTION POLICY TO RECOVERY WINDOW OF 1 DAYS;
CONFIGURE BACKUP OPTIMIZATION OFF; # default
CONFIGURE DEFAULT DEVICE TYPE TO DISK; # default
CONFIGURE CONTROLFILE AUTOBACKUP OFF; # default
CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO ‘%F’; # default
CONFIGURE DEVICE TYPE DISK PARALLELISM 1 BACKUP TYPE TO BACKUPSET; # default
CONFIGURE DATAFILE BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default
CONFIGURE ARCHIVELOG BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default
CONFIGURE MAXSETSIZE TO UNLIMITED; # default
CONFIGURE ENCRYPTION FOR DATABASE OFF; # default
CONFIGURE ENCRYPTION ALGORITHM ‘AES128’; # default
CONFIGURE COMPRESSION ALGORITHM ‘BASIC’ AS OF RELEASE ‘DEFAULT’ OPTIMIZE FOR LOAD TRUE ; # default
CONFIGURE ARCHIVELOG DELETION POLICY TO NONE; # default
CONFIGURE SNAPSHOT CONTROLFILE NAME TO ‘/u01/app/oracle/product/11.2.0/dbhome_1/dbs/snapcf_DLFA01.f’; # default
RMAN> CONFIGURE CONTROLFILE AUTOBACKUP on
2> ;
new RMAN configuration parameters:
CONFIGURE CONTROLFILE AUTOBACKUP ON;
new RMAN configuration parameters are successfully stored
RMAN> backup as compressed backupset incremental level 0 database include current controlfile plus archivelog TAG=”2011_08_17_AK”;
Starting backup at 17-AUG-11
current log archived
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=47 device type=DISK
channel ORA_DISK_1: starting compressed archived log backup set
channel ORA_DISK_1: specifying archived log(s) in backup set
input archived log thread=1 sequence=5 RECID=4 STAMP=759355393
input archived log thread=1 sequence=6 RECID=5 STAMP=759355404
input archived log thread=1 sequence=7 RECID=6 STAMP=759355632
input archived log thread=1 sequence=8 RECID=7 STAMP=759355696
input archived log thread=1 sequence=9 RECID=8 STAMP=759396723
channel ORA_DISK_1: starting piece 1 at 17-AUG-11
channel ORA_DISK_1: finished piece 1 at 17-AUG-11
piece handle=+FRA_QA/dlfa01/backupset/2011_08_17/annnf0_2011_08_17_ak_0.366.759396725 tag=2011_08_17_AK comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:03
Finished backup at 17-AUG-11
Starting backup at 17-AUG-11
using channel ORA_DISK_1
channel ORA_DISK_1: starting compressed incremental level 0 datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
input datafile file number=00001 name=+DATA/dlfa01/datafile/system.256.758748765
input datafile file number=00002 name=+DATA/dlfa01/datafile/sysaux.257.758748767
input datafile file number=00003 name=+DATA/dlfa01/datafile/undotbs1.258.758748767
input datafile file number=00004 name=+DATA/dlfa01/datafile/users.259.758748767
channel ORA_DISK_1: starting piece 1 at 17-AUG-11
channel ORA_DISK_1: finished piece 1 at 17-AUG-11
piece handle=+FRA_QA/dlfa01/backupset/2011_08_17/nnndn0_tag20110817t073208_0.365.759396729 tag=TAG20110817T073208 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:01:06
channel ORA_DISK_1: starting compressed incremental level 0 datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
including current control file in backup set
channel ORA_DISK_1: starting piece 1 at 17-AUG-11
channel ORA_DISK_1: finished piece 1 at 17-AUG-11
piece handle=+FRA_QA/dlfa01/backupset/2011_08_17/ncnnn0_tag20110817t073208_0.364.759396797 tag=TAG20110817T073208 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
Finished backup at 17-AUG-11
Starting backup at 17-AUG-11
current log archived
using channel ORA_DISK_1
channel ORA_DISK_1: starting compressed archived log backup set
channel ORA_DISK_1: specifying archived log(s) in backup set
input archived log thread=1 sequence=10 RECID=9 STAMP=759396799
channel ORA_DISK_1: starting piece 1 at 17-AUG-11
channel ORA_DISK_1: finished piece 1 at 17-AUG-11
piece handle=+FRA_QA/dlfa01/backupset/2011_08_17/annnf0_2011_08_17_ak_0.1135.759396801 tag=2011_08_17_AK comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
Finished backup at 17-AUG-11
Starting Control File and SPFILE Autobackup at 17-AUG-11
piece handle=+FRA_QA/dlfa01/autobackup/2011_08_17/s_759396801.1136.759396803 comment=NONE
Finished Control File and SPFILE Autobackup at 17-AUG-11
RMAN> quit
$ env
_=*25457*/bin/env
CVS_RSH=ssh
G_BROKEN_FILENAMES=1
HISTSIZE=1000
HOME=/home/oracle
HOSTNAME=asm05
INPUTRC=/etc/inputrc
LANG=en_US.UTF-8
LD_LIBRARY_PATH=/u01/app/oracle/product/11.2.0/dbhome_1/lib
LESSOPEN=|/usr/bin/lesspipe.sh %s
LOGNAME=oracle
LS_COLORS=no=00:fi=00:di=01;34:ln=01;36:pi=40;33:so=01;35:bd=40;33;01:cd=40;33;01:or=01;05;37;41:mi=01;05;37;41:ex=01;32:*.cmd=01;32:*.exe=01;32:*.com=01;32:*.btm=01;32:*.bat=01;32:*.sh=01;32:*.csh=01;32:*.tar=01;31:*.tgz=01;31:*.arj=01;31:*.taz=01;31:*.lzh=01;31:*.zip=01;31:*.z=01;31:*.Z=01;31:*.gz=01;31:*.bz2=01;31:*.bz=01;31:*.tz=01;31:*.rpm=01;31:*.cpio=01;31:*.jpg=01;35:*.gif=01;35:*.bmp=01;35:*.xbm=01;35:*.xpm=01;35:*.png=01;35:*.tif=01;35:
MAIL=/var/spool/mail/oracle
ORACLE_BASE=/u01/app/oracle
ORACLE_HOME=/u01/app/oracle/product/11.2.0/dbhome_1
ORACLE_SID=CLONE01
PATH=/usr/kerberos/bin:/usr/local/bin:/bin:/usr/bin:/u01/app/oracle/product/11.2.0/dbhome_1/bin
PWD=/u01/app/oracle/product/11.2.0/dbhome_1/dbs
SHELL=/bin/ksh
SHLVL=1
SSH_ASKPASS=/usr/libexec/openssh/gnome-ssh-askpass
SSH_CLIENT=192.168.1.202 44746 22
SSH_CONNECTION=192.168.1.202 44746 192.168.1.241 22
SSH_TTY=/dev/pts/1
TERM=vt100
USER=oracle
_AST_FEATURES=UNIVERSE – ucb
A__z=”*SHLVL
$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.1.0 Production on Wed Aug 17 07:33:36 2011
Copyright (c) 1982, 2009, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 – 64bit Production
With the Partitioning, Automatic Storage Management, OLAP, Data Mining
and Real Application Testing options
SQL> shutdown abort;
ORACLE instance shut down.
SQL> !pwd
/u01/app/oracle/product/11.2.0/dbhome_1/dbs
SQL> !ls -lrt
total 28792
-rw-r–r– 1 oracle dba 2851 May 15 2009 init.ora
-rw-r—– 1 oracle dba 24 Aug 9 19:32 lkDLFA01
-rw-r—– 1 oracle dba 1536 Aug 9 19:34 orapwDLFA01
-rw-r—– 1 oracle dba 39 Aug 9 19:35 initDLFA01.ora
-rw-r—– 1 oracle dba 24 Aug 9 19:46 lkDLQA01
-rw-r—– 1 oracle dba 1536 Aug 9 19:47 orapwDLQA01
-rw-rw—- 1 oracle dba 1544 Aug 9 20:11 hc_DBUA0.dat
-rw-r—– 1 oracle dba 24 Aug 9 20:13 lkVALQA02
-rw-r—– 1 oracle dba 41 Aug 9 20:16 initVALQA02.ora
-rw-r—– 1 oracle dba 9748480 Aug 11 17:19 snapcf_DLQA01.f
-rw-r—– 1 oracle dba 1536 Aug 12 18:07 orapwCLONE01
-rw-r—– 1 oracle dba 24 Aug 13 14:59 lkCLONE01
-rw-r–r– 1 oracle dba 62 Aug 15 09:59 initDLQA01.ora
-rw-rw—- 1 oracle dba 1544 Aug 15 17:49 hc_DLQA01.dat
-rw-r—– 1 oracle dba 1536 Aug 16 15:15 orapwVALQA02
-rw-rw—- 1 oracle dba 1544 Aug 16 16:26 hc_VALQA02.dat
-rw-r—– 1 oracle dba 9846784 Aug 16 16:26 snapcf_VALQA02.f
-rw-rw—- 1 oracle dba 1544 Aug 16 20:03 hc_DLFA01.dat
-rw-r—– 1 oracle dba 931 Aug 17 07:09 initCLONE01.ora
-rw-r—– 1 oracle dba 12800 Aug 17 07:18 spfileCLONE01.ora
-rw-r—– 1 oracle dba 9748480 Aug 17 07:33 snapcf_DLFA01.f
-rw-rw—- 1 oracle dba 1544 Aug 17 07:33 hc_CLONE01.dat
SQL> startup nomount pfile=’initCLONE01.ora’
ORACLE instance started.
Total System Global Area 521936896 bytes
Fixed Size 2214936 bytes
Variable Size 159384552 bytes
Database Buffers 356515840 bytes
Redo Buffers 3821568 bytes
SQL> create spfile from pfile=’initCLONE01.ora’;
File created.
B COMPLETION_TIME
– ——————-
L 08/16/2011 20:07:15
D 08/16/2011 20:08:12
D 08/16/2011 20:08:14
L 08/16/2011 20:08:17
L 08/17/2011 07:32:08
D 08/17/2011 07:33:04
D 08/17/2011 07:33:17
L 08/17/2011 07:33:20
D 08/17/2011 07:33:23
9 rows selected.
SQL> l
1* select BACKUP_TYPE, COMPLETION_TIME from V$BACKUP_SET
> rman target sys/oracle@DLFA01
Recovery Manager: Release 11.2.0.1.0 – Production on Thu Aug 25 10:53:54 2011
Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved.
connected to target database: DLFA01 (DBID=3134528100)
RMAN> connect auxiliary /
RMAN> duplicate target database to CLONE01 nofilenamecheck UNTIL TIME “to_date(’08/17/2011 07:33′,’MM/DD/YYYY HH24:MI’)”;
Starting Duplicate Db at 17-AUG-11
using target database control file instead of recovery catalog
allocated channel: ORA_AUX_DISK_1
channel ORA_AUX_DISK_1: SID=23 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 521936896 bytes
Fixed Size 2214936 bytes
Variable Size 163578856 bytes
Database Buffers 352321536 bytes
Redo Buffers 3821568 bytes
contents of Memory Script:
{
set until scn 1044124;
sql clone “alter system set db_name =
”DLFA01” comment=
”Modified by RMAN duplicate” scope=spfile”;
sql clone “alter system set db_unique_name =
”CLONE01” comment=
”Modified by RMAN duplicate” scope=spfile”;
shutdown clone immediate;
startup clone force nomount
restore clone primary controlfile;
alter clone database mount;
}
executing Memory Script
executing command: SET until clause
sql statement: alter system set db_name = ”DLFA01” comment= ”Modified by RMAN duplicate” scope=spfile
sql statement: alter system set db_unique_name = ”CLONE01” comment= ”Modified by RMAN duplicate” scope=spfile
Oracle instance shut down
Oracle instance started
Total System Global Area 521936896 bytes
Fixed Size 2214936 bytes
Variable Size 163578856 bytes
Database Buffers 352321536 bytes
Redo Buffers 3821568 bytes
Starting restore at 17-AUG-11
allocated channel: ORA_AUX_DISK_1
channel ORA_AUX_DISK_1: SID=20 device type=DISK
channel ORA_AUX_DISK_1: starting datafile backup set restore
channel ORA_AUX_DISK_1: restoring control file
channel ORA_AUX_DISK_1: reading from backup piece +FRA_QA/dlfa01/backupset/2011_08_16/ncsnn0_tag20110816t200717_0.1009.759355695
channel ORA_AUX_DISK_1: piece handle=+FRA_QA/dlfa01/backupset/2011_08_16/ncsnn0_tag20110816t200717_0.1009.759355695 tag=TAG20110816T200717
channel ORA_AUX_DISK_1: restored backup piece 1
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:03
output file name=+DATA/clone01/controlfile/control01.ctl
output file name=+FRA_QA/clone01/controlfile/control02.ctl
Finished restore at 17-AUG-11
database mounted
contents of Memory Script:
{
set until scn 1044124;
set newname for clone datafile 1 to new;
set newname for clone datafile 2 to new;
set newname for clone datafile 3 to new;
set newname for clone datafile 4 to new;
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
Starting restore at 17-AUG-11
using channel ORA_AUX_DISK_1
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 +DATA
channel ORA_AUX_DISK_1: restoring datafile 00002 to +DATA
channel ORA_AUX_DISK_1: restoring datafile 00003 to +DATA
channel ORA_AUX_DISK_1: restoring datafile 00004 to +DATA
channel ORA_AUX_DISK_1: reading from backup piece +FRA_QA/dlfa01/backupset/2011_08_17/nnndn0_tag20110817t073208_0.365.759396729
channel ORA_AUX_DISK_1: piece handle=+FRA_QA/dlfa01/backupset/2011_08_17/nnndn0_tag20110817t073208_0.365.759396729 tag=TAG20110817T073208
channel ORA_AUX_DISK_1: restored backup piece 1
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:01:05
Finished restore at 17-AUG-11
contents of Memory Script:
{
switch clone datafile all;
}
executing Memory Script
datafile 1 switched to datafile copy
input datafile copy RECID=5 STAMP=759397024 file name=+DATA/clone01/datafile/system.288.759396959
datafile 2 switched to datafile copy
input datafile copy RECID=6 STAMP=759397024 file name=+DATA/clone01/datafile/sysaux.287.759396959
datafile 3 switched to datafile copy
input datafile copy RECID=7 STAMP=759397024 file name=+DATA/clone01/datafile/undotbs1.295.759396959
datafile 4 switched to datafile copy
input datafile copy RECID=8 STAMP=759397025 file name=+DATA/clone01/datafile/users.296.759396959
contents of Memory Script:
{
shutdown clone immediate;
startup clone nomount;
sql clone “alter system set db_name =
”CLONE01” 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 521936896 bytes
Fixed Size 2214936 bytes
Variable Size 163578856 bytes
Database Buffers 352321536 bytes
Redo Buffers 3821568 bytes
sql statement: alter system set db_name = ”CLONE01” 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 521936896 bytes
Fixed Size 2214936 bytes
Variable Size 163578856 bytes
Database Buffers 352321536 bytes
Redo Buffers 3821568 bytes
sql statement: CREATE CONTROLFILE REUSE SET DATABASE “CLONE01” 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
‘+DATA/clone01/datafile/system.288.759396959’
CHARACTER SET WE8MSWIN1252
contents of Memory Script:
{
set newname for clone tempfile 1 to new;
switch clone tempfile all;
catalog clone datafilecopy “+DATA/clone01/datafile/sysaux.287.759396959”,
“+DATA/clone01/datafile/undotbs1.295.759396959”,
“+DATA/clone01/datafile/users.296.759396959”;
switch clone datafile all;
}
executing Memory Script
executing command: SET NEWNAME
renamed tempfile 1 to +DATA in control file
cataloged datafile copy
datafile copy file name=+DATA/clone01/datafile/sysaux.287.759396959 RECID=1 STAMP=759397045
cataloged datafile copy
datafile copy file name=+DATA/clone01/datafile/undotbs1.295.759396959 RECID=2 STAMP=759397045
cataloged datafile copy
datafile copy file name=+DATA/clone01/datafile/users.296.759396959 RECID=3 STAMP=759397045
datafile 2 switched to datafile copy
input datafile copy RECID=1 STAMP=759397045 file name=+DATA/clone01/datafile/sysaux.287.759396959
datafile 3 switched to datafile copy
input datafile copy RECID=2 STAMP=759397045 file name=+DATA/clone01/datafile/undotbs1.295.759396959
datafile 4 switched to datafile copy
input datafile copy RECID=3 STAMP=759397045 file name=+DATA/clone01/datafile/users.296.759396959
contents of Memory Script:
{
Alter clone database open resetlogs;
}
executing Memory Script
database opened
Finished Duplicate Db at 17-AUG-11