我在Fedora 20虚拟机上安装了Oracle 11g XE,对其进行了配置并设置了环境变量(运行oracle_env.sh).尝试通过jdbc连接Eclipse与数据库时,我遇到此错误,使用此字符串“jdbc.databaseurl = jdbc:oracle:thin:@ 192.168.88.134:1521:XE”
我可以通过sql * Plus(sqlplus / as sysdba)连接到虚拟机中的数据库.
$ORACLE_SID变量是可以的(XE).我已经尝试停止并启动监听器,然后启动数据库,并使用alter system寄存器;命令.
还静态注册数据库没有成功(我不能确保我没有误解这样做,所以如果有人认为这可以解决我的问题,我会再试一次).
这是listener.ora文件:
# listener.ora Network Configuration File: SID_LIST_LISTENER = (SID_LIST = (SID_DESC = (SID_NAME = PLSExtProc) (ORACLE_HOME = /u01/app/oracle/product/11.2.0/xe) (PROGRAM = extproc) ) ) LISTENER = (DESCRIPTION_LIST = (DESCRIPTION = (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC_FOR_XE)) (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.88.134)(PORT = 1521)) ) ) DEFAULT_SERVICE_LISTENER = (XE)
和tnsnames.ora文件:
# tnsnames.ora Network Configuration File: XE = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.88.134)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = XE) ) ) EXTPROC_CONNECTION_DATA = (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC_FOR_XE)) ) (CONNECT_DATA = (SID = PLSExtProc) (PRESENTATION = RO) ) )
并且lsnrctl状态:
LSNRCTL for Linux: Version 11.2.0.2.0 - Production on 31-MAR-2014 01:22:35 Copyright (c) 1991,2011,Oracle. All rights reserved. Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC_FOR_XE))) STATUS of the LISTENER ------------------------ Alias LISTENER Version TNSLSNR for Linux: Version 11.2.0.2.0 - Production Start Date 30-MAR-2014 22:41:35 Uptime 0 days 2 hr. 41 min. 1 sec Trace Level off Security ON: Local OS Authentication SNMP OFF Default Service XE Listener Parameter File /u01/app/oracle/product/11.2.0/xe/network/admin/listener.ora Listener Log File /u01/app/oracle/product/11.2.0/xe/log/diag/tnslsnr/192/listener/alert/log.xml Listening Endpoints Summary... (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC_FOR_XE))) (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.88.134)(PORT=1521))) Services Summary... Service "PLSExtProc" has 1 instance(s). Instance "PLSExtProc",status UNKNOWN,has 1 handler(s) for this service... The command completed successfully
我几乎可以肯定问题是监听器不知道数据库.除了它已经显示的内容之外,上一个命令应该显示类似的内容
Service XE has 1 instance. Instance "XE",status READY,has 1 handler for this service
……但它没有,我不知道如何解决这个问题.
我是新手,主要是在Linux上,所以我将欣赏你建议的解决方案中的每一个细节.
这听起来像您的数据库尝试使用错误的IP地址注册以联系侦听器.您的侦听器配置为侦听192.168.88.134,但可能DB正在假设localhost(127.0.0.1),或者如果配置已更改,则为旧IP值.
原文链接:https://www.f2er.com/oracle/205691.html默认情况下,数据库将尝试注册服务器的外部主机名(the default when local_listener is blank),但您可能从中获得了意外的值 – 因此/ etc / hosts中的机器名称很重要.无论是什么导致了这种情况,注册似乎都失败了.
您可以使用实际的侦听器地址明确告诉DB注册:
alter system set local_listener = '192.168.88.134:1521' scope=memory; alter system register;
如果这样可行并且lsnrctl服务现在显示XE,则使用scope = both重复set命令,以使其坚持下一次重新启动数据库.