`
wsql
  • 浏览: 11796672 次
  • 性别: Icon_minigender_1
  • 来自: 深圳
文章分类
社区版块
存档分类
最新评论

DUPLICATE到底做了什么?(续)

 
阅读更多
前几天对DUPLICATE到底做了什么一直倍感迷惑。。。
其实ORACLE推出DUPLICATE命令的目的不过是想把复杂的东西隐藏起来。
在RMAN中,所有命令都是基于DBID的,这样即使了DB_NAME相同,如果DBID不同RMAN也会认为是不同的数据库。
如restore controlfile from autobackup命令就是使用DBID来跟踪控制文件自动备份的。
可以通过RMAN恢复过程中记录的日志来观察RMAN在DUPLICATE过程中到底做了什么:
Recovery Manager: Release 9.2.0.7.0 - Production

Copyright (c) 1995, 2002, Oracle Corporation. All rights reserved.

connected to target database: ARSPRD (DBID=909397006)
connected to auxiliary database: ARSPRD (not mounted)

RMAN> DUPLICATE TARGET DATABASE TO ARSPRD until time "to_date('11/02/2008 02:38','mm/dd/yyyy hh24:mi')" nofilenamecheck;
2>
3>
Starting Duplicate Db at 03-NOV-08
using target database controlfile instead of recovery catalog
allocated channel: ORA_AUX_DISK_1
channel ORA_AUX_DISK_1: sid=13 devtype=DISK

printing stored script: Memory Script
{
set until scn 8354369681872;
set newname for datafile 1 to
"/global/oracle/oradata2/ARSPRD/system01.dbf";
set newname for datafile 2 to
"/global/oracle/oradata3/ARSPRD/undotbs01.dbf";
set newname for datafile 3 to
"/global/oracle2/oradata1/ARSPRD/arsystem01.dbf";
set newname for datafile 4 to
"/global/oracle/oradata3/ARSPRD/drsys01.dbf";
set newname for datafile 5 to
"/global/oracle/oradata4/ARSPRD/tools01.dbf";
set newname for datafile 6 to
"/global/oracle/oradata4/ARSPRD/users01.dbf";
set newname for datafile 7 to
"/global/oracle/oradata3/ARSPRD/xdb01.dbf";
set newname for datafile 8 to
"/global/oracle2/oradata1/ARSPRD/arsystem02.dbf";
set newname for datafile 9 to
"/global/oracle/oradata1/ARSPRD/smc_mv_logs01.dbf";
set newname for datafile 10 to
"/global/oracle2/oradata3/ARSPRD/arsystem03.dbf";
restore
check readonly
clone database
;

}
executing script: 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

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

Starting restore at 03-NOV-08

using channel ORA_AUX_DISK_1
channel ORA_AUX_DISK_1: starting datafile backupset restore
channel ORA_AUX_DISK_1: specifying datafile(s) to restore from backup set
restoring datafile 00003 to /global/oracle2/oradata1/ARSPRD/arsystem01.dbf
restoring datafile 00009 to /global/oracle/oradata1/ARSPRD/smc_mv_logs01.dbf
channel ORA_AUX_DISK_1: restored backup piece 1
piece handle=/global/oracle3/ORADUMP/ARSPRD/backup/ARSPRD_rman_db_h7juldl3_1_1.bak tag=TAG20081102T020003 params=NULL
channel ORA_AUX_DISK_1: restored backup piece 2
piece handle=/global/oracle3/ORADUMP/ARSPRD/backup/ARSPRD_rman_db_h7juldl3_2_1.bak tag=TAG20081102T020003 params=NULL
channel ORA_AUX_DISK_1: restored backup piece 3
piece handle=/global/oracle3/ORADUMP/ARSPRD/backup/ARSPRD_rman_db_h7juldl3_3_1.bak tag=TAG20081102T020003 params=NULL
channel ORA_AUX_DISK_1: restore complete
channel ORA_AUX_DISK_1: starting datafile backupset restore
channel ORA_AUX_DISK_1: specifying datafile(s) to restore from backup set
restoring datafile 00004 to /global/oracle/oradata3/ARSPRD/drsys01.dbf
restoring datafile 00005 to /global/oracle/oradata4/ARSPRD/tools01.dbf
restoring datafile 00006 to /global/oracle/oradata4/ARSPRD/users01.dbf
restoring datafile 00007 to /global/oracle/oradata3/ARSPRD/xdb01.dbf
restoring datafile 00008 to /global/oracle2/oradata1/ARSPRD/arsystem02.dbf
channel ORA_AUX_DISK_1: restored backup piece 1
piece handle=/global/oracle3/ORADUMP/ARSPRD/backup/ARSPRD_rman_db_h8jule8m_1_1.bak tag=TAG20081102T020003 params=NULL
channel ORA_AUX_DISK_1: restored backup piece 2
piece handle=/global/oracle3/ORADUMP/ARSPRD/backup/ARSPRD_rman_db_h8jule8m_2_1.bak tag=TAG20081102T020003 params=NULL

channel ORA_AUX_DISK_1: restored backup piece 3
piece handle=/global/oracle3/ORADUMP/ARSPRD/backup/ARSPRD_rman_db_h8jule8m_3_1.bak tag=TAG20081102T020003 params=NULL
channel ORA_AUX_DISK_1: restore complete
channel ORA_AUX_DISK_1: starting datafile backupset restore
channel ORA_AUX_DISK_1: specifying datafile(s) to restore from backup set
restoring datafile 00001 to /global/oracle/oradata2/ARSPRD/system01.dbf
restoring datafile 00002 to /global/oracle/oradata3/ARSPRD/undotbs01.dbf
restoring datafile 00010 to /global/oracle2/oradata3/ARSPRD/arsystem03.dbf
channel ORA_AUX_DISK_1: restored backup piece 1
piece handle=/global/oracle3/ORADUMP/ARSPRD/backup/ARSPRD_rman_db_h9juletp_1_1.bak tag=TAG20081102T020003 params=NULL
channel ORA_AUX_DISK_1: restored backup piece 2
piece handle=/global/oracle3/ORADUMP/ARSPRD/backup/ARSPRD_rman_db_h9juletp_2_1.bak tag=TAG20081102T020003 params=NULL
channel ORA_AUX_DISK_1: restored backup piece 3
piece handle=/global/oracle3/ORADUMP/ARSPRD/backup/ARSPRD_rman_db_h9juletp_3_1.bak tag=TAG20081102T020003 params=NULL
channel ORA_AUX_DISK_1: restore complete
Finished restore at 03-NOV-08
sql statement: CREATE CONTROLFILE REUSE SET DATABASE "ARSPRD" RESETLOGS ARCHIVELOG
MAXLOGFILES 5
MAXLOGMEMBERS 3
MAXDATAFILES 100
MAXINSTANCES 1
MAXLOGHISTORY 907
LOGFILE
GROUP 1 ( '/global/oracle/oradata3/ARSPRD/redo01.log' ) SIZE 104857600 REUSE,
GROUP 2 ( '/global/oracle/oradata4/ARSPRD/redo02.log' ) SIZE 104857600 REUSE,
GROUP 3 ( '/global/oracle/oradata3/ARSPRD/redo03.log' ) SIZE 104857600 REUSE
DATAFILE
'/global/oracle/oradata2/ARSPRD/system01.dbf'
CHARACTER SET UTF8


printing stored script: Memory Script
{
switch clone datafile all;
}
executing script: Memory Script

datafile 2 switched to datafile copy
input datafilecopy recid=1 stamp=669851119 filename=/global/oracle/oradata3/ARSPRD/undotbs01.dbf
datafile 3 switched to datafile copy
input datafilecopy recid=2 stamp=669851119 filename=/global/oracle2/oradata1/ARSPRD/arsystem01.dbf
datafile 4 switched to datafile copy
input datafilecopy recid=3 stamp=669851119 filename=/global/oracle/oradata3/ARSPRD/drsys01.dbf
datafile 5 switched to datafile copy
input datafilecopy recid=4 stamp=669851119 filename=/global/oracle/oradata4/ARSPRD/tools01.dbf
datafile 6 switched to datafile copy
input datafilecopy recid=5 stamp=669851119 filename=/global/oracle/oradata4/ARSPRD/users01.dbf
datafile 7 switched to datafile copy
input datafilecopy recid=6 stamp=669851119 filename=/global/oracle/oradata3/ARSPRD/xdb01.dbf
datafile 8 switched to datafile copy
input datafilecopy recid=7 stamp=669851119 filename=/global/oracle2/oradata1/ARSPRD/arsystem02.dbf
datafile 9 switched to datafile copy
input datafilecopy recid=8 stamp=669851119 filename=/global/oracle/oradata1/ARSPRD/smc_mv_logs01.dbf
datafile 10 switched to datafile copy
input datafilecopy recid=9 stamp=669851119 filename=/global/oracle2/oradata3/ARSPRD/arsystem03.dbf

printing stored script: Memory Script
{
set until time "to_date('11/02/2008 02:38','mm/dd/yyyy hh24:mi')";
recover
clone database
delete archivelog
;

}
executing script: Memory Script

executing command: SET until clause

Starting recover at 03-NOV-08
using channel ORA_AUX_DISK_1

starting media recovery

channel ORA_AUX_DISK_1: starting archive log restore to default destination
channel ORA_AUX_DISK_1: restoring archive log
archive log thread=1 sequence=14583
channel ORA_AUX_DISK_1: restored backup piece 1
piece handle=/global/oracle3/ORADUMP/ARSPRD/backup/ARSPRD_rman_db_hajulfjt_1_1.bak tag=TAG20081102T023331 params=NULL
channel ORA_AUX_DISK_1: restore complete
archive log filename=/global/oracle/oradump1/ARSPRD/archive/arch1_14583.dbf thread=1 sequence=14583
channel clone_default: deleting archive log(s)
archive log filename=/global/oracle/oradump1/ARSPRD/archive/arch1_14583.dbf recid=1 stamp=669851169
channel ORA_AUX_DISK_1: starting archive log restore to default destination
channel ORA_AUX_DISK_1: restoring archive log
archive log thread=1 sequence=14584
channel ORA_AUX_DISK_1: restored backup piece 1
piece handle=/global/oracle3/ORADUMP/ARSPRD/backup/ARSPRD_rman_db_hfjuo421_1_1.bak tag=TAG20081103T023440 params=NULL
channel ORA_AUX_DISK_1: restore complete
archive log filename=/global/oracle/oradump1/ARSPRD/archive/arch1_14584.dbf thread=1 sequence=14584
channel clone_default: deleting archive log(s)
archive log filename=/global/oracle/oradump1/ARSPRD/archive/arch1_14584.dbf recid=2 stamp=669851202
media recovery complete
Finished recover at 03-NOV-08

printing stored script: Memory Script
{
shutdown clone;
startup clone nomount ;

}
executing script: Memory Script

database dismounted
Oracle instance shut down

connected to auxiliary database (not started)
Oracle instance started

Total System Global Area 940660660 bytes

Fixed Size 456628 bytes
Variable Size 402653184 bytes
Database Buffers 536870912 bytes
Redo Buffers 679936 bytes
sql statement: CREATE CONTROLFILE REUSE SET DATABASE "ARSPRD" RESETLOGS ARCHIVELOG
MAXLOGFILES 5
MAXLOGMEMBERS 3
MAXDATAFILES 100
MAXINSTANCES 1
MAXLOGHISTORY 907
LOGFILE
GROUP 1 ( '/global/oracle/oradata3/ARSPRD/redo01.log' ) SIZE 104857600 REUSE,
GROUP 2 ( '/global/oracle/oradata4/ARSPRD/redo02.log' ) SIZE 104857600 REUSE,
GROUP 3 ( '/global/oracle/oradata3/ARSPRD/redo03.log' ) SIZE 104857600 REUSE
DATAFILE
'/global/oracle/oradata2/ARSPRD/system01.dbf'
CHARACTER SET UTF8


printing stored script: Memory Script
{
catalog clone datafilecopy "/global/oracle/oradata3/ARSPRD/undotbs01.dbf";
catalog clone datafilecopy "/global/oracle2/oradata1/ARSPRD/arsystem01.dbf";
catalog clone datafilecopy "/global/oracle/oradata3/ARSPRD/drsys01.dbf";
catalog clone datafilecopy "/global/oracle/oradata4/ARSPRD/tools01.dbf";
catalog clone datafilecopy "/global/oracle/oradata4/ARSPRD/users01.dbf";
catalog clone datafilecopy "/global/oracle/oradata3/ARSPRD/xdb01.dbf";
catalog clone datafilecopy "/global/oracle2/oradata1/ARSPRD/arsystem02.dbf";
catalog clone datafilecopy "/global/oracle/oradata1/ARSPRD/smc_mv_logs01.dbf";
catalog clone datafilecopy "/global/oracle2/oradata3/ARSPRD/arsystem03.dbf";
switch clone datafile all;

}
executing script: Memory Script

cataloged datafile copy
datafile copy filename=/global/oracle/oradata3/ARSPRD/undotbs01.dbf recid=1 stamp=669851222

cataloged datafile copy
datafile copy filename=/global/oracle2/oradata1/ARSPRD/arsystem01.dbf recid=2 stamp=669851223

cataloged datafile copy
datafile copy filename=/global/oracle/oradata3/ARSPRD/drsys01.dbf recid=3 stamp=669851224

cataloged datafile copy
datafile copy filename=/global/oracle/oradata4/ARSPRD/tools01.dbf recid=4 stamp=669851225

cataloged datafile copy
datafile copy filename=/global/oracle/oradata4/ARSPRD/users01.dbf recid=5 stamp=669851226

cataloged datafile copy
datafile copy filename=/global/oracle/oradata3/ARSPRD/xdb01.dbf recid=6 stamp=669851227

cataloged datafile copy
datafile copy filename=/global/oracle2/oradata1/ARSPRD/arsystem02.dbf recid=7 stamp=669851228

cataloged datafile copy
datafile copy filename=/global/oracle/oradata1/ARSPRD/smc_mv_logs01.dbf recid=8 stamp=669851228

cataloged datafile copy
datafile copy filename=/global/oracle2/oradata3/ARSPRD/arsystem03.dbf recid=9 stamp=669851229

datafile 2 switched to datafile copy
input datafilecopy recid=1 stamp=669851222 filename=/global/oracle/oradata3/ARSPRD/undotbs01.dbf
datafile 3 switched to datafile copy
input datafilecopy recid=2 stamp=669851223 filename=/global/oracle2/oradata1/ARSPRD/arsystem01.dbf
datafile 4 switched to datafile copy
input datafilecopy recid=3 stamp=669851224 filename=/global/oracle/oradata3/ARSPRD/drsys01.dbf
datafile 5 switched to datafile copy
input datafilecopy recid=4 stamp=669851225 filename=/global/oracle/oradata4/ARSPRD/tools01.dbf
datafile 6 switched to datafile copy
input datafilecopy recid=5 stamp=669851226 filename=/global/oracle/oradata4/ARSPRD/users01.dbf
datafile 7 switched to datafile copy
input datafilecopy recid=6 stamp=669851227 filename=/global/oracle/oradata3/ARSPRD/xdb01.dbf
datafile 8 switched to datafile copy
input datafilecopy recid=7 stamp=669851228 filename=/global/oracle2/oradata1/ARSPRD/arsystem02.dbf
datafile 9 switched to datafile copy
input datafilecopy recid=8 stamp=669851228 filename=/global/oracle/oradata1/ARSPRD/smc_mv_logs01.dbf
datafile 10 switched to datafile copy
input datafilecopy recid=9 stamp=669851229 filename=/global/oracle2/oradata3/ARSPRD/arsystem03.dbf

printing stored script: Memory Script
{
Alter clone database open resetlogs;
}
executing script: Memory Script

database opened
Finished Duplicate Db at 03-NOV-08

Recovery Manager complete.


分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics