发表于: 2008.10.03 23:26
分类: ORACLE , Bug
出处: http://yangtingkun.itpub.net/post/468/471670
---------------------------------------------------------------
当执行DUPLICATE命令的时候,应该确保源数据库的归档日志或备份,在目标数据库的相同路径下可以访问,否则就会报错RMAN-6025。
如下面的这个例子中,即使设置了新的LOG_ARCHIVE_DEST_1参数,Oracle也不会从这个目标下读取日志的,因为DUPLICATE操作以源数据库为准:
bash-3.00$ rman target sys/test@172.0.2.54/rac11g.us.oracle.com catalog catalog_user/catalog_user@172.0.2.61/test11g.netdb auxiliary /
Recovery Manager: Release 11.1.0.6.0 - Production on Mon Sep 8 20:03:43 2008
Copyright (c) 1982, 2007, Oracle. All rights reserved.
connected to target database: RAC11G (DBID=1712482917)
connected to recovery catalog database
connected to auxiliary database: RAC11GS (not mounted)
RMAN> duplicate target database to rac11gs
2> db_file_name_convert '/dev/vx/rdsk/datavg', '+DATA/RAC11G'
3> spfile
4> parameter_value_convert '/dev/vx/rdsk/datavg', '+DATA/RAC11G'
5> set log_file_name_convert '/dev/vx/rdsk/datavg', '+DATA/RAC11G'
6> set log_archive_dest_1='LOCATION=+DATA/RAC11G'
7> set local_listener = ''
8> set cluster_database = 'false'
9> ;
Starting Duplicate Db at 08-SEP-08
allocated channel: ORA_AUX_DISK_1
channel ORA_AUX_DISK_1: SID=112 device type=DISK
contents of Memory Script:
{
set until scn 26685490;
restore clone spfile to '/data/oracle/product/11.1/database/dbs/spfilerac11g1.ora';
sql clone "alter system set spfile= ''/data/oracle/product/11.1/database/dbs/spfilerac11g1.ora''";
}
executing Memory Script
executing command: SET until clause
Starting restore at 08-SEP-08
using channel ORA_AUX_DISK_1
channel ORA_AUX_DISK_1: starting datafile backup set restore
channel ORA_AUX_DISK_1: restoring SPFILE
output file name=/data/oracle/product/11.1/database/dbs/spfilerac11g1.ora
channel ORA_AUX_DISK_1: reading from backup piece +DATA/backup/01jpk0bj_1_1
channel ORA_AUX_DISK_1: piece handle=+DATA/backup/01jpk0bj_1_1 tag=TAG20080902T204539
channel ORA_AUX_DISK_1: restored backup piece 1
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:07
Finished restore at 08-SEP-08
sql statement: alter system set spfile= ''/data/oracle/product/11.1/database/dbs/spfilerac11g1.ora''
contents of Memory Script:
{
sql clone "alter system set db_name =
''RAC11GS'' comment=
''duplicate'' scope=spfile";
sql clone "alter system set control_files =
''+DATA/RAC11G/rac11g_control_1'', ''+DATA/RAC11G/rac11g_control_2'', ''+DATA/RAC11G/rac11g_control_3'' comment=
'''' scope=spfile";
sql clone "alter system set log_file_name_convert =
''/dev/vx/rdsk/datavg'', ''+DATA/RAC11G'' comment=
'''' scope=spfile";
sql clone "alter system set log_archive_dest_1 =
''LOCATION=+DATA/RAC11G'' comment=
'''' scope=spfile";
sql clone "alter system set local_listener =
'''' comment=
'''' scope=spfile";
sql clone "alter system set cluster_database =
false comment=
'''' scope=spfile";
shutdown clone immediate;
startup clone nomount ;
}
executing Memory Script
sql statement: alter system set db_name = ''RAC11GS'' comment= ''duplicate'' scope=spfile
sql statement: alter system set control_files = ''+DATA/RAC11G/rac11g_control_1'', ''+DATA/RAC11G/rac11g_control_2'', ''+DATA/RAC11G/rac11g_control_3'' comment= '''' scope=spfile
sql statement: alter system set log_file_name_convert = ''/dev/vx/rdsk/datavg'', ''+DATA/RAC11G'' comment= '''' scope=spfile
sql statement: alter system set log_archive_dest_1 = ''LOCATION=+DATA/RAC11G'' comment= '''' scope=spfile
sql statement: alter system set local_listener = '''' comment= '''' scope=spfile
sql statement: alter system set cluster_database = false comment= '''' scope=spfile
Oracle instance shut down
connected to auxiliary database (not started)
Oracle instance started
Total System Global Area 17108271104 bytes
Fixed Size 2101632 bytes
Variable Size 3747073664 bytes
Database Buffers 13354663936 bytes
Redo Buffers 4431872 bytes
contents of Memory Script:
{
set until scn 26685490;
set newname for datafile 1 to
"+DATA/rac11g/rac11g_system_1_1g";
set newname for datafile 2 to
"+DATA/rac11g/rac11g_sysaux_1_1g";
set newname for datafile 3 to
"+DATA/rac11g/rac11g_undotbs1_1_4g";
set newname for datafile 4 to
"+DATA/rac11g/rac11g_undotbs2_1_4g";
set newname for datafile 5 to
"+DATA/rac11g/rac11g_users_1_4g";
set newname for datafile 6 to
"+DATA/rac11g/rac11g_ndmain_1_32g";
set newname for datafile 7 to
"+DATA/rac11g/rac11g_ndmain_2_32g";
set newname for datafile 8 to
"+DATA/rac11g/rac11g_ndmain_3_32g";
set newname for datafile 9 to
"+DATA/rac11g/rac11g_ndmain_4_32g";
set newname for datafile 10 to
"+DATA/rac11g/rac11g_ndmain_5_32g";
set newname for datafile 11 to
"+DATA/rac11g/rac11g_ndmain_6_32g";
set newname for datafile 12 to
"+DATA/rac11g/rac11g_undotbs1_2_32g";
set newname for datafile 13 to
"+DATA/rac11g/rac11g_undotbs2_2_32g";
set newname for datafile 14 to
"+DATA/rac11g/rac11g_perfstat_1_8g";
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
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 08-SEP-08
allocated channel: ORA_AUX_DISK_1
channel ORA_AUX_DISK_1: SID=661 device type=DISK
skipping datafile 1; already restored to file +DATA/rac11g/rac11g_system_1_1g
skipping datafile 2; already restored to file +DATA/rac11g/rac11g_sysaux_1_1g
skipping datafile 3; already restored to file +DATA/rac11g/rac11g_undotbs1_1_4g
skipping datafile 4; already restored to file +DATA/rac11g/rac11g_undotbs2_1_4g
skipping datafile 5; already restored to file +DATA/rac11g/rac11g_users_1_4g
skipping datafile 6; already restored to file +DATA/rac11g/rac11g_ndmain_1_32g
skipping datafile 7; already restored to file +DATA/rac11g/rac11g_ndmain_2_32g
skipping datafile 8; already restored to file +DATA/rac11g/rac11g_ndmain_3_32g
skipping datafile 9; already restored to file +DATA/rac11g/rac11g_ndmain_4_32g
skipping datafile 10; already restored to file +DATA/rac11g/rac11g_ndmain_5_32g
skipping datafile 11; already restored to file +DATA/rac11g/rac11g_ndmain_6_32g
skipping datafile 12; already restored to file +DATA/rac11g/rac11g_undotbs1_2_32g
skipping datafile 13; already restored to file +DATA/rac11g/rac11g_undotbs2_2_32g
skipping datafile 14; already restored to file +DATA/rac11g/rac11g_perfstat_1_8g
restore not done; all files read only, offline, or already restored
Finished restore at 08-SEP-08
sql statement: CREATE CONTROLFILE REUSE SET DATABASE "RAC11GS" RESETLOGS ARCHIVELOG
MAXLOGFILES 192
MAXLOGMEMBERS 3
MAXDATAFILES 1024
MAXINSTANCES 32
MAXLOGHISTORY 1168
LOGFILE
GROUP 1 ( '+DATA/rac11g/rac11g_redo1_1_1_1g' ) SIZE 1 G REUSE,
GROUP 2 ( '+DATA/rac11g/rac11g_redo1_2_1_1g' ) SIZE 1 G REUSE
DATAFILE
'+DATA/rac11g/rac11g_system_1_1g'
CHARACTER SET ZHS16GBK
contents of Memory Script:
{
switch clone datafile all;
}
executing Memory Script
datafile 2 switched to datafile copy
input datafile copy RECID=1 STAMP=664920273 file name=+DATA/rac11g/rac11g_sysaux_1_1g
datafile 3 switched to datafile copy
input datafile copy RECID=2 STAMP=664920273 file name=+DATA/rac11g/rac11g_undotbs1_1_4g
datafile 4 switched to datafile copy
input datafile copy RECID=3 STAMP=664920273 file name=+DATA/rac11g/rac11g_undotbs2_1_4g
datafile 5 switched to datafile copy
input datafile copy RECID=4 STAMP=664920273 file name=+DATA/rac11g/rac11g_users_1_4g
datafile 6 switched to datafile copy
input datafile copy RECID=5 STAMP=664920273 file name=+DATA/rac11g/rac11g_ndmain_1_32g
datafile 7 switched to datafile copy
input datafile copy RECID=6 STAMP=664920273 file name=+DATA/rac11g/rac11g_ndmain_2_32g
datafile 8 switched to datafile copy
input datafile copy RECID=7 STAMP=664920273 file name=+DATA/rac11g/rac11g_ndmain_3_32g
datafile 9 switched to datafile copy
input datafile copy RECID=8 STAMP=664920273 file name=+DATA/rac11g/rac11g_ndmain_4_32g
datafile 10 switched to datafile copy
input datafile copy RECID=9 STAMP=664920273 file name=+DATA/rac11g/rac11g_ndmain_5_32g
datafile 11 switched to datafile copy
input datafile copy RECID=10 STAMP=664920273 file name=+DATA/rac11g/rac11g_ndmain_6_32g
datafile 12 switched to datafile copy
input datafile copy RECID=11 STAMP=664920273 file name=+DATA/rac11g/rac11g_undotbs1_2_32g
datafile 13 switched to datafile copy
input datafile copy RECID=12 STAMP=664920273 file name=+DATA/rac11g/rac11g_undotbs2_2_32g
datafile 14 switched to datafile copy
input datafile copy RECID=13 STAMP=664920273 file name=+DATA/rac11g/rac11g_perfstat_1_8g
contents of Memory Script:
{
set until scn 26685490;
recover
clone database
delete archivelog
;
}
executing Memory Script
executing command: SET until clause
Starting recover at 08-SEP-08
using channel ORA_AUX_DISK_1
starting media recovery
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of Duplicate Db command at 09/08/2008 20:04:35
RMAN-03015: error occurred in stored script Memory Script
RMAN-06053: unable to perform media recovery because of missing log
RMAN-06025: no backup of archived log for thread 2 with sequence 195 and starting SCN of 26685486 found to restore
RMAN-06025: no backup of archived log for thread 2 with sequence 194 and starting SCN of 26389813 found to restore
RMAN-06025: no backup of archived log for thread 2 with sequence 193 and starting SCN of 25222606 found to restore
RMAN-06025: no backup of archived log for thread 1 with sequence 531 and starting SCN of 26685489 found to restore
RMAN-06025: no backup of archived log for thread 1 with sequence 530 and starting SCN of 26685484 found to restore
RMAN-06025: no backup of archived log for thread 1 with sequence 529 and starting SCN of 26360675 found to restore
RMAN-06025: no backup of archived log for thread 1 with sequence 528 and starting SCN of 23863456 found to restore
这个时候只要将需要的日志拷贝到目标目录中,删除当前的SPFILE文件,重新启动AUXILIARY实例,再次执行DUPLICATE命令即可。
由于备份已经成功恢复,Oracle再次恢复的时候,会快速的跳过RESTORE步骤,继续进行RECOVER的操作。











