前段时间写了一篇关于oracle安装的博客,请参考linux ubuntu oracle 成功安装过程(图文),安装好以后,我登录企业后台(http://ubuntu:1158/em)报错,用sqlplus连接oracle也报错。
一,遇到的错误如下
1,ORA-12505: TNS:listener does not currently know of SID given in connect descriptor (DBD ERROR: OCIServerAttach)
2,ORA-28547: connection to server failed, probable Oracle Net admin error (DBD ERROR: OCISessionBegin)
3,sqlplus: error while loading shared libraries: libsqlplus.so: cannot open shared object file: No such file or directory
二,解决方法如下
解决问题一,ORA-12505: TNS:listener does not currently know of SID given in connect descriptor (DBD ERROR: OCIServerAttach)
1,找到tnsname.ora,listerner.ora的位置
root@ubuntu:/opt/ora10/network/admin# ls
listener.ora samples shrept.lst sqlnet.ora tnsnames.ora
2,修改listerner.ora配置
将(SID_NAME = PLSExtProc)改成(SID_NAME = ora1),SID_NAME在oracle管理后台http://ubuntu:1158/em中可以看到
解决问题二,ORA-28547: connection to server failed, probable Oracle Net admin error (DBD ERROR: OCISessionBegin)
问题一解决完后,就冒出这个问题,我在网上查了一下,千篇一律说这样解决,其实根本没有用。
1. 修改oracle的网络配置文件,具体做法是:在oracle安装目录下搜索sqlnet.ora文件,一般在$NETWORKADMIN目录下,
用记事本打开把文件中的一行:
SQLNET_AUTHENTICATION_SERVICES= (NTS)
修改为:
SQLNET_AUTHENTICATION_SERVICES= (NONE)
我发现我的sqlnet.ora根本没有这项目设置,我的sqlnet.ora里面只有一句是NAMES.DIRECTORY_PATH= (TNSNAMES, EZCONNECT)
2. 同时修改监听器配置文件,具体做法是: 在oracle安装目录下搜索listener.ora文件,一般在$NETWORKADMIN目录下,把主机名用ip地址代替,例如(ADDRESS = (PROTOCOL = TCP)(HOST = HBONLINE1)(PORT = 1523))改为(ADDRESS = (PROTOCOL = TCP)(HOST = 168.168.168.42)(PORT = 1523))
关于这种点,我更是不明白了,为什么换成ip,HOST后面对应的值,在/etc/hosts里面有映射,没必要换成ip.
根本原因是oracle服务根本没起来,可以通过ps -e |grep -i oracle来查看一下。启动起来就不会有这个问题了。
SQL> startup
ORACLE instance started.
解决问题三,sqlplus: error while loading shared libraries: libsqlplus.so: cannot open shared object file: No such file or directory
当我用zhangying@ubuntu:~$ sqlplus / as sysdba去登录时,提示上面的错误,解决方法如下
chmod -R a+rX /opt/ora10/
这里/opt/ora10是的我$ORACLE_HOME目录,加上后可以进去了。
三,我的配置文件
1,tnsnames.ora
ORA1 = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = ubuntu)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = ora1) ) ) EXTPROC_CONNECTION_DATA = (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1)) ) (CONNECT_DATA = (SID = PLSExtProc) (PRESENTATION = RO) ) )
2,listener.ora
SID_LIST_LISTENER = (SID_LIST = (SID_DESC = (SID_NAME = ora1) (ORACLE_HOME = /opt/ora10) (PROGRAM = extproc) ) ) LISTENER = (DESCRIPTION_LIST = (DESCRIPTION = (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1)) (ADDRESS = (PROTOCOL = TCP)(HOST = ubuntu)(PORT = 1521)) ) )
3,sqlnet.ora
NAMES.DIRECTORY_PATH= (TNSNAMES, EZCONNECT)
转载请注明
作者:海底苍鹰
地址:http://blog.51yip.com/oracle/1290.html