无法连接到oracle XE DB

时间:2015-08-11 17:56:28

标签: oracle sqlplus tnsnames

所以我用openSUSE复制了一个正在运行的VM。当我启动机器时,我总是像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/

我不知道这里发生了什么,有人能帮助我吗?需要完成一些事情:/

1 个答案:

答案 0 :(得分:0)

我不知道到底出了什么问题,我现在已经使用这台VM近一年了。无论如何,我现在很沮丧,我只是使用http://www.dba-oracle.com/t_sample_listener_ora_files.htm创建了一个新的listener.ora。现在一切似乎都有效。