【RMAN】使用RMAN的Duplicate功能建立物理DataGuard報錯(ORA-17627、ORA-17629)處理

xulongxc發表於2015-06-15
  這是一個“貌似簡單,實則不然”的報錯排查處理過程。不要被表面現象所矇蔽。
  在使用RMAN的Active Database Duplicate建立物理DataGuard是丟擲ORA-17627和ORA-17629錯誤,RMAN環境下的詳細報錯資訊如下:
  ORA-17627: ORA-01017: invalid username/password; logon denied
  ORA-17629: Cannot connect to the remote database server

  千萬不要以為是由於輸入了錯誤的使用者名稱和密碼導致的,而是因為“沒有輸入使用者名稱和密碼”。且看我的分解。


1.資料庫版本資訊
SYS@PROD> select * from v$version;

BANNER
----------------------------------------------------------------------
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
PL/SQL Release 11.2.0.1.0 - Production
CORE    11.2.0.1.0      Production
TNS for Linux: Version 11.2.0.1.0 - Production
NLSRTL Version 11.2.0.1.0 - Production

2.再現問題現象
1)建立物理備庫的RMAN指令碼如下
  注意此指令碼本身不存在任何問題。
duplicate target database
for standby
from active database
DORECOVER
spfile
set db_unique_name='SBDB'
set log_archive_dest_1='location=/u01/app/oracle/arch/SBDB'
set log_archive_dest_2='service=PROD async lgwr register valid_for=(online_logfile,primary_role) db_unique_name=PROD'
set standby_file_management='AUTO'
set fal_server='PROD'
set fal_client='SBDB'
set control_files='/u01/app/oracle/oradata/SBDB/control1.ctl','/u01/app/oracle/oradata/SBDB/control2.ctl'
set db_file_name_convert='PROD','SBDB'
set log_file_name_convert='PROD','SBDB'
set memory_target='0'
set sga_target='400M';

2)確認當前ORACLE_SID內容
PROD@secdb /home/oracle$ echo $ORACLE_SID
PROD

3)連線到AUXILIARY輔助例項建立物理備庫
PROD@secdb /home/oracle$ rman target / auxiliary sys/oracle@sbdb

Recovery Manager: Release 11.2.0.1.0 - Production on Wed Apr 25 20:36:53 2012

Copyright (c) 1982, 2009, Oracle and/or its affiliates.  All rights reserved.

connected to target database: PROD (DBID=193323522)
connected to auxiliary database: PROD (not mounted)

RMAN>

RMAN> duplicate target database
2> for standby
from active database
3> 4> DORECOVER
5> spfile
6> set db_unique_name='SBDB'
7> set log_archive_dest_1='location=/u01/app/oracle/arch/SBDB'
8> set log_archive_dest_2='service=PROD async lgwr register valid_for=(online_logfile                              ,primary_role) db_unique_name=PROD'
set standby_file_management='AUTO'
9> 10> set fal_server='PROD'
11> set fal_client='SBDB'
set control_files='/u01/app/oracle/oradata/SBDB/control1.ctl','/u01/app/oracle/oradat                              a/SBDB/control2.ctl'
12> 13> set db_file_name_convert='PROD','SBDB'
14> set log_file_name_convert='PROD','SBDB'
set memory_target='0'
15> 16> set sga_target='400M';

Starting Duplicate Db at 20120425 20:37:26
using target database control file instead of recovery catalog
allocated channel: ORA_AUX_DISK_1
channel ORA_AUX_DISK_1: SID=135 device type=DISK

contents of Memory Script.:
{
   backup as copy reuse
   targetfile  '/u01/app/oracle/product/11.2.0/db_1/dbs/orapwPROD' auxiliary format
 '/u01/app/oracle/product/11.2.0/db_1/dbs/orapwSBDB'   targetfile
 '/u01/app/oracle/product/11.2.0/db_1/dbs/spfilePROD.ora' auxiliary format
 '/u01/app/oracle/product/11.2.0/db_1/dbs/spfileSBDB.ora'   ;
   sql clone "alter system set spfile= ''/u01/app/oracle/product/11.2.0/db_1/dbs/spfi                              leSBDB.ora''";
}
executing Memory Script

Starting backup at 20120425 20:37:27
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=196 device type=DISK
RMAN-03009: failure of backup command on ORA_DISK_1 channel at 04/25/2012 20:37:28
ORA-17629: Cannot connect to the remote database server
ORA-17627: ORA-01017: invalid username/password; logon denied
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 04/25/2012 20:37:29
RMAN-03015: error occurred in stored script. Memory Script
RMAN-03009: failure of backup command on ORA_DISK_1 channel at 04/25/2012 20:37:29
ORA-17629: Cannot connect to the remote database server
ORA-17627: ORA-01017: invalid username/password; logon denied
ORA-17629: Cannot connect to the remote database server

RMAN> exit


Recovery Manager complete.

4)RMAN執行過程中報錯資訊內容
RMAN-03009: failure of backup command on ORA_DISK_1 channel at 04/25/2012 20:37:28
ORA-17629: Cannot connect to the remote database server
ORA-17627: ORA-01017: invalid username/password; logon denied
ORA-17629: Cannot connect to the remote database server
continuing other job steps, job failed will not be re-run

3.問題原因
  報錯資訊的確夠直白:“無效的使用者名稱/密碼,禁止登陸”。
  這種報錯,直接定格到登陸的那一瞬間,命令如下:
PROD@secdb /home/oracle$ rman target / auxiliary sys/oracle@sbdb

  正常理解的,這裡貌似沒有問題,前一部分“target /”表明使用作業系統認證的方式登入PROD資料庫例項,後一半部分“auxiliary sys/oracle@sbdb”表明使用密碼檔案方式進行驗證。並且,命令列提示資訊上顯示也已經成功登陸。因此這個報錯資訊很是詭異。

  如果繼續對比這兩部分的登入方式,問題最有可能出現在前一部分,因為使用的是預設行為方式;另外後半部分是天衣無縫的。最終的原因的確出在這裡,在使用Oracle的Active Database Duplicate功能建立物理DataGuard的過程中,連線target資料庫必須“顯式地指定密碼”,即使是使用作業系統認證方式登入。

4.問題處理
  原因找到後,處理本身就是水到渠成的事情。
  正確的連線方式如下:
$ rman target sys/oracle@prod auxiliary sys/oracle@sbdb

  OK,到此問題便完美的處理完畢了,直接執行後續的RMAN命令即可。

5.小結
  這個問題處理過程告訴我們DBA一個道理,不要被表面現象所矇蔽,有些提示資訊是直白可信的,但是有些提示資訊需要我們冷靜的思考多種可能的原因,然後再一一嘗試排查,必將有柳暗花明之日。


Good luck.

secooler
12.04.25

-- The End --

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

相關文章