Oracle Database Link连接错误

来源:互联网 发布:网络餐饮存在的问题 编辑:程序博客网 时间:2024/05/06 13:54

Oracle Database Link连接错误

案例环境:

NODE1:

操作系统: Linux EL5

Oracle:   Oracle 10gR2

NODE2:

操作系统: Linux EL5

Oracle:   Oracle 11gR2


案例:

    在node1创建到node的database link:

[oracle@rh55 admin]$ sqlplus '/as sysdba'

SQL*Plus: Release 10.2.0.1.0 - Production on Tue Jul 8 16:45:01 2014

Copyright (c) 1982, 2005, Oracle.  All rights reserved.

Connected to:

Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production

With the Partitioning, OLAP and Data Mining options


16:45:02 SYS@ test1asm>create public database link prod

16:45:15   2  connect to scott identified by tiger using 'prod2';

Database link created.

   在连接node2时出现以下错误:

17:32:00 SYS@ test1asm>select * from emp@prod;

select * from emp@prod

                  *

ERROR at line 1:

ORA-01017: invalid username/password; logon denied

ORA-02063: preceding line from PROD

--用户名和密码连接错误

1、确认在node2上的用户名、密码没有问题。

2、tnsnames配置没有问题

PROD2 =

  (DESCRIPTION =

    (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.8.24)(PORT = 1521))

    (CONNECT_DATA =

      (SERVER = DEDICATED)

      (SERVICE_NAME = prod)

    )

  )

解决方法:

在创建db-link时,将用户密码用“”引起!

17:37:21 SYS@ test1asm>create public database link prod

17:38:12   2  connect to scott identified by "tiger" using 'prod2';

Database link created.


17:38:23 SYS@ test1asm>select * from emp@prod;

   

 EMPNO ENAME      JOB              MGR HIREDATE         SAL       COMM     DEPTNO---------- ---------- --------- ---------- --------- ---------- ---------- ----------      7369 SMITH      CLERK           7902 17-DEC-80        800                    20      7499 ALLEN      SALESMAN        7698 20-FEB-81       1600        300         30      7521 WARD       SALESMAN        7698 22-FEB-81       1250        500         30      7566 JONES      MANAGER         7839 02-APR-81       2975                    20      7654 MARTIN     SALESMAN        7698 28-SEP-81       1250       1400         30      7698 BLAKE      MANAGER         7839 01-MAY-81       2850                    30      7782 CLARK      MANAGER         7839 09-JUN-81       2450                    10      7788 SCOTT      ANALYST         7566 19-APR-87       3000                    20      7839 KING       PRESIDENT            17-NOV-81       5000                    10      7844 TURNER     SALESMAN        7698 08-SEP-81       1500          0         30      7876 ADAMS      CLERK           7788 23-MAY-87       1100                    20      7900 JAMES      CLERK           7698 03-DEC-81        950                    30      7902 FORD       ANALYST         7566 03-DEC-81       3000                    20      7934 MILLER     CLERK           7782 23-JAN-82       1300                    1014 rows selected.


 @至此,问题得以解决!



本文出自 “天涯客的blog” 博客,请务必保留此出处http://tiany.blog.51cto.com/513694/1436341

0 0