RMAN duplicate必須指定DBID的場景
RMAN duplicate 在dbname相同但dbid不同的情況下需要指定dbid,下面來模擬一下這個場景:
###先記錄當前資料庫的資訊並生成全庫備份
SYS@tstdb1-SQL> select dbid,name from v$database;
DBID NAME
---------- ---------
2030654775 TSTDB1
run
{
allocate channel d1 device type disk;
allocate channel d2 device type disk;
backup database include current controlfile format '/oradata06/dupuse/dbid/2030654775_%u';
}
alter system switch logfile;
alter system switch logfile;
alter system switch logfile;
alter system switch logfile;
SYS@tstdb1-SQL> archive log list
Database log mode Archive Mode
Automatic archival Enabled
Archive destination USE_DB_RECOVERY_FILE_DEST
Oldest online log sequence 3
Next log sequence to archive 5
Current log sequence 5
backup archivelog sequence between 1 and 4 format '/oradata06/dupuse/dbid/2030654775_arch_%u';
backup spfile format '/oradata06/dupuse/dbid/2030654775_spfile_%u';
###修改dbid
shutdown immediate
startup mount;
tstdb1@jq570322b:/home/tstdb1>nid target=SYS
DBNEWID: Release 11.2.0.3.0 - Production on Tue Jul 7 15:37:57 2015
Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.
Password:
Connected to database TSTDB1 (DBID=2030654775)
Connected to server version 11.2.0
Control Files in database:
/oradata06/testaaaaa/control01.ctl
/oradata06/testaaaaa/control02.ctl
Change database ID of database TSTDB1? (Y/[N]) => Y
Proceeding with operation
Changing database ID from 2030654775 to 2051793563
Control File /oradata06/testaaaaa/control01.ctl - modified
Control File /oradata06/testaaaaa/control02.ctl - modified
Datafile /oradata06/testaaaaa/system01.db - dbid changed
Datafile /oradata06/testaaaaa/sysaux01.db - dbid changed
Datafile /oradata06/testaaaaa/undotbs01.db - dbid changed
Datafile /oradata06/testaaaaa/users01.db - dbid changed
Datafile /oradata06/testaaaaa/ts0422_1.db - dbid changed
Datafile /oradata06/testaaaaa/xdbts1.db - dbid changed
Datafile /oradata06/testaaaaa/ts0212.db - dbid changed
Datafile /oradata06/testaaaaa/ts0212_1.db - dbid changed
Datafile /oradata06/testaaaaa/undotbs3.db - dbid changed
Datafile /oradata06/testaaaaa/temp01.db - dbid changed
Control File /oradata06/testaaaaa/control01.ctl - dbid changed
Control File /oradata06/testaaaaa/control02.ctl - dbid changed
Instance shut down
Database ID for database TSTDB1 changed to 2051793563.
All previous backups and archived redo logs for this database are unusable.
Database is not aware of previous backups and archived logs in Recovery Area.
Database has been shutdown, open database with RESETLOGS option.
Succesfully changed database ID.
DBNEWID - Completed succesfully.
###修改dbid後重新啟動資料庫
sqlplus '/as sysdba'
startup;
ORA-01589: must use RESETLOGS or NORESETLOGS option for database open
alter database open resetlogs;
SQL> select dbid,name from v$database;
DBID NAME
---------- ---------
2051793563 TSTDB1
##重新註冊到rman catalog
rman target / catalog rman/773946@tstdb2
register database;
##以TSTDB1為dbname的資料庫有兩個dbid=2030654775、dbid=2051793563
RMAN> list incarnation of database tstdb1;
List of Database Incarnations
DB Key Inc Key DB Name DB ID STATUS Reset SCN Reset Time
------- ------- -------- ---------------- --- ---------- ----------
91139 91164 TSTDB1 2030654775 PARENT 12723361876275 20150501 22:23:18
91139 91165 TSTDB1 2030654775 PARENT 12723361982201 20150502 17:26:40
91139 91166 TSTDB1 2030654775 ORPHAN 12723361982602 20150502 16:51:47
91139 91167 TSTDB1 2030654775 PARENT 12723361984663 20150621 08:02:54
91139 91168 TSTDB1 2030654775 ORPHAN 12723362036923 20150621 13:35:30
91139 91169 TSTDB1 2030654775 PARENT 12723362039102 20150621 16:03:46
91139 91170 TSTDB1 2030654775 PARENT 12723362040689 20150621 16:08:49
91139 91171 TSTDB1 2030654775 PARENT 12723362054987 20150622 19:55:12
91139 91172 TSTDB1 2030654775 PARENT 12723362144134 20150623 10:23:34
91139 91173 TSTDB1 2030654775 PARENT 12723362147001 20150623 10:40:47
91139 91174 TSTDB1 2030654775 PARENT 12723362149501 20150623 10:57:09
91139 91175 TSTDB1 2030654775 PARENT 12723362559613 20150625 09:36:10
91139 91140 TSTDB1 2030654775 PARENT 12723362562754 20150625 10:44:56
91139 92114 TSTDB1 2030654775 ORPHAN 12723363819873 20150705 05:41:37
91139 92839 TSTDB1 2030654775 PARENT 12723363828514 20150705 20:47:27
91139 93574 TSTDB1 2030654775 PARENT 12723363925695 20150706 15:53:03
91139 94928 TSTDB1 2030654775 PARENT 12723363946794 20150706 16:52:31
91139 96192 TSTDB1 2030654775 ORPHAN 12723363961836 20150706 20:47:37
91139 96787 TSTDB1 2030654775 ORPHAN 12723363961836 20150707 06:07:12
91139 98834 TSTDB1 2030654775 PARENT 12723363961836 20150707 10:17:24
91139 97635 TSTDB1 2030654775 ORPHAN 12723363961836 20150707 08:47:25
91139 97143 TSTDB1 2030654775 ORPHAN 12723363961948 20150707 06:23:30
91139 99343 TSTDB1 2030654775 CURRENT 12723363962276 20150707 15:25:41
99781 99804 TSTDB1 2051793563 PARENT 12723363962276 20150707 15:25:41
99781 99782 TSTDB1 2051793563 CURRENT 12723363963918 20150707 15:41:56
###對於dbid=2051793563的tstdb1進行db backup
backup database include current controlfile format '/oradata06/dupuse/dbid/2051793563_%u' spfile format '/oradata06/dupuse/dbid/2051793563_spfile_%u';
alter system switch logfile;
alter system switch logfile;
alter system switch logfile;
alter system switch logfile;
SQL> archive log list
Database log mode Archive Mode
Automatic archival Enabled
Archive destination USE_DB_RECOVERY_FILE_DEST
Oldest online log sequence 3
Next log sequence to archive 5
Current log sequence 5
backup archivelog sequence between 1 and 4 format '/oradata06/dupuse/dbid/2051793563_arch_%u';
###將/oradata06/dupuse/dbid目錄下的內容複製到149.110(dup db) 同名目錄下
。。。步驟略
附/oradata06/dupuse/dbid下的檔案列表
total 12884144
-rw-r----- 1 oracle oinstall 1353113600 Jul 07 15:29 2030654775_80qbf4tr
-rw-r----- 1 oracle oinstall 1928019968 Jul 07 15:29 2030654775_7vqbf4tr
-rw-r----- 1 oracle oinstall 14352384 Jul 07 15:29 2030654775_81qbf4uu
-rw-r----- 1 oracle oinstall 98304 Jul 07 15:29 2030654775_82qbf4v3
-rw-r----- 1 oracle oinstall 657408 Jul 07 15:32 2030654775_arch_83qbf53p
-rw-r----- 1 oracle oinstall 98304 Jul 07 15:34 2030654775_spfile_85qbf57r
-rw-r----- 1 oracle oinstall 3283673088 Jul 07 15:49 2051793563_86qbf61v
-rw-r----- 1 oracle oinstall 14385152 Jul 07 15:49 2051793563_87qbf63d
-rw-r----- 1 oracle oinstall 98304 Jul 07 15:49 2051793563_spfile_88qbf63f
-rw-r----- 1 oracle oinstall 2155008 Jul 07 15:53 2051793563_arch_89qbf6b7
//////////////////////////
//場景1:不連線target & catalog,指定backup location duplicate到dup db
//////////////////////////
--149.110(dup db)操作
rm $ORACLE_HOME/dbs/spfiledupdb3.ora
rm $ORACLE_HOME/dbs/initdupdb3.ora
export ORACLE_SID=dupdb3
export ORA_RMAN_SGA_TARGET=500
sqlplus '/as sysdba'
shutdown abort
rman target /
startup nomount
--149.208(執行duplicate的RMAN client主機)操作
rman auxiliary sys/asdf3_14@dupdb3
duplicate database tstdb1 to dupdb3 until time '20150707 15:52:16' db_file_name_convert='/oradata06/testaaaaa/','/oradata06/testccccc/' backup location '/oradata06/dupuse/dbid/' spfile set control_files '/oradata06/testccccc/control01.ctl','/oradata06/testccccc/control02.ctl' set log_file_name_convert '/oradata06/testaaaaa/','/oradata06/testccccc/';
。。。。
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 /oradata06/testccccc/system01.dbf
channel ORA_AUX_DISK_1: restoring datafile 00002 to /oradata06/testccccc/sysaux01.dbf
channel ORA_AUX_DISK_1: restoring datafile 00003 to /oradata06/testccccc/undotbs01.dbf
channel ORA_AUX_DISK_1: restoring datafile 00004 to /oradata06/testccccc/users01.dbf
channel ORA_AUX_DISK_1: restoring datafile 00005 to /oradata06/testccccc/ts0422_1.dbf
channel ORA_AUX_DISK_1: restoring datafile 00006 to /oradata06/testccccc/xdbts1.dbf
channel ORA_AUX_DISK_1: restoring datafile 00007 to /oradata06/testccccc/ts0212.dbf
channel ORA_AUX_DISK_1: restoring datafile 00008 to /oradata06/testccccc/ts0212_1.dbf
channel ORA_AUX_DISK_1: restoring datafile 00010 to /oradata06/testccccc/undotbs3.dbf
channel ORA_AUX_DISK_1: reading from backup piece /oradata06/dupuse/dbid/2051793563_86qbf61v
channel ORA_AUX_DISK_1: piece handle=/oradata06/dupuse/dbid/2051793563_86qbf61v tag=TAG20150707T154814
channel ORA_AUX_DISK_1: restored backup piece 1
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:45
Finished restore at 20150707 16:28:47
。。。
duplicate database tstdb1 to dupdb3 until time '20150707 15:35:50' db_file_name_convert='/oradata06/testaaaaa/','/oradata06/testccccc/' backup location '/oradata06/dupuse/dbid/' spfile set control_files '/oradata06/testccccc/control01.ctl','/oradata06/testccccc/control02.ctl' set log_file_name_convert '/oradata06/testaaaaa/','/oradata06/testccccc/';
。。。。
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 /oradata06/testccccc/system01.dbf
channel ORA_AUX_DISK_1: restoring datafile 00002 to /oradata06/testccccc/sysaux01.dbf
channel ORA_AUX_DISK_1: restoring datafile 00003 to /oradata06/testccccc/undotbs01.dbf
channel ORA_AUX_DISK_1: restoring datafile 00004 to /oradata06/testccccc/users01.dbf
channel ORA_AUX_DISK_1: restoring datafile 00005 to /oradata06/testccccc/ts0422_1.dbf
channel ORA_AUX_DISK_1: restoring datafile 00006 to /oradata06/testccccc/xdbts1.dbf
channel ORA_AUX_DISK_1: restoring datafile 00007 to /oradata06/testccccc/ts0212.dbf
channel ORA_AUX_DISK_1: restoring datafile 00008 to /oradata06/testccccc/ts0212_1.dbf
channel ORA_AUX_DISK_1: restoring datafile 00010 to /oradata06/testccccc/undotbs3.dbf
channel ORA_AUX_DISK_1: reading from backup piece /oradata06/dupuse/dbid/2030654775_7vqbf4tr
channel ORA_AUX_DISK_1: piece handle=/oradata06/dupuse/dbid/2030654775_7vqbf4tr tag=TAG20150707T152857
channel ORA_AUX_DISK_1: restored backup piece 1
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:55
Finished restore at 20150707 16:32:42
。。。
可以看出以backup location指定的備份檔案作為duplicate源頭的情況下,透過until time指定不同的時間能夠不用dbid也能篩選出target db,經過測試即使兩個db的備份時間有重疊RMAN會自動選擇其中一個,不會報錯
//////////////////////////
//場景2:僅連線catalog,執行duplicate
//////////////////////////
--149.110(dup db)操作
rm $ORACLE_HOME/dbs/spfiledupdb3.ora
rm $ORACLE_HOME/dbs/initdupdb3.ora
export ORACLE_SID=dupdb3
export ORA_RMAN_SGA_TARGET=500
sqlplus '/as sysdba'
shutdown abort
rman target /
startup nomount
--149.208(執行duplicate的RMAN client主機)操作
rman catalog rman/773946@tstdb2 auxiliary sys/asdf3_14@dupdb3
duplicate database tstdb1 to dupdb3 until sequence 3 db_file_name_convert='/oradata06/testaaaaa/','/oradata06/testccccc/' backup location '/oradata06/dupuse/dbid/' spfile set control_files '/oradata06/testccccc/control01.ctl','/oradata06/testccccc/control02.ctl' set log_file_name_convert '/oradata06/testaaaaa/','/oradata06/testccccc/';
Starting Duplicate Db at 20150707 16:39:08
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of Duplicate Db command at 07/07/2015 16:39:08
RMAN-05501: aborting duplication of target database
RMAN-12010: automatic channel allocation initialization failed
RMAN-06004: ORACLE error from recovery catalog database: RMAN-20005: target database name is ambiguous
***指定dbid
duplicate database tstdb1 dbid 2051793563 to dupdb3 until sequence 3 db_file_name_convert='/oradata06/testaaaaa/','/oradata06/testccccc/' backup location '/oradata06/dupuse/dbid/' spfile set control_files '/oradata06/testccccc/control01.ctl','/oradata06/testccccc/control02.ctl' set log_file_name_convert '/oradata06/testaaaaa/','/oradata06/testccccc/';
。。。
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 /oradata06/testccccc/system01.dbf
channel ORA_AUX_DISK_1: restoring datafile 00002 to /oradata06/testccccc/sysaux01.dbf
channel ORA_AUX_DISK_1: restoring datafile 00003 to /oradata06/testccccc/undotbs01.dbf
channel ORA_AUX_DISK_1: restoring datafile 00004 to /oradata06/testccccc/users01.dbf
channel ORA_AUX_DISK_1: restoring datafile 00005 to /oradata06/testccccc/ts0422_1.dbf
channel ORA_AUX_DISK_1: restoring datafile 00006 to /oradata06/testccccc/xdbts1.dbf
channel ORA_AUX_DISK_1: restoring datafile 00007 to /oradata06/testccccc/ts0212.dbf
channel ORA_AUX_DISK_1: restoring datafile 00008 to /oradata06/testccccc/ts0212_1.dbf
channel ORA_AUX_DISK_1: restoring datafile 00010 to /oradata06/testccccc/undotbs3.dbf
channel ORA_AUX_DISK_1: reading from backup piece /oradata06/dupuse/dbid/2051793563_86qbf61v
channel ORA_AUX_DISK_1: piece handle=/oradata06/dupuse/dbid/2051793563_86qbf61v tag=TAG20150707T154814
channel ORA_AUX_DISK_1: restored backup piece 1
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:45
Finished restore at 20150707 16:41:14
。。。
***不指定dbid,使用看似能區分出db的until time,依然報錯
duplicate database tstdb1 to dupdb3 until time '20150707 15:31:00' db_file_name_convert='/oradata06/testaaaaa/','/oradata06/testccccc/' backup location '/oradata06/dupuse/dbid/' spfile set control_files '/oradata06/testccccc/control01.ctl','/oradata06/testccccc/control02.ctl' set log_file_name_convert '/oradata06/testaaaaa/','/oradata06/testccccc/';
RMAN> duplicate database tstdb1 to dupdb3 until time '20150707 15:31:00' db_file_name_convert='/oradata06/testaaaaa/','/oradata06/testccccc/' backup location '/oradata06/dupuse/dbid/' spfile set control_files '/oradata06/testccccc/control01.ctl','/oradata06/testccccc/control02.ctl' set log_file_name_convert '/oradata06/testaaaaa/','/oradata06/testccccc/';
Starting Duplicate Db at 20150707 16:43:20
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of Duplicate Db command at 07/07/2015 16:43:20
RMAN-05501: aborting duplication of target database
RMAN-12010: automatic channel allocation initialization failed
RMAN-06004: ORACLE error from recovery catalog database: RMAN-20005: target database name is ambiguous
在connect catalog only的情況下如遇兩個dbname相同,必須使用dbid加以區別
###先記錄當前資料庫的資訊並生成全庫備份
SYS@tstdb1-SQL> select dbid,name from v$database;
DBID NAME
---------- ---------
2030654775 TSTDB1
run
{
allocate channel d1 device type disk;
allocate channel d2 device type disk;
backup database include current controlfile format '/oradata06/dupuse/dbid/2030654775_%u';
}
alter system switch logfile;
alter system switch logfile;
alter system switch logfile;
alter system switch logfile;
SYS@tstdb1-SQL> archive log list
Database log mode Archive Mode
Automatic archival Enabled
Archive destination USE_DB_RECOVERY_FILE_DEST
Oldest online log sequence 3
Next log sequence to archive 5
Current log sequence 5
backup archivelog sequence between 1 and 4 format '/oradata06/dupuse/dbid/2030654775_arch_%u';
backup spfile format '/oradata06/dupuse/dbid/2030654775_spfile_%u';
###修改dbid
shutdown immediate
startup mount;
tstdb1@jq570322b:/home/tstdb1>nid target=SYS
DBNEWID: Release 11.2.0.3.0 - Production on Tue Jul 7 15:37:57 2015
Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.
Password:
Connected to database TSTDB1 (DBID=2030654775)
Connected to server version 11.2.0
Control Files in database:
/oradata06/testaaaaa/control01.ctl
/oradata06/testaaaaa/control02.ctl
Change database ID of database TSTDB1? (Y/[N]) => Y
Proceeding with operation
Changing database ID from 2030654775 to 2051793563
Control File /oradata06/testaaaaa/control01.ctl - modified
Control File /oradata06/testaaaaa/control02.ctl - modified
Datafile /oradata06/testaaaaa/system01.db - dbid changed
Datafile /oradata06/testaaaaa/sysaux01.db - dbid changed
Datafile /oradata06/testaaaaa/undotbs01.db - dbid changed
Datafile /oradata06/testaaaaa/users01.db - dbid changed
Datafile /oradata06/testaaaaa/ts0422_1.db - dbid changed
Datafile /oradata06/testaaaaa/xdbts1.db - dbid changed
Datafile /oradata06/testaaaaa/ts0212.db - dbid changed
Datafile /oradata06/testaaaaa/ts0212_1.db - dbid changed
Datafile /oradata06/testaaaaa/undotbs3.db - dbid changed
Datafile /oradata06/testaaaaa/temp01.db - dbid changed
Control File /oradata06/testaaaaa/control01.ctl - dbid changed
Control File /oradata06/testaaaaa/control02.ctl - dbid changed
Instance shut down
Database ID for database TSTDB1 changed to 2051793563.
All previous backups and archived redo logs for this database are unusable.
Database is not aware of previous backups and archived logs in Recovery Area.
Database has been shutdown, open database with RESETLOGS option.
Succesfully changed database ID.
DBNEWID - Completed succesfully.
###修改dbid後重新啟動資料庫
sqlplus '/as sysdba'
startup;
ORA-01589: must use RESETLOGS or NORESETLOGS option for database open
alter database open resetlogs;
SQL> select dbid,name from v$database;
DBID NAME
---------- ---------
2051793563 TSTDB1
##重新註冊到rman catalog
rman target / catalog rman/773946@tstdb2
register database;
##以TSTDB1為dbname的資料庫有兩個dbid=2030654775、dbid=2051793563
RMAN> list incarnation of database tstdb1;
List of Database Incarnations
DB Key Inc Key DB Name DB ID STATUS Reset SCN Reset Time
------- ------- -------- ---------------- --- ---------- ----------
91139 91164 TSTDB1 2030654775 PARENT 12723361876275 20150501 22:23:18
91139 91165 TSTDB1 2030654775 PARENT 12723361982201 20150502 17:26:40
91139 91166 TSTDB1 2030654775 ORPHAN 12723361982602 20150502 16:51:47
91139 91167 TSTDB1 2030654775 PARENT 12723361984663 20150621 08:02:54
91139 91168 TSTDB1 2030654775 ORPHAN 12723362036923 20150621 13:35:30
91139 91169 TSTDB1 2030654775 PARENT 12723362039102 20150621 16:03:46
91139 91170 TSTDB1 2030654775 PARENT 12723362040689 20150621 16:08:49
91139 91171 TSTDB1 2030654775 PARENT 12723362054987 20150622 19:55:12
91139 91172 TSTDB1 2030654775 PARENT 12723362144134 20150623 10:23:34
91139 91173 TSTDB1 2030654775 PARENT 12723362147001 20150623 10:40:47
91139 91174 TSTDB1 2030654775 PARENT 12723362149501 20150623 10:57:09
91139 91175 TSTDB1 2030654775 PARENT 12723362559613 20150625 09:36:10
91139 91140 TSTDB1 2030654775 PARENT 12723362562754 20150625 10:44:56
91139 92114 TSTDB1 2030654775 ORPHAN 12723363819873 20150705 05:41:37
91139 92839 TSTDB1 2030654775 PARENT 12723363828514 20150705 20:47:27
91139 93574 TSTDB1 2030654775 PARENT 12723363925695 20150706 15:53:03
91139 94928 TSTDB1 2030654775 PARENT 12723363946794 20150706 16:52:31
91139 96192 TSTDB1 2030654775 ORPHAN 12723363961836 20150706 20:47:37
91139 96787 TSTDB1 2030654775 ORPHAN 12723363961836 20150707 06:07:12
91139 98834 TSTDB1 2030654775 PARENT 12723363961836 20150707 10:17:24
91139 97635 TSTDB1 2030654775 ORPHAN 12723363961836 20150707 08:47:25
91139 97143 TSTDB1 2030654775 ORPHAN 12723363961948 20150707 06:23:30
91139 99343 TSTDB1 2030654775 CURRENT 12723363962276 20150707 15:25:41
99781 99804 TSTDB1 2051793563 PARENT 12723363962276 20150707 15:25:41
99781 99782 TSTDB1 2051793563 CURRENT 12723363963918 20150707 15:41:56
###對於dbid=2051793563的tstdb1進行db backup
backup database include current controlfile format '/oradata06/dupuse/dbid/2051793563_%u' spfile format '/oradata06/dupuse/dbid/2051793563_spfile_%u';
alter system switch logfile;
alter system switch logfile;
alter system switch logfile;
alter system switch logfile;
SQL> archive log list
Database log mode Archive Mode
Automatic archival Enabled
Archive destination USE_DB_RECOVERY_FILE_DEST
Oldest online log sequence 3
Next log sequence to archive 5
Current log sequence 5
backup archivelog sequence between 1 and 4 format '/oradata06/dupuse/dbid/2051793563_arch_%u';
###將/oradata06/dupuse/dbid目錄下的內容複製到149.110(dup db) 同名目錄下
。。。步驟略
附/oradata06/dupuse/dbid下的檔案列表
total 12884144
-rw-r----- 1 oracle oinstall 1353113600 Jul 07 15:29 2030654775_80qbf4tr
-rw-r----- 1 oracle oinstall 1928019968 Jul 07 15:29 2030654775_7vqbf4tr
-rw-r----- 1 oracle oinstall 14352384 Jul 07 15:29 2030654775_81qbf4uu
-rw-r----- 1 oracle oinstall 98304 Jul 07 15:29 2030654775_82qbf4v3
-rw-r----- 1 oracle oinstall 657408 Jul 07 15:32 2030654775_arch_83qbf53p
-rw-r----- 1 oracle oinstall 98304 Jul 07 15:34 2030654775_spfile_85qbf57r
-rw-r----- 1 oracle oinstall 3283673088 Jul 07 15:49 2051793563_86qbf61v
-rw-r----- 1 oracle oinstall 14385152 Jul 07 15:49 2051793563_87qbf63d
-rw-r----- 1 oracle oinstall 98304 Jul 07 15:49 2051793563_spfile_88qbf63f
-rw-r----- 1 oracle oinstall 2155008 Jul 07 15:53 2051793563_arch_89qbf6b7
//////////////////////////
//場景1:不連線target & catalog,指定backup location duplicate到dup db
//////////////////////////
--149.110(dup db)操作
rm $ORACLE_HOME/dbs/spfiledupdb3.ora
rm $ORACLE_HOME/dbs/initdupdb3.ora
export ORACLE_SID=dupdb3
export ORA_RMAN_SGA_TARGET=500
sqlplus '/as sysdba'
shutdown abort
rman target /
startup nomount
--149.208(執行duplicate的RMAN client主機)操作
rman auxiliary sys/asdf3_14@dupdb3
duplicate database tstdb1 to dupdb3 until time '20150707 15:52:16' db_file_name_convert='/oradata06/testaaaaa/','/oradata06/testccccc/' backup location '/oradata06/dupuse/dbid/' spfile set control_files '/oradata06/testccccc/control01.ctl','/oradata06/testccccc/control02.ctl' set log_file_name_convert '/oradata06/testaaaaa/','/oradata06/testccccc/';
。。。。
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 /oradata06/testccccc/system01.dbf
channel ORA_AUX_DISK_1: restoring datafile 00002 to /oradata06/testccccc/sysaux01.dbf
channel ORA_AUX_DISK_1: restoring datafile 00003 to /oradata06/testccccc/undotbs01.dbf
channel ORA_AUX_DISK_1: restoring datafile 00004 to /oradata06/testccccc/users01.dbf
channel ORA_AUX_DISK_1: restoring datafile 00005 to /oradata06/testccccc/ts0422_1.dbf
channel ORA_AUX_DISK_1: restoring datafile 00006 to /oradata06/testccccc/xdbts1.dbf
channel ORA_AUX_DISK_1: restoring datafile 00007 to /oradata06/testccccc/ts0212.dbf
channel ORA_AUX_DISK_1: restoring datafile 00008 to /oradata06/testccccc/ts0212_1.dbf
channel ORA_AUX_DISK_1: restoring datafile 00010 to /oradata06/testccccc/undotbs3.dbf
channel ORA_AUX_DISK_1: reading from backup piece /oradata06/dupuse/dbid/2051793563_86qbf61v
channel ORA_AUX_DISK_1: piece handle=/oradata06/dupuse/dbid/2051793563_86qbf61v tag=TAG20150707T154814
channel ORA_AUX_DISK_1: restored backup piece 1
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:45
Finished restore at 20150707 16:28:47
。。。
duplicate database tstdb1 to dupdb3 until time '20150707 15:35:50' db_file_name_convert='/oradata06/testaaaaa/','/oradata06/testccccc/' backup location '/oradata06/dupuse/dbid/' spfile set control_files '/oradata06/testccccc/control01.ctl','/oradata06/testccccc/control02.ctl' set log_file_name_convert '/oradata06/testaaaaa/','/oradata06/testccccc/';
。。。。
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 /oradata06/testccccc/system01.dbf
channel ORA_AUX_DISK_1: restoring datafile 00002 to /oradata06/testccccc/sysaux01.dbf
channel ORA_AUX_DISK_1: restoring datafile 00003 to /oradata06/testccccc/undotbs01.dbf
channel ORA_AUX_DISK_1: restoring datafile 00004 to /oradata06/testccccc/users01.dbf
channel ORA_AUX_DISK_1: restoring datafile 00005 to /oradata06/testccccc/ts0422_1.dbf
channel ORA_AUX_DISK_1: restoring datafile 00006 to /oradata06/testccccc/xdbts1.dbf
channel ORA_AUX_DISK_1: restoring datafile 00007 to /oradata06/testccccc/ts0212.dbf
channel ORA_AUX_DISK_1: restoring datafile 00008 to /oradata06/testccccc/ts0212_1.dbf
channel ORA_AUX_DISK_1: restoring datafile 00010 to /oradata06/testccccc/undotbs3.dbf
channel ORA_AUX_DISK_1: reading from backup piece /oradata06/dupuse/dbid/2030654775_7vqbf4tr
channel ORA_AUX_DISK_1: piece handle=/oradata06/dupuse/dbid/2030654775_7vqbf4tr tag=TAG20150707T152857
channel ORA_AUX_DISK_1: restored backup piece 1
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:55
Finished restore at 20150707 16:32:42
。。。
可以看出以backup location指定的備份檔案作為duplicate源頭的情況下,透過until time指定不同的時間能夠不用dbid也能篩選出target db,經過測試即使兩個db的備份時間有重疊RMAN會自動選擇其中一個,不會報錯
//////////////////////////
//場景2:僅連線catalog,執行duplicate
//////////////////////////
--149.110(dup db)操作
rm $ORACLE_HOME/dbs/spfiledupdb3.ora
rm $ORACLE_HOME/dbs/initdupdb3.ora
export ORACLE_SID=dupdb3
export ORA_RMAN_SGA_TARGET=500
sqlplus '/as sysdba'
shutdown abort
rman target /
startup nomount
--149.208(執行duplicate的RMAN client主機)操作
rman catalog rman/773946@tstdb2 auxiliary sys/asdf3_14@dupdb3
duplicate database tstdb1 to dupdb3 until sequence 3 db_file_name_convert='/oradata06/testaaaaa/','/oradata06/testccccc/' backup location '/oradata06/dupuse/dbid/' spfile set control_files '/oradata06/testccccc/control01.ctl','/oradata06/testccccc/control02.ctl' set log_file_name_convert '/oradata06/testaaaaa/','/oradata06/testccccc/';
Starting Duplicate Db at 20150707 16:39:08
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of Duplicate Db command at 07/07/2015 16:39:08
RMAN-05501: aborting duplication of target database
RMAN-12010: automatic channel allocation initialization failed
RMAN-06004: ORACLE error from recovery catalog database: RMAN-20005: target database name is ambiguous
***指定dbid
duplicate database tstdb1 dbid 2051793563 to dupdb3 until sequence 3 db_file_name_convert='/oradata06/testaaaaa/','/oradata06/testccccc/' backup location '/oradata06/dupuse/dbid/' spfile set control_files '/oradata06/testccccc/control01.ctl','/oradata06/testccccc/control02.ctl' set log_file_name_convert '/oradata06/testaaaaa/','/oradata06/testccccc/';
。。。
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 /oradata06/testccccc/system01.dbf
channel ORA_AUX_DISK_1: restoring datafile 00002 to /oradata06/testccccc/sysaux01.dbf
channel ORA_AUX_DISK_1: restoring datafile 00003 to /oradata06/testccccc/undotbs01.dbf
channel ORA_AUX_DISK_1: restoring datafile 00004 to /oradata06/testccccc/users01.dbf
channel ORA_AUX_DISK_1: restoring datafile 00005 to /oradata06/testccccc/ts0422_1.dbf
channel ORA_AUX_DISK_1: restoring datafile 00006 to /oradata06/testccccc/xdbts1.dbf
channel ORA_AUX_DISK_1: restoring datafile 00007 to /oradata06/testccccc/ts0212.dbf
channel ORA_AUX_DISK_1: restoring datafile 00008 to /oradata06/testccccc/ts0212_1.dbf
channel ORA_AUX_DISK_1: restoring datafile 00010 to /oradata06/testccccc/undotbs3.dbf
channel ORA_AUX_DISK_1: reading from backup piece /oradata06/dupuse/dbid/2051793563_86qbf61v
channel ORA_AUX_DISK_1: piece handle=/oradata06/dupuse/dbid/2051793563_86qbf61v tag=TAG20150707T154814
channel ORA_AUX_DISK_1: restored backup piece 1
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:45
Finished restore at 20150707 16:41:14
。。。
***不指定dbid,使用看似能區分出db的until time,依然報錯
duplicate database tstdb1 to dupdb3 until time '20150707 15:31:00' db_file_name_convert='/oradata06/testaaaaa/','/oradata06/testccccc/' backup location '/oradata06/dupuse/dbid/' spfile set control_files '/oradata06/testccccc/control01.ctl','/oradata06/testccccc/control02.ctl' set log_file_name_convert '/oradata06/testaaaaa/','/oradata06/testccccc/';
RMAN> duplicate database tstdb1 to dupdb3 until time '20150707 15:31:00' db_file_name_convert='/oradata06/testaaaaa/','/oradata06/testccccc/' backup location '/oradata06/dupuse/dbid/' spfile set control_files '/oradata06/testccccc/control01.ctl','/oradata06/testccccc/control02.ctl' set log_file_name_convert '/oradata06/testaaaaa/','/oradata06/testccccc/';
Starting Duplicate Db at 20150707 16:43:20
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of Duplicate Db command at 07/07/2015 16:43:20
RMAN-05501: aborting duplication of target database
RMAN-12010: automatic channel allocation initialization failed
RMAN-06004: ORACLE error from recovery catalog database: RMAN-20005: target database name is ambiguous
在connect catalog only的情況下如遇兩個dbname相同,必須使用dbid加以區別
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/53956/viewspace-1725981/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- 全場景智慧:新工業革命必須擁抱的晨曦
- Oracle 設定指定DBIDOracle
- RMAN duplicate databaseDatabase
- rman duplicate clone庫的尷尬
- 通過rman duplicate database!Database
- RMAN duplicate On Windows7Windows
- 必讀:常見場景的加密選擇加密
- rman duplicate操作手冊
- RMAN duplicate database到新主機Database
- Nginx主要應用場景(必讀)Nginx
- 年輕人必須理解的
- 思考是必須的
- Oracle rman duplicate遷移測試Oracle
- RMAN DUPLICATE建立DataGuard物理備庫
- rman duplicate搭建第二個 dg
- 使用RMAN建立Duplicate資料庫資料庫
- 【轉】RMAN建立duplicate資料庫資料庫
- 【RMAN】使用RMAN duplicate複製同機資料庫資料庫
- 使用rman的命令duplicate複製資料庫資料庫
- rman中三個不完全恢復場景
- 你必須知道的 SmartSql !SQL
- 【RMAN】使用RMAN duplicate複製同機資料庫遇到的問題資料庫
- DG rman duplicate 複製庫錯誤
- Oracle 11g Rman Active database duplicateOracleDatabase
- RMAN duplicate 建立standby RAC資料庫資料庫
- RMAN學習筆記_ Duplicate建立DataGuard筆記
- RMAN學習筆記_ Duplicate重做DataGuard筆記
- RMAN DUPLICATE/RESTORE/RECOVER 混合平臺支援REST
- 12C PDB使用RMAN的4種完全恢復場景
- 阿里巴巴為什麼讓初始化集合時必須指定大小?阿里
- Git中~你必須掌握的!Git
- 必須懂的mysql知識MySql
- 你必須『收藏』的Github技巧Github
- 你必須收藏的Github技巧Github
- Java Annotation 必須掌握的特性Java
- 【RMAN】使用duplicate本地複製資料庫資料庫
- duplicate rman複製資料庫技術資料庫
- Oracle11g RMAN Duplicate from Active DatabaseOracleDatabase