ITPub博客

【RMAN】使用RMAN的Duplicate功能创建物理DataGuard报错(ORA-17627、ORA-17629)处理

原创 Linux操作系统 作者:secooler 时间:2012-04-25 22:56:24 3 删除 编辑
  这是一个“貌似简单,实则不然”的报错排查处理过程。不要被表面现象所蒙蔽。
  在使用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 --

请登录后发表评论 登录
全部评论
Oracle ACE 总监,OCM联盟(ocmu.org)创始人,恩墨学院(enmoedu.com)创始人,ITPUB Oracle专题深入讨论版版主,资深Oracle数据库专家,北京大学理学硕士,获Oracle OCM 10g 11g认证,ACOUG核心成员,DATAGURU专家团成员,Blogger。Good luck.

注册时间:2008-03-16

  • 博文量
    797
  • 访问量
    7853071