RAC資料庫建立STANDBY(三)

yangtingkun發表於2009-05-27

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

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

這章記錄一下STANDBY資料庫建立過程中碰到的問題。

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

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

 

 

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

最開始為了減少麻煩,打算採用SPFILE的方式,並且利用FROM ACTIVE DATABASE,這樣可以不用讀取備份集:

bash-3.00$ rman target sys/test@172.0.2.54/rac11g.us.oracle.com auxiliary /

恢復管理器: Release 11.1.0.6.0 - Production on 星期二 9 9 14:58:19 2008

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

連線到目標資料庫: RAC11G (DBID=1712482917)
已連線到輔助資料庫: RAC11G (未裝載)

RMAN> duplicate target database for standby
2> db_file_name_convert '/dev/vx/rdsk/datavg', '+DATA/RAC11G'
3> dorecover
4> from active database
5> spfile
6> parameter_value_convert '/dev/vx/rdsk/datavg', '+DATA/RAC11G'
7> set log_file_name_convert '/dev/vx/rdsk/datavg', '+DATA/RAC11G'
8> set log_archive_dest_1='LOCATION=+DATA/RAC11G'
9> ;

啟動 Duplicate Db 09-9 -08
使用目標資料庫控制檔案替代恢復目錄
分配的通道: ORA_AUX_DISK_1
通道 ORA_AUX_DISK_1: SID=112 裝置型別=DISK
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: Duplicate Db
命令 ( 09/09/2008 14:58:26 ) 失敗
RMAN-06217:
未使用 Net 服務名連線到輔助資料庫

這個RMAN-6217錯誤居然在metalink上都找不到,不過好在錯誤的描述比較清晰,只需要透過連線服務名的方式連線輔助例項即可。

繼續嘗試:

bash-3.00$ rman target sys/test@172.0.2.54/rac11g.us.oracle.com auxiliary sys/test@rac11g1

恢復管理器: Release 11.1.0.6.0 - Production on 星期二 9 9 15:16:52 2008

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

連線到目標資料庫: RAC11G (DBID=1712482917)
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-00554:
內部恢復管理器程式包初始化失敗
RMAN-04006:
來自輔助資料庫的錯誤: ORA-12514: TNS: 監聽程式當前無法識別連線描述符中請求的服務

不過這裡引發一個問題,由於10g以上預設採用動態註冊,由於資料庫沒有啟動,因此動態註冊無法啟用,沒有辦法透過服務名連線,只能手工編輯一個SID列表,新增到listener.ora檔案中:

SID_LIST_LISTENER =
  (SID_LIST =
    (SID_DESC =
      (SID_NAME = rac11g1)
      (ORACLE_HOME = /data/oracle/product/11.1/database)
    )
  )

下面重啟監聽:

$ lsnrctl stop

LSNRCTL for Solaris: Version 11.1.0.6.0 - Production on 09-9 -2008 15:20:43

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

正在連線到 (ADDRESS=(PROTOCOL=tcp)(HOST=)(PORT=1521))
命令執行成功
$ lsnrctl start

LSNRCTL for Solaris: Version 11.1.0.6.0 - Production on 09-9 -2008 15:20:55

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

啟動/data/oracle/product/11.1/database/bin/tnslsnr: 請稍候...

TNSLSNR for Solaris: Version 11.1.0.6.0 - Production
系統引數檔案為/data/oracle/product/11.1/database/network/admin/listener.ora
寫入/data/oracle/diag/tnslsnr/ser1/listener/alert/log.xml的日誌資訊
監聽: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=ser1)(PORT=1521)))

正在連線到 (ADDRESS=(PROTOCOL=tcp)(HOST=)(PORT=1521))
LISTENER
STATUS
------------------------
別名                      LISTENER
版本                      TNSLSNR for Solaris: Version 11.1.0.6.0 - Production
啟動日期                  09-9-2008 15:20:55
正常執行時間              0 0 小時 0 0
跟蹤級別                  off
安全性                    ON: Local OS Authentication
SNMP                      OFF
監聽程式引數檔案          /data/oracle/product/11.1/database/network/admin/listener.ora
監聽程式日誌檔案          /data/oracle/diag/tnslsnr/ser1/listener/alert/log.xml
監聽端點概要...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=ser1)(PORT=1521)))
服務摘要..
服務 "rac11g1" 包含 1 個例程。
 
例程 "rac11g1", 狀態 UNKNOWN, 包含此服務的 1 個處理程式...
命令執行成功

再次連線錯誤依舊,這是由於預設配置的RAC環境的TNSNAMES中的服務名對當前不適用,新增一個新的服務名:

RAC11G1_S =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = 172.0.2.62)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SID = rac11g1)
    )
  )

再次連線,報錯沒有許可權:

bash-3.00$ rman target sys/test@172.0.2.54/rac11g.us.oracle.com auxiliary sys/test@rac11g1_s

恢復管理器: Release 11.1.0.6.0 - Production on 星期二 9 9 15:30:17 2008

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

連線到目標資料庫: RAC11G (DBID=1712482917)
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-00554:
內部恢復管理器程式包初始化失敗
RMAN-04006:
來自輔助資料庫的錯誤: ORA-01031: insufficient privileges

最簡單的辦法是複製源資料庫的初始化引數檔案到當前的節點的$ORACLE_HOME/dbs目錄中,複製完成後,終於可以成功連線RMAN

bash-3.00$ rman target sys/test@172.0.2.54/rac11g.us.oracle.com auxiliary sys/test@rac11g1_s

恢復管理器: Release 11.1.0.6.0 - Production on 星期二 9 9 15:37:02 2008

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

連線到目標資料庫: RAC11G (DBID=1712482917)
已連線到輔助資料庫: RAC11G (未裝載)

執行DUPLICATE時報錯:

RMAN> duplicate target database for standby
2> db_file_name_convert '/dev/vx/rdsk/datavg', '+DATA/RAC11G'
3> dorecover
4> from active database
5> spfile
6> parameter_value_convert '/dev/vx/rdsk/datavg', '+DATA/RAC11G'
7> set log_file_name_convert '/dev/vx/rdsk/datavg', '+DATA/RAC11G'
8> set log_archive_dest_1='LOCATION=+DATA/RAC11G'
9> ;

啟動 Duplicate Db 09-9 -08
使用目標資料庫控制檔案替代恢復目錄
分配的通道: ORA_AUX_DISK_1
通道 ORA_AUX_DISK_1: SID=37 裝置型別=DISK
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: Duplicate Db
命令 ( 09/09/2008 15:38:01 ) 失敗
RMAN-06764: Must specify db_unique_name with FOR STANDBY

由於DUPLICATE建立STANDBY的時候會根據命令中指定的引數和源資料庫的引數建立出STANDBY資料庫的初始化引數,因此這裡需要指明DB_UNIQUE_NAME引數,如此之外,應該把所有STANDBY資料庫使用的引數配置完成。

除此之外,應該保證STANDBY資料庫中配置了源資料庫服務名RAC11G,而源資料庫中配置了STANDBY資料庫服務名RAC11G_S

再次執行DUPLICATE操作:

RMAN> duplicate target database for standby
2> db_file_name_convert '/dev/vx/rdsk/datavg', '+DATA/RAC11G'
3> dorecover
4> from active database
5> spfile
6> parameter_value_convert '/dev/vx/rdsk/datavg', '+DATA/RAC11G'
7> set log_file_name_convert '/dev/vx/rdsk/datavg', '+DATA/RAC11G'
8> set fal_client='RAC11G_S'
9> set fal_server='RAC11G'
10> set log_archive_dest_1='LOCATION=+DATA/RAC11G VALID_FOR=(ALL_LOGFILES,ALL_ROLES) DB_UNIQUE_NAME=rac11g_s'
11> set log_archive_dest_2='SERVICE=rac11g LGWR ASYNC VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=rac11g'
12> set standby_archive_dest='+DATA/RAC11G'
13> set db_unique_name='rac11g_s'
14> ;

啟動 Duplicate Db 09-9 -08
使用通道 ORA_AUX_DISK_1

記憶體指令碼的內容:
{
   backup as copy reuse
   file  '/data/oracle/product/11.1/database/dbs/orapwrac11g2' auxiliary format
 '/data/oracle/product/11.1/database/dbs/orapwrac11g1'   file
 '/dev/vx/rdsk/datavg/rac11g_spfile' auxiliary format
 '+DATA/rac11g/spfilerac11g.ora'   ;
   sql clone "alter system set spfile= ''+DATA/rac11g/spfilerac11g.ora''";
}
正在執行記憶體指令碼

啟動 backup 09-9 -08
分配的通道: ORA_DISK_1
通道 ORA_DISK_1: SID=484 例項=rac11g2 裝置型別=DISK
DBGANY:     Mismatched message length! [16:06:39.742] (krmiduem)
DBGANY:     Mismatched message length! [16:06:39.744] (krmiduem)
MAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-00601: fatal error in recovery manager
RMAN-03004:
執行命令期間出現嚴重錯誤
RMAN-00600: internal error, arguments [3045] [] [] [] []
RMAN-03009: backup
命令 (ORA_DISK_1 通道上, 09/09/2008 16:06:39 ) 失敗
ORA-17629:
無法連線到遠端資料庫伺服器
ORA-17627: ORA-12154: TNS:
無法解析指定的連線識別符號
ORA-17629:
無法連線到遠端資料庫伺服器

這個錯誤是由於配置源資料庫時沒有使用VIP地址,而指定了一個例項的PUBLIC地址,這裡應該使用VIP,確保RMAN可以同時連線到兩個例項上:

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 16:11:23 2008

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

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

RMAN> duplicate target database for standby
2> db_file_name_convert '/dev/vx/rdsk/datavg', '+DATA/RAC11G'
3> dorecover
4> from active database
5> spfile
6> parameter_value_convert '/dev/vx/rdsk/datavg', '+DATA/RAC11G'
7> set log_file_name_convert '/dev/vx/rdsk/datavg', '+DATA/RAC11G'
8> set fal_client='RAC11G_S'
9> set fal_server='RAC11G'
10> set log_archive_dest_1='LOCATION=+DATA/RAC11G VALID_FOR=(ALL_LOGFILES,ALL_ROLES) DB_UNIQUE_NAME=rac11g_s'
11> set log_archive_dest_2='SERVICE=rac11g LGWR ASYNC VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=rac11g'
12> set standby_archive_dest='+DATA/RAC11G'
13> set db_unique_name='rac11g_s'
;
14>
Starting Duplicate Db at 09-SEP-08
using target database control file instead of recovery catalog
allocated channel: ORA_AUX_DISK_1
channel ORA_AUX_DISK_1: SID=38 device type=DISK

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'   file
 '/dev/vx/rdsk/datavg/rac11g_spfile' auxiliary format
 '+DATA/rac11g/spfilerac11g.ora'   ;
   sql clone "alter system set spfile= ''+DATA/rac11g/spfilerac11g.ora''";
}
executing Memory Script

Starting backup at 09-SEP-08
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=611 instance=rac11g1 device type=DISK
RMAN-03009: failure of backup command on ORA_DISK_1 channel at 09/09/2008 16:11:41
ORA-17629: Cannot connect to the remote database server
ORA-17627: ORA-12154: TNS:could not resolve the connect identifier specified
ORA-17629: Cannot connect to the remote database server
continuing other job steps, job failed will not be re-run
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of Duplicate Db command at 09/09/2008 16:11:41
RMAN-03015: error occurred in stored script. Memory Script
RMAN-03009: failure of backup command on ORA_DISK_1 channel at 09/09/2008 16:11:41
ORA-17629: Cannot connect to the remote database server
ORA-17627: ORA-12154: TNS:could not resolve the connect identifier specified
ORA-17629: Cannot connect to the remote database server

採用本地配置的LOAD_BALANCE服務名,仍然出現上面的錯誤,看來最好的方式還是透過ALLOCATE CHANNEL的方式手工分配CHANNEL

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 16:17:44 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;
6> allocate auxiliary channel ac2 device type disk;
7> duplicate target database for standby
8> db_file_name_convert '/dev/vx/rdsk/datavg', '+DATA/RAC11G'
9> dorecover
10> from active database
11> spfile
12> parameter_value_convert '/dev/vx/rdsk/datavg', '+DATA/RAC11G'
13> set log_file_name_convert '/dev/vx/rdsk/datavg', '+DATA/RAC11G'
14> set fal_client='RAC11G_S'
15> set fal_server='RAC11G'
16> set log_archive_dest_1='LOCATION=+DATA/RAC11G VALID_FOR=(ALL_LOGFILES,ALL_ROLES) DB_UNIQUE_NAME=rac11g_s'
17> set log_archive_dest_2='SERVICE=rac11g LGWR ASYNC VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=rac11g'
18> set standby_archive_dest='+DATA/RAC11G'
19> set db_unique_name='rac11g_s';
20> }

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

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

allocated channel: ac1
channel ac1: SID=39 device type=DISK

allocated channel: ac2
channel ac2: SID=36 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'   file
 '/dev/vx/rdsk/datavg/rac11g_spfile' auxiliary format
 '+DATA/rac11g/spfilerac11g.ora'   ;
   sql clone "alter system set spfile= ''+DATA/rac11g/spfilerac11g.ora''";
}
executing Memory Script

Starting backup at 09-SEP-08
RMAN-03009: failure of backup command on c1 channel at 09/09/2008 16:18:44
ORA-17629: Cannot connect to the remote database server
ORA-17627: ORA-12154: TNS:could not resolve the connect identifier specified
ORA-17629: Cannot connect to the remote database server
continuing other job steps, job failed will not be re-run
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 16:18:44
RMAN-03015: error occurred in stored script. Memory Script
RMAN-03009: failure of backup command on c2 channel at 09/09/2008 16:18:44
ORA-17629: Cannot connect to the remote database server
ORA-17627: ORA-12154: TNS:could not resolve the connect identifier specified
ORA-17629: Cannot connect to the remote database server

RMAN> exit


Recovery Manager complete.

這個錯誤是由於遠端配置的tnsnames.ora中存在問題,嘗試在源資料庫連線目標資料庫環境也報錯ORA-12154,增加RAC11G1_S服務名後,問題解決:

RAC11G1_S =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = 172.0.2.62)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SID = rac11g1)
    )
  )

由於錯誤太多,只能在下一篇文章中繼續描述。

 

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

相關文章