oracle11g ora 12545,sqlplus本地登录报错ORA-12545

在客户服务器上尝试登录数据库是碰到错误。

步骤如下:

> sqlplus /nolog

SQL*Plus: Release 10.2.0.1.0 - Production ON Thu Nov 17 17:24:16 2011

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

SQL> conn / AS sysdba

ERROR:

ORA-12545: CONNECT failed because target host OR object does NOT exist

SQL> conn USER/password

ERROR:

ORA-12545: CONNECT failed because target host OR object does NOT exist

SQL> conn USER/password@100.300.100.200/db

Connected.

> sqlplus /nolog

SQL*Plus: Release 10.2.0.1.0 - Production on Thu Nov 17 17:24:16 2011

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

SQL> conn / as sysdba

ERROR:

ORA-12545: Connect failed because target host or object does not exist

SQL> conn user/password

ERROR:

ORA-12545: Connect failed because target host or object does not exist

SQL> conn user/password@100.300.100.200/db

Connected.

尝试连接本地的数据库,结果出现了ORA-12545错误,尝试通过网络方式连接,反而没有碰到问题。这说明数据库本身是正常的,而本地无法连接,显示是本地设置出现了问题。

检查了环境变量的设置,包括ORACLE_SID、ORACLE_HOME和PATH,都未发现任何异常,再次尝试连接数据库:

> sqlplus USER/password@100.300.100.200/db

SQL*Plus: Release 10.2.0.1.0 - Production ON Thu Nov 17 17:26:54 2011

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

Connected TO:

Oracle9i Enterprise Edition Release 9.2.0.4.0 - 64bit Production

WITH the Partitioning, OLAP AND Oracle DATA Mining options

JServer Release 9.2.0.4.0 - Production

SQL> exit

Disconnected FROM Oracle9i Enterprise Edition Release 9.2.0.4.0 - 64bit Production

WITH the Partitioning, OLAP AND Oracle DATA Mining options

JServer Release 9.2.0.4.0 - Production

> sqlplus user/password@100.300.100.200/db

SQL*Plus: Release 10.2.0.1.0 - Production on Thu Nov 17 17:26:54 2011

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

Connected to:

Oracle9i Enterprise Edition Release 9.2.0.4.0 - 64bit Production

With the Partitioning, OLAP and Oracle Data Mining options

JServer Release 9.2.0.4.0 - Production

SQL> exit

Disconnected from Oracle9i Enterprise Edition Release 9.2.0.4.0 - 64bit Production

With the Partitioning, OLAP and Oracle Data Mining options

JServer Release 9.2.0.4.0 - Production

这次同样连接到数据库,但是由于连接方式和第一次的不同,通过Oracle提示的信息找到了错误的原因。

首先尝试的简易连接方式是10g的新特性,而且从sqlplus的工具版本信息也可以看得出,sqlplus是10.2.0.1版本的。而连接到数据库后显示的数据库服务器版本信息却是9.2.0.4。

显然当前是通过一个10.2的sqlplus客户端,连接到9.2的数据库。那么无论ORACLE_HOME还是PATH都是指向10.2的客户端的,这就是为什么出现ORA-12545错误的原因:

[DEV]dev:/app/oracle/product

> export ORACLE_HOME=/app/oracle/product/920

[DEV]dev:/app/oracle/product

> export PATH=$ORACLE_HOME/bin:$PATH

[DEV]dev:/app/oracle/product

> sqlplus '/ as sysdba'

SQL*Plus: Release 9.2.0.4.0 - Production ON Thu Nov 17 17:28:41 2011

Copyright (c) 1982, 2002, Oracle Corporation. ALL rights reserved.

Connected TO:

Oracle9i Enterprise Edition Release 9.2.0.4.0 - 64bit Production

WITH the Partitioning, OLAP AND Oracle DATA Mining options

JServer Release 9.2.0.4.0 - Production

SQL>

[DEV]dev:/app/oracle/product

> export ORACLE_HOME=/app/oracle/product/920

[DEV]dev:/app/oracle/product

> export PATH=$ORACLE_HOME/bin:$PATH

[DEV]dev:/app/oracle/product

> sqlplus '/ as sysdba'

SQL*Plus: Release 9.2.0.4.0 - Production on Thu Nov 17 17:28:41 2011

Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved.

Connected to:

Oracle9i Enterprise Edition Release 9.2.0.4.0 - 64bit Production

With the Partitioning, OLAP and Oracle Data Mining options

JServer Release 9.2.0.4.0 - Production

SQL>

定位问题的原因,解决就很简单了,设置ORACLE_HOME和PATH到9.2对应的目录后,在本地sqlplus成功连接数据库。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值