无法连接到 Oracle XE DB
Can't connect to oracle XE DB
所以我用 openSUSE 复制了一个 运行 虚拟机。当我启动机器时,我像往常一样 lsnrctrl start
然后一切正常。通常我会得到以下输出:
# lsnrctl status
LSNRCTL for Linux: Version 11.2.0.2.0 - Production on 11-AUG-2015 19:46:46
Copyright (c) 1991, 2011, Oracle. All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=localhost)(PORT=1521)))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 11.2.0.2.0 - Production
Start Date 11-AUG-2015 19:46:43
Uptime 0 days 0 hr. 0 min. 3 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/lpdev/listener/alert/log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=127.0.0.1)(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
#
我的 XE 实例要晚得多才出现。但后来 XE 出现了,就像我说的,一切正常。现在我也这样做了,但是我的 XE 服务没有出现。
lpdev:~ # tnsping xe
TNS Ping Utility for Linux: Version 11.2.0.2.0 - Production on 11-AUG-2015 19:53:05
Copyright (c) 1997, 2011, Oracle. All rights reserved.
Used parameter files:
Used TNSNAMES adapter to resolve the alias
Attempting to contact (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = xe)))
OK (0 msec)
lpdev:~ #
listener.ora
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 = TCP)(HOST = localhost)(PORT = 1521))
)
)
DEFAULT_SERVICE_LISTENER = (XE)
tnsnames.ora
XE =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(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)
)
)
sqlplus 输出:
lpdev:~ # sqlplus lp@xe
SQL*Plus: Release 11.2.0.2.0 Production on Tue Aug 11 19:58:14 2015
Copyright (c) 1982, 2011, Oracle. All rights reserved.
Enter password:
ERROR:
ORA-12514: TNS:listener does not currently know of service requested in connect
descriptor
当 运行 我的 perl 脚本得到:
AH01215: DBI connect('XE','username',...) failed: ORA-12514: TNS:listener does not currently know of service requested in connect descriptor (DBD ERROR: OCIServerAttach) at /srv/www/cgi-bin/lib/myfunctions.pm line 372., referer: http://192.168.0.13/
我不知道这是怎么回事,谁能快点帮帮我?需要完成一些事情:/
我不知道到底出了什么问题,我使用这个 VM 已经将近一年了。无论如何,像我现在这样郁闷,我刚刚使用 http://www.dba-oracle.com/t_sample_listener_ora_files.htm 创建了一个新的 listener.ora。目前看来一切正常。
所以我用 openSUSE 复制了一个 运行 虚拟机。当我启动机器时,我像往常一样 lsnrctrl start
然后一切正常。通常我会得到以下输出:
# lsnrctl status
LSNRCTL for Linux: Version 11.2.0.2.0 - Production on 11-AUG-2015 19:46:46
Copyright (c) 1991, 2011, Oracle. All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=localhost)(PORT=1521)))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 11.2.0.2.0 - Production
Start Date 11-AUG-2015 19:46:43
Uptime 0 days 0 hr. 0 min. 3 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/lpdev/listener/alert/log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=127.0.0.1)(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
#
我的 XE 实例要晚得多才出现。但后来 XE 出现了,就像我说的,一切正常。现在我也这样做了,但是我的 XE 服务没有出现。
lpdev:~ # tnsping xe
TNS Ping Utility for Linux: Version 11.2.0.2.0 - Production on 11-AUG-2015 19:53:05
Copyright (c) 1997, 2011, Oracle. All rights reserved.
Used parameter files:
Used TNSNAMES adapter to resolve the alias
Attempting to contact (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = xe)))
OK (0 msec)
lpdev:~ #
listener.ora
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 = TCP)(HOST = localhost)(PORT = 1521))
)
)
DEFAULT_SERVICE_LISTENER = (XE)
tnsnames.ora
XE =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(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)
)
)
sqlplus 输出:
lpdev:~ # sqlplus lp@xe
SQL*Plus: Release 11.2.0.2.0 Production on Tue Aug 11 19:58:14 2015
Copyright (c) 1982, 2011, Oracle. All rights reserved.
Enter password:
ERROR:
ORA-12514: TNS:listener does not currently know of service requested in connect
descriptor
当 运行 我的 perl 脚本得到:
AH01215: DBI connect('XE','username',...) failed: ORA-12514: TNS:listener does not currently know of service requested in connect descriptor (DBD ERROR: OCIServerAttach) at /srv/www/cgi-bin/lib/myfunctions.pm line 372., referer: http://192.168.0.13/
我不知道这是怎么回事,谁能快点帮帮我?需要完成一些事情:/
我不知道到底出了什么问题,我使用这个 VM 已经将近一年了。无论如何,像我现在这样郁闷,我刚刚使用 http://www.dba-oracle.com/t_sample_listener_ora_files.htm 创建了一个新的 listener.ora。目前看来一切正常。