虚拟机安装了Oracle服务器(桌面类)和客户端,里面使用plsql连接自己没有问题。
在本机连接虚拟机没有成功。虚拟机的地址是192.168.126.132,已经确认本机能ping通虚拟机。
先是报错ORA-12170,连接超时,查找了相关资料,估计是防火墙的问题。于是关闭虚拟机的防火墙,问题消失。但是出现了第二个错误:ORA-12514 无监听程序。参考网上的资料,解决办法如下:
找到Oracle的Admin目录下的listener.ora文件,原来的配置为
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(SID_NAME = CLRExtProc)
(ORACLE_HOME = E:Oracle10g)
(PROGRAM = extproc)
)
)
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1))
(ADDRESS = (PROTOCOL = TCP)(HOST = Localhost)(PORT = 1521))
)
)
修改后的配置为:
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(SID_NAME = CLRExtProc)
(ORACLE_HOME = E:Oracle10g)
(PROGRAM = extproc)
)
(SID_DESC =
(GLOBAL_DBNAME = ORCL)
(ORACLE_HOME = E:Oracle10g)
(SID_NAME = ORCL)
)
)
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1))
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.126.132)(PORT = 1521))
)
)
红色内容为添加或修改的地方。注意Oracle目录以本机目录为准。
重启Oracle Listener服务,再次连接,成功。