ORA-01017: invalid username/password; logon denied

ORACLE 10.2.0.1中创建到 Oracle 11.2.0.3.0 的DBLINK 时遇到下述错误:

ORA-01017: invalid username/password; logon denied
ORA-02063: preceding line from TEST_167

 

创建dblink使用的用户/密码是正确的。

SQL> conn scott/tiger@orcl
Connected to Oracle Database 11g Enterprise Edition Release 11.2.0.3.0
Connected as acsprd


创建dblink的数据库版本:

SQL> select * from V$VERSION;
BANNER
----------------------------------------------------------------
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - 64bi
PL/SQL Release 10.2.0.1.0 - Production
CORE 10.2.0.1.0 Production

TNS for Linux: Version 10.2.0.1.0 - Production
NLSRTL Version 10.2.0.1.0 - Production

 

ORACLE 10.2.0.1中创建到 Oracle 11.2.0.3.0 的DBLINK,创建成功

SQL>  create database link test_167
  2    connect to scott
  3      identified by tiger
  4    using '(DESCRIPTION =
  5      (ADDRESS_LIST =
  6        (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.0.167)(PORT = 1521))
  7      )
  8      (CONNECT_DATA =
  9        (SERVER = DEDICATED)
 10        (SID = orcl)
 11      )
 12    )';
 

但使用dblink去访问目标数据库时出错
QL> select sysdate from dual@test_167;
select sysdate from dual@test_167

ORA-01017: invalid username/password; logon denied
ORA-02063: preceding line from TEST_167

 

网上说是密码区分大小写的缘故,需要在11g中重新设置大写的密码。如果测试环境还好,生产环境怎么能随便改密码呢?

尝试在创建dblink时用“”把密码引起来。

SQL>  create database link test_167
  2    connect to scott
  3      identified by "tiger"
  4    using '(DESCRIPTION =
  5      (ADDRESS_LIST =
  6        (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.0.167)(PORT = 1521))
  7      )
  8      (CONNECT_DATA =
  9        (SERVER = DEDICATED)
 10        (SID = orcl)
 11      )
 12    )';

Database link created

 

SQL> alter session set nls_date_format='yyyy-mm-dd hh24:mi:ss';

Session altered

SQL> col sysdate for  a20;
SQL> select sysdate from dual@test_167;

SYSDATE
---------------------------
2012-6-18 22:48:52

测试OK.

 

参考文章:Bug 6738104: ORA-01017 ORA-02063 WHILE CONNECTING FROM 10G TO 11G VIA PUBLIC DBLINK

Cause
The following Bug 6738104 was logged for this issue which was closed as not a bug saying the cause being introduction of password case sensitivity feature in 11g
When one creates a database link connection, a user name and password for the connection needs to be defined. When the database link is created, the password is case sensitive. Before a user can connect from a pre-release 11g database to a 11g release database and as the password case sensitivity is enabled by default, you must re-create the password for this database link using all uppercase letters.
The reason you need to re-create the password using all uppercase letters is so that it will match how Oracle Database stores database link passwords. Oracle Database always stores this type of password in uppercase letters, even if the password had originally been created using lower or mixed case letters. If case sensitivity is disabled, the user can enter the password using the case the password was created in.

你可能感兴趣的:(oracle,sql,数据库,session,user,database)