有同事在从10g建db link到11g时,没有报错,但通过db link连接时报错如下:
ORA-01017: invalid username/password; logon denied
ORA-02063: preceding line from <link_name>
根据ORA-01017的提示是连接到另一方的用户密码错误,于是直接使用配置的用户密码登录数据库发现正常登录。
对加密Hash的反查询得出正确密码,得知原因是当9i或10g的版本的Oracle连接11g的时,会自动将密码转化为大写。查阅oracle的官方文档解释如下(其实是个BUG):
Bug 6738104: ORA-01017 ORA-02063 WHILE CONNECTING FROM10G TO 11G VIA PUBLIC DBLINK
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.
解决办法:
如果11g的数据库用户的密码是小写字母,将其改成大写,然后再去用10g去连接,这个方法太过卑劣,影响也比较大不考虑使用。
linux安装oracle 11g∙ 将密码用双引号引起来。如 identified by "test"
  我们将dblink 的创建语句稍微改写即可,如下:
  create public database link DB_TEST
  connect to test  identified by "test"
  using '….';
不过有关于oracle密码大小写的问题,跟Haier争论过一次,结果是没说服她。。。
下面是冗长的实验部分(摘自Dave的实验),无兴趣的同学直接忽略吧,后面有来自oracle官方的结论。
—————————————————————————————————————————————————————————————————————————————————
我们知道可以用orapwd来创建密码文件,我们看下这里面的参数:
C: >orapwd
Usage: orapwd file=<fname>entries=<users> force=<y/n> ignorecase=<y/n>nosysdba=<y/
n>
where
  file - name of password file (required),
  password - password for SYS will be prompted if not specified at commandline,
  entries - maximum number of distinct DBA (optional),
  force - whether to overwrite existing file (optional),
  ignorecase - passwords are case-insensitive (optional),
  nosysdba - whether to shut out the SYSDBA logon (optional Database Vaultonly).
There must be no spaces around the equal-to (=) character.
这个是口令文件创建命令的参数说明, 这里我们看一个参数:
ignorecase - passwords are case-insensitive (optional),
这个参数用来指定大小写是否敏感,而默认情况是insentive, 即不敏感,所以对于Oracle10g的数据库,默认情况下,密码是不区分大小写的。但是在Oracle 10g中,我们无法使用这个参数,在后续的测试用有说明。虽然口令文件里只保存具有SYSDBA和OPER权限的用户,但是其他用户也会受影响。
这里我们在Oracle 10g上做一个测试,为了避免OS认证的影响,我们这里可以禁用OS认证。
SQL> select * from v$version;
BANNER
----------------------------------------------------------------
Oracle Database 10g Enterprise EditionRelease 10.2.0.5.0 - 64bi
PL/SQL Release 10.2.0.5.0 - Production
CORE  10.2.0.5.0    Production
TNS for Linux: Version 10.2.0.5.0 -Production
NLSRTL Version 10.2.0.5.0 - Production
--创建2个测试用户:
SQL> create user test1 identified byTest;
User created.
SQL> create user test2 identified byTest;
User created.
SQL> grant connect,resource to test1;
Grant succeeded.
SQL> grant connect,resource to test2;
Grant succeeded.
SQL> grant sysdba,sysoper to test1;
Grant succeeded.
SQL> select * from v$pwfile_users;
USERNAME                SYSDB SYSOP
------------------------------ ----- -----
SYS                            TRUE  TRUE
TEST1                      TRUE TRUE
SQL> conn test1/test;
Connected.
SQL> conn test2/test;
Connected.
SQL> conn test1/test;         
Connected.
SQL> conn test1/test1;
ERROR:
ORA-01017: invalid username/password; logondenied
Warning: You are no longer connected toORACLE.
从这里可以看出,在Oracle 10g下,密码是不分大小写。这里我们可以继续测试:
我们将sysdba 权限从test1用户revoke,然后测试:
SQL> conn / as sysdba;
Connected.
SQL> revoke sysdba,sysoper from test1;
Revoke succeeded.
SQL> select * from v$pwfile_users;
USERNAME                    SYSDB SYSOP
-
----------------------------- ----- -----
SYS                            TRUE TRUE
我们继续使用test1进行测试:
SQL> conn test1/test;
Connected.
SQL> conn test1/test1;
ERROR:
ORA-01017: invalid username/password; logondenied
Warning: You are no longer connected toORACLE.
从这里我们可以看出,只是简单的revoke 并不能解决问题,我们重建一个口令文件,然后测试一下看看:
rac2:/u02/app/oracle/product/10.2.0/db_1/dbs>orapwd file=orapwanqing password=oracle force=y;

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。