A B两台oracle主机
想通过在A主机上配置B主机的服务名直接用sqlplus访问B主机,但是访问时总是报ORA-12514: TNS:listener does not currently know of service requested in connect descriptor错误!
这个问题困扰了我一天,经过反复实验和查看资料终于解决!
配置服务名基于监听,所以监听的好坏直接影响最后的结果。我的问题就是出在了监听上。
配置监听的注意事项!
一、如果从来没有配置过监听,一定要用netca创建监听,不要用netmgr;netmgr是在netca第一次创建监听后使用的!
二、通过netca创建好监听后,一定要查看$ORACLE_HOME/network/admin/listener.ora
修改B主机的监听
如果是这个样子
-
SID_LIST_LISTENER =
-
-
(SID_LIST =
-
-
(SID_DESC =
-
-
(SID_NAME = PL***tProc)
-
-
(ORACLE_HOME = /u01/app/oracle/10.2.0/db_1)
-
-
(PROGRAM = extproc)
-
-
)
-
-
)
-
-
-
-
LISTENER =
-
-
(DESCRIPTION_LIST =
-
-
(DESCRIPTION =
-
-
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.120)(PORT = 1521))
-
-
)
-
-
(DESCRIPTION =
-
-
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC0))
-
-
)
-
-
)
一定要加上下面的代码
-
(SID_DESC =
-
-
(SID_NAME = orcl)
-
-
(ORACLE_HOME = /u01/app/oracle/10.2.0/db_1)
-
-
(SID = aux1)
-
-
)
其中SID_NAME= 是你的当前数据库的实例名
SID当然也是当前数据库的实例名
加上去后就是这个样子,途中红色部分是新加的内容
-
SID_LIST_LISTENER =
-
-
(SID_LIST =
-
-
(SID_DESC =
-
-
(SID_NAME = PL***tProc)
-
-
(ORACLE_HOME = /u01/app/oracle/10.2.0/db_1)
-
-
(PROGRAM = extproc)
-
-
)
-
-
(SID_DESC =
-
-
(SID_NAME = orcl)
-
-
(ORACLE_HOME = /u01/app/oracle/10.2.0/db_1)
-
-
(SID = aux1)
-
-
)
-
-
)
-
-
-
-
LISTENER =
-
-
(DESCRIPTION_LIST =
-
-
(DESCRIPTION =
-
-
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.120)(PORT = 1521))
-
-
)
-
-
(DESCRIPTION =
-
-
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC0))
-
-
)
-
-
)
尔后重启监听
lsnrctl stop
lsnrctl start
在主机A上已经配置好B主机的服务名120
在A主机上测试 sqlplus /nolog
conn
连接成功了!哈哈
阅读(1694) | 评论(0) | 转发(1) |