Oracle环境:oracle 10.2 ?创建的 public dblink 连接 oracle 11.2时由于版本不一致有时会出现以下错误
?
ORA-01017: invalid username/password; logon denied ORA-02063: preceding line from <link_name>
?一.创建dblink
create database link DblinkName connect to username identified by password using '(DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = 10.150.181.83)(PORT = 1521)) ) (CONNECT_DATA = (SERVICE_NAME= ORCL) )
? )';
?二.创建dblink 后使用时提示如下错误:
select * from app_user@DZHYJ_TZ
?
?
三、问题分析:
?
根据ORA-01017的提示是连接到另一方的用户密码错误,于是直接使用配置的用户密码(lsxy/lsxy)登录数据库发现正常登录,进一步的查看建立好后的dblink 语句,其中用户名都转化为了大写,由此猜测密码是否也被转化为了大写从而导致密码错误。根据猜测百度了下,确实有这种情况。当9i或10g的版本的Oracle数据库连接11g的版本时,会自动将密码转化为大写。
四、解决办法:
?我们将dblink 的创建语句稍微改写即可,如下:
将密码用双引号引起来
create database link DblinkName connect to username identified by "password" using '(DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = 10.150.181.83)(PORT = 1521)) ) (CONNECT_DATA = (SERVICE_NAME= ORCL) )
?
?