扫二维码与项目经理沟通
我们在微信上24小时期待你的声音
解答本文疑问/技术咨询/运营咨询/技术建议/互联网交流
Oracle Database Link连接错误
成都创新互联公司是一家专业提供顺河企业网站建设,专注与网站设计制作、成都做网站、H5网站设计、小程序制作等业务。10年已为顺河众多企业、政府机构等服务。创新互联专业网站建设公司优惠进行中。
案例环境:
NODE1:
操作系统: Linux EL5
Oracle: Oracle 10gR2
NODE2:
操作系统: Linux EL5
Oracle: Oracle 11gR2
案例:
在node1创建到node的database link:
[oracle@rh65 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 10 14 rows selected.
@至此,问题得以解决!
我们在微信上24小时期待你的声音
解答本文疑问/技术咨询/运营咨询/技术建议/互联网交流