RAC資料庫建立STANDBY(五)

yangtingkun發表於2009-05-29

這篇文章描述為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環境的DUPLICATE DATABASE的時候,就碰到了很多問題,由於二者命令比較相似,本來認為這次不會碰到太多的問題,沒有想到的是,這次碰到的問題居然比DUPLICATE碰到的問題多出一倍。而且基本上所有碰到的問題都是DUPLICATE操作時不曾遇到的。

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

Recovery Manager: Release 11.1.0.6.0 - Production on Tue Sep 9 17:38:58 2008

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

connected to target database: RAC11G (DBID=1712482917)
connected to auxiliary database: RAC11GS (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=236 instance=rac11g2 device type=DISK

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

allocated channel: ac2
channel ac2: SID=307 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/orapwrac11g2' auxiliary format
 '/data/oracle/product/11.1/database/dbs/orapwrac11g1'   ;
}
executing Memory Script

Starting backup at 09-SEP-08
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 17:39:16
RMAN-03015: error occurred in stored script. Memory Script
RMAN-03009: failure of backup command on c1 channel at 09/09/2008 17:39:16
ORA-19505: failed to identify file "/data/oracle/product/11.1/database/dbs/orapwrac11g2"
ORA-27037: unable to obtain file status
SVR4 Error: 2: No such file or directory
Additional information: 3

RMAN> exit


Recovery Manager complete.

這個錯誤前面已經提到了,是由於連線到RAC的不同例項造成的,第一次採用了在本地建立一個orapwrac11g2的連結,指向裸裝置上的密碼問題。由於Oracle讀取裸裝置上面的密碼檔案錯誤,所以前面刪除了兩個連結,並將裸裝置上面的密碼檔案複製到本地。因此這個錯誤又重現了,下面直接使用RAC11G1服務名,連線指定的例項,從根本上避免這個錯誤的產生:

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 17:40:41 2008

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

connected to target database: RAC11G (DBID=1712482917)
connected to auxiliary database: RAC11GS (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=619 instance=rac11g1 device type=DISK

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

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

allocated channel: ac2
channel ac2: SID=333 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=TAG20080909T173509 RECID=2 STAMP=664997710
channel c1: datafile copy complete, elapsed time: 00:00:07
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
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 17:41:41
RMAN-03015: error occurred in stored script. Memory Script
RMAN-03009: failure of sql command on clone_default channel at 09/09/2008 17:41:41
RMAN-11003: failure during parse/execution of SQL statement: alter database mount standby database
ORA-01103: database name 'RAC11G' in control file is not 'RAC11GS'

RMAN> exit


Recovery Manager complete.

這個錯誤是由於手誤造成的,建立SPFILE的時候,PFILE檔案指定了前面測試DUPLICATE時候建立的PFILE,導致DB_NAME名稱錯誤。

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:31:45 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=278 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=TAG20080909T182613 RECID=3 STAMP=665000774
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
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:32:43
RMAN-05501: aborting duplication of target database
RMAN-05001: auxiliary file name /dev/vx/rdsk/datavg/rac11g_perfstat_1_8g conflicts with a file used by the target database
RMAN-05001: auxiliary file name /dev/vx/rdsk/datavg/rac11g_undotbs2_2_32g conflicts with a file used by the target database
RMAN-05001: auxiliary file name /dev/vx/rdsk/datavg/rac11g_undotbs1_2_32g conflicts with a file used by the target database
RMAN-05001: auxiliary file name /dev/vx/rdsk/datavg/rac11g_ndmain_6_32g conflicts with a file used by the target database
RMAN-05001: auxiliary file name /dev/vx/rdsk/datavg/rac11g_ndmain_5_32g conflicts with a file used by the target database
RMAN-05001: auxiliary file name /dev/vx/rdsk/datavg/rac11g_ndmain_4_32g conflicts with a file used by the target database
RMAN-05001: auxiliary file name /dev/vx/rdsk/datavg/rac11g_ndmain_3_32g conflicts with a file used by the target database
RMAN-05001: auxiliary file name /dev/vx/rdsk/datavg/rac11g_ndmain_2_32g conflicts with a file used by the target database
RMAN-05001: auxiliary file name /dev/vx/rdsk/datavg/rac11g_ndmain_1_32g conflicts with a file used by the target database
RMAN-05001: auxiliary file name /dev/vx/rdsk/datavg/rac11g_users_1_4g conflicts with a file used by the target database
RMAN-05001: auxiliary file name /dev/vx/rdsk/datavg/rac11g_undotbs2_1_4g conflicts with a file used by the target database
RMAN-05001: auxiliary file name /dev/vx/rdsk/datavg/rac11g_undotbs1_1_4g conflicts with a file used by the target database
RMAN-05001: auxiliary file name /dev/vx/rdsk/datavg/rac11g_sysaux_1_1g conflicts with a file used by the target database
RMAN-05001: auxiliary file name /dev/vx/rdsk/datavg/rac11g_system_1_1g conflicts with a file used by the target database

RMAN> exit


Recovery Manager complete.

這個錯誤是剛才錯誤的繼續,重新編輯PFILE的時候,漏掉了初始化引數db_file_name_convertlog_file_name_convert。使得RMAN在建立資料檔案的時候沒有透過源資料庫與目標資料庫檔名稱是否相同的檢查。

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:39:10 2008

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

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

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> db_file_name_convert '/dev/vx/rdsk/datavg', '+DATA/RAC11G';
11> }

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

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

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

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

Starting Duplicate Db at 09-SEP-08
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:39:21
RMAN-05500: the auxiliary database must be not mounted when issuing a DUPLICATE command

RMAN> exit


Recovery Manager complete.

這個錯誤就很簡單了,AUXILIARY例項必須處於NOMOUNT狀態,而剛才中途失敗的DUPLICATE FOR STANDBY命令已經將資料庫處於MOUNT狀態,因此需要重新將例項置為NOMOUNT狀態。

終於快將碰到的問題都記錄完了,不過篇幅所限,剩下的仍然需要下一篇繼續。

 

 

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

相關文章