ITPub博客

首页 > Linux操作系统 > Linux操作系统 > sqlplus本地登录报错ORA-12545

sqlplus本地登录报错ORA-12545

原创 Linux操作系统 作者:yangtingkun 时间:2011-11-17 23:53:00 0 删除 编辑

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

 

 

步骤如下:

> 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

这次同样连接到数据库,但是由于连接方式和第一次的不同,通过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>

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

 

来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/4227/viewspace-711550/ ,如需转载,请注明出处,否则将追究法律责任。

下一篇: ORA-600(15160)错误
请登录后发表评论 登录
全部评论
暂无介绍

注册时间:2007-12-29

  • 博文量
    1964
  • 访问量
    11076237