RAC資料庫建立STANDBY(六)

yangtingkun發表於2009-05-30

這篇文章描述為RAC環境建立STANDBY資料庫。

由於篇幅限制,加上碰到了很多的bug,只能將文章拆分成多篇。

由於錯誤太多,導致一篇文章無法完全記錄下來,建立STANDBY資料庫問題彙總的第四部分。

RAC資料庫建立STANDBY(一):http://yangtingkun.itpub.net/post/468/484988

RAC資料庫建立STANDBY(二):http://yangtingkun.itpub.net/post/468/485013

RAC資料庫建立STANDBY(三):http://yangtingkun.itpub.net/post/468/485054

RAC資料庫建立STANDBY(四):http://yangtingkun.itpub.net/post/468/485090

RAC資料庫建立STANDBY(五):http://yangtingkun.itpub.net/post/468/485121

 

剛剛在進行RAC環境的DUPLICATE DATABASE的時候,就碰到了很多問題,由於二者命令比較相似,本來認為這次不會碰到太多的問題,沒有想到的是,這次碰到的問題居然比DUPLICATE碰到的問題多出一倍。而且基本上所有碰到的問題都是DUPLICATE操作時不曾遇到的。

bash-3.00$ rman target sys/test@rac11g1 auxiliary sys/test@rac11g1_s

Recovery Manager: Release 11.1.0.6.0 - Production on Tue Sep 9 18:54:07 2008

Copyright (c) 1982, 2007, Oracle.  All rights reserved.

connected to target database: RAC11G (DBID=1712482917)
connected to auxiliary database: RAC11G (not mounted)

RMAN> run
2> {
3> allocate channel c1 device type disk connect sys/test@rac11g1;
4> allocate channel c2 device type disk connect sys/test@rac11g2;
5> allocate auxiliary channel ac1 device type disk connect sys/test@rac11g1_s;
6> allocate auxiliary channel ac2 device type disk connect sys/test@rac11g1_s;
7> duplicate target database for standby
8> dorecover
9> from active database;
10> }

using target database control file instead of recovery catalog
allocated channel: c1
channel c1: SID=621 instance=rac11g1 device type=DISK

allocated channel: c2
channel c2: SID=254 instance=rac11g2 device type=DISK

allocated channel: ac1
channel ac1: SID=325 instance=rac11g1 device type=DISK

allocated channel: ac2
channel ac2: SID=324 instance=rac11g1 device type=DISK

Starting Duplicate Db at 09-SEP-08

contents of Memory Script.:
{
   backup as copy reuse
   file  '/data/oracle/product/11.1/database/dbs/orapwrac11g1' auxiliary format
 '/data/oracle/product/11.1/database/dbs/orapwrac11g1'   ;
}
executing Memory Script

Starting backup at 09-SEP-08
Finished backup at 09-SEP-08

contents of Memory Script.:
{
   backup as copy current controlfile for standby auxiliary format  '+DATA/rac11g/rac11g_control_1';
   restore clone controlfile to  '+DATA/rac11g/rac11g_control_2' from
 '+DATA/rac11g/rac11g_control_1';
   restore clone controlfile to  '+DATA/rac11g/rac11g_control_3' from
 '+DATA/rac11g/rac11g_control_1';
   sql clone 'alter database mount standby database';
}
executing Memory Script

Starting backup at 09-SEP-08
channel c1: starting datafile copy
copying standby control file
output file name=/data/oracle/product/11.1/database/dbs/snapcf_rac11g1.f tag=TAG20080909T184849 RECID=5 STAMP=665002130
channel c1: datafile copy complete, elapsed time: 00:00:03
Finished backup at 09-SEP-08

Starting restore at 09-SEP-08

channel c1: no AUTOBACKUP in 7 days found
channel c2: no AUTOBACKUP in 7 days found
channel ac1: skipped, AUTOBACKUP already found
channel ac2: skipped, AUTOBACKUP already found
channel clone_default: copied control file copy
Finished restore at 09-SEP-08

Starting restore at 09-SEP-08

channel c1: no AUTOBACKUP in 7 days found
channel c2: no AUTOBACKUP in 7 days found
channel ac1: skipped, AUTOBACKUP already found
channel ac2: skipped, AUTOBACKUP already found
channel clone_default: copied control file copy
Finished restore at 09-SEP-08

sql statement: alter database mount standby database

contents of Memory Script.:
{
   set newname for tempfile  1 to
 "+DATA/rac11g/rac11g_temp_1_4g";
   set newname for tempfile  2 to
 "+DATA/rac11g/rac11g_temp_2_16g";
   switch clone tempfile all;
   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";
   backup as copy reuse
   datafile  1 auxiliary format
 "+DATA/rac11g/rac11g_system_1_1g"   datafile
 2 auxiliary format
 "+DATA/rac11g/rac11g_sysaux_1_1g"   datafile
 3 auxiliary format
 "+DATA/rac11g/rac11g_undotbs1_1_4g"   datafile
 4 auxiliary format
 "+DATA/rac11g/rac11g_undotbs2_1_4g"   datafile
 5 auxiliary format
 "+DATA/rac11g/rac11g_users_1_4g"   datafile
 6 auxiliary format
 "+DATA/rac11g/rac11g_ndmain_1_32g"   datafile
 7 auxiliary format
 "+DATA/rac11g/rac11g_ndmain_2_32g"   datafile
 8 auxiliary format
 "+DATA/rac11g/rac11g_ndmain_3_32g"   datafile
 9 auxiliary format
 "+DATA/rac11g/rac11g_ndmain_4_32g"   datafile
 10 auxiliary format
 "+DATA/rac11g/rac11g_ndmain_5_32g"   datafile
 11 auxiliary format
 "+DATA/rac11g/rac11g_ndmain_6_32g"   datafile
 12 auxiliary format
 "+DATA/rac11g/rac11g_undotbs1_2_32g"   datafile
 13 auxiliary format
 "+DATA/rac11g/rac11g_undotbs2_2_32g"   datafile
 14 auxiliary format
 "+DATA/rac11g/rac11g_perfstat_1_8g"   ;
   sql 'alter system archive log current';
}
executing Memory Script

executing command: SET NEWNAME

executing command: SET NEWNAME

renamed tempfile 1 to +DATA/rac11g/rac11g_temp_1_4g in control file
renamed tempfile 2 to +DATA/rac11g/rac11g_temp_2_16g in control file

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 backup at 09-SEP-08
channel c1: starting datafile copy
input datafile file number=00009 name=/dev/vx/rdsk/datavg/rac11g_ndmain_4_32g
channel c2: starting datafile copy
input datafile file number=00010 name=/dev/vx/rdsk/datavg/rac11g_ndmain_5_32g
RMAN-03009: failure of backup command on c1 channel at 09/09/2008 18:55:34
ORA-19504: failed to create file "+DATA/rac11g/rac11g_ndmain_4_32g"
channel c1 disabled, job failed on it will be run on another channel
RMAN-03009: failure of backup command on c2 channel at 09/09/2008 18:55:34
ORA-19504: failed to create file "+DATA/rac11g/rac11g_ndmain_5_32g"
channel c2 disabled, job failed on it will be run on another channel
released channel: c1
released channel: c2
released channel: ac1
released channel: ac2
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of Duplicate Db command at 09/09/2008 18:55:34
RMAN-03015: error occurred in stored script. Memory Script

這個錯誤是所有錯誤之中最另人鬱悶的,馬上就要成功了,沒想到碰到了這個錯誤。查詢了metalink,發現有不少ORA-19504錯誤,但是都和當前問題不完全一致。不過可以肯定一點,問題肯定和ASM有關。

經過再三的測試,發現似乎是由於源資料庫發出的連線無法在ASM上恢復資料檔案造成的。回想前面碰到的SPFILE的問題,感覺這種FROM ACTIVE DATABASE方式的STANDBY建立方法,如果STANDBY資料庫選擇了ASM方式儲存,那麼會導致源資料庫的連線無法在ASM上面恢復資料庫。

由於metalink上沒有詳細的描述,而且Oracle的錯誤提示資訊也十分有限,所以到這一步暫時沒有辦法繼續恢復了。而唯一的方法就是繞過這個問題,於是後面的測試又回到了使用備份檔案進行STANDBY建立的過程。

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 Wed Sep 10 09:53:12 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: RAC11G (not mounted)

RMAN> run
2> {
3> allocate channel c1 device type disk connect sys/test@rac11g1;
4> allocate channel c2 device type disk connect sys/test@rac11g2;
5> allocate auxiliary channel ac1 device type disk connect sys/test@rac11g1_s;
6> allocate auxiliary channel ac2 device type disk connect sys/test@rac11g1_s;
7> duplicate target database for standby
8> dorecover;
9> }

allocated channel: c1
channel c1: SID=285 instance=rac11g1 device type=DISK

allocated channel: c2
channel c2: SID=104 instance=rac11g2 device type=DISK

allocated channel: ac1
channel ac1: SID=307 instance=rac11g1 device type=DISK

allocated channel: ac2
channel ac2: SID=306 instance=rac11g1 device type=DISK

Starting Duplicate Db at 10-SEP-08

contents of Memory Script.:
{
   set until scn  29148537;
   restore clone standby controlfile;
   sql clone 'alter database mount standby database';
}
executing Memory Script

executing command: SET until clause

Starting restore at 10-SEP-08

channel ac1: restoring control file
ORA-19625: error identifying file /data/oracle/product/11.1/database/dbs/snapcf_rac11g1.f
ORA-27037: unable to obtain file status
SVR4 Error: 2: No such file or directory
Additional information: 3
ORA-19600: input file is control file  (/data/oracle/product/11.1/database/dbs/snapcf_rac11g1.f)
ORA-19601: output file is control file  (+DATA/rac11g/rac11g_control_1)

failover to previous backup

channel ac1: starting datafile backup set restore
channel ac1: restoring control file
channel ac1: reading from backup piece /data/oracle/product/11.1/database/dbs/09jq63m1_1_1
channel ac1: ORA-19870: error while restoring backup piece /data/oracle/product/11.1/database/dbs/09jq63m1_1_1
ORA-19505: failed to identify file "/data/oracle/product/11.1/database/dbs/09jq63m1_1_1"
ORA-27037: unable to obtain file status
SVR4 Error: 2: No such file or directory
Additional information: 3

failover to previous backup

channel ac1: starting datafile backup set restore
channel ac1: restoring control file
channel ac1: reading from backup piece /data/01jpk0bj_1_1
channel ac1: ORA-19870: error while restoring backup piece /data/01jpk0bj_1_1
ORA-19505: failed to identify file "/data/01jpk0bj_1_1"
ORA-27037: unable to obtain file status
SVR4 Error: 2: No such file or directory
Additional information: 3

failover to previous backup

released channel: c1
released channel: c2
released channel: ac1
released channel: ac2
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of Duplicate Db command at 09/10/2008 09:53:45
RMAN-03015: error occurred in stored script. Memory Script
RMAN-06026: some targets not found - aborting restore
RMAN-06024: no backup or copy of the control file found to restore

終於是最後一個問題了,這個問題其實是在測試DUPLICATE時碰到了,由於Oracle要根據源資料庫備份集的路徑,在STANDBY資料庫的相同位置尋找備份集,所以報錯找不到指定的備份集。

只需要根據前面介紹的方法,透過CATALOG方式,編輯CATALOG資料庫中BACKUP_PIECE的位置,來騙過Oracle

具體的方法這裡就不重複了,可以參考下面的文章:http://yangtingkun.itpub.net/post/468/471421

沒有想到,建立STANDBY過程,準備加上建立指令碼寫了一篇文章,後期的檢查和整理寫了一篇文章,而碰到的問題卻足足寫了四篇。

當然原因是多方面的,RAC環境部署STANDBY相對比較複雜,而且利用DUPLICATE進行STANDBY的建立以前做的也不多。加上FROM ACTIVE DATABASE11g的新特性,一些bug在所難免,在加上ASM的眾多bug,想不碰到問題都比較困難。不過其中一個很重要的原因在於,STANDBYPRIMARY資料庫的物理儲存方式不等同,如果採用相同的配置,可能問題會相對少一些。

 

 

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/4227/viewspace-604487/,如需轉載,請註明出處,否則將追究法律責任。

相關文章