当前位置:Gxlcms > mysql > 使用数据链时报错ORA-12545/TNS-12545的重现和解决

使用数据链时报错ORA-12545/TNS-12545的重现和解决

时间:2021-07-01 10:21:17 帮助过:29人阅读

使用数据链时报错ORA-12545/TNS-12545的重现和解决

1. 查看 tnsnames.ora中条目 :

linux_dblk =

(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = linux.linuxidc.com)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = linux)
)
)
/etc/hosts中不写linux.linuxidc.com与IP的对应,,也无法通过DNS得到linux.linuxidc.com的IP。

2.创建数据链并使用

linuxidc@ linuxidcrac1>create database link linux_db connect to test9 identified by test9 using 'linux_dblk';
Database link created.

此时使用DBLINK: 执行了很长时间,报错:ORA-12545:Connect failed because target host or object does not exist
21:42:57 linuxidc@ linuxidcrac1>select * from test9@linux_DB;
select * from test9@linux_DB
*
ERROR at line 1:
ORA-12545: Connect failed because target host or object does not exist
Elapsed: 00:02:40.25
###########3

3.查看日志中报错信息:

[Oracle@linuxidcrac1 ~]$ cat alert_linuxidcrac1.log
创建和使用数据链时会有类似如下报错日志: --截取部分
Sat Dec 28 21:41:29 2013
***********************************************************************
Fatal NI connect error 12545, connecting to:
(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=racdg)(PORT=1521))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=racdg)(CID=(PROGRAM=oracle)(HOST=linuxidcrac1.linuxidc.com)(USER=oracle))))

VERSION INFORMATION:
TNS for Linux: Version 11.2.0.1.0 - Production
TCP/IP NT Protocol Adapter for Linux: Version 11.2.0.1.0 - Production
Time: 28-DEC-2013 21:41:29
Tracing not turned on.
Tns error struct:
ns main err code: 12545

TNS-12545: Connect failed because target host or object does not exist
ns secondary err code: 12560
nt main err code: 515

TNS-00515: Connect failed because target host or object does not exist
nt secondary err code: 110
nt OS err code: 0
###########

4.解决方法:

/etc/hosts中增加相应条目:

192.168.1.211 linux.linuxidc.com linux
ping linux.linuxidc.com 测试正常。

linuxidc@ linuxidcrac1>select * from test9@linux_db;
AA
----------
dblink-ok ---此时重新登陆数据库,使用数据链正常:

相关阅读:

Oracle ORA-01555 快照过旧 说明

ORA-01078 和 LRM-00109 报错解决方法

ORA-01555超长的Query Duration时间

ORA-00471 处理方法笔记

ORA-00314,redolog 损坏,或丢失处理方法

ORA-00257 归档日志过大导致无法存储的解决办法

linux

人气教程排行