无法连接到Oracle XE 11g2

时间:2015-02-04 10:10:32

标签: oracle oracle11g

这让我疯狂了两天。我最近在我的localhost(Windows 7企业版)上安装了Oracle Express Edition 11g2。我可以启动数据库和监听器,但我无法连接。

当我尝试使用以下参数从SQL Developer进行连接时:

Username: SYSTEM
Password: ***********
Hostname: localhost
Port: 1521
Service name: XE

我收到以下错误:An error was encountered... IO Error: The Network Adapter could not establish the connection. Vendor code 17002 显然,SQL Developer代表ORA-12541: TNS no listener发言。

当我尝试从SQL命令行连接时:

SQL> connect
Enter user-name: system
Enter password:
ERROR:
ORA-12638: Credential retrieval failed

我的ORACLE_HOME设置为C:\oraclexe\app\oracle\product\11.2.0\server

C:\oraclexe\app\oracle\product\11.2.0\server\network\ADMIN\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 = EXTPROC1))
    )
    (CONNECT_DATA =
      (SID = PLSExtProc)
      (PRESENTATION = RO)
    )
  )

ORACLR_CONNECTION_DATA = 
  (DESCRIPTION = 
    (ADDRESS_LIST = 
      (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1)) 
    ) 
    (CONNECT_DATA = 
      (SID = CLRExtProc) 
      (PRESENTATION = RO) 
    ) 
  ) 

#bohort  =
#  (DESCRIPTION=
#    (ADDRESS=(PROTOCOL=tcp)(HOST=LOCALHOST)(PORT=1521))
#    (CONNECT_DATA=(SID=bohort))
#    (HS=OK)
#  ) 

-

C:\oraclexe\app\oracle\product\11.2.0\server\network\ADMIN\listener.ora:

SID_LIST_LISTENER =
  (SID_LIST =
    (SID_DESC =
      (SID_NAME = PLSExtProc)
      (ORACLE_HOME = C:\oraclexe\app\oracle\product\11.2.0\server)
      (PROGRAM = extproc)
    )
    (SID_DESC =
      (SID_NAME = CLRExtProc)
      (ORACLE_HOME = C:\oraclexe\app\oracle\product\11.2.0\server)
      (PROGRAM = extproc)
    )
#   (SID_DESC=
#    (SID_NAME=bohort)
#    (ORACLE_HOME= C:\oraclexe\app\oracle\product\11.2.0\server)
#    (PROGRAM=dg4odbc)
#   )   
  )

LISTENER =
  (DESCRIPTION_LIST =
    (DESCRIPTION =
      (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1))
      (ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
    )
  )

DEFAULT_SERVICE_LISTENER = (XE)

-

C:\oraclexe\app\oracle\product\11.2.0\server\network\ADMIN\sqlnet.ora:

# This file is actually generated by netca. But if customers choose to 
# install "Software Only", this file wont exist and without the native 
# authentication, they will not be able to connect to the database on NT.

SQLNET.AUTHENTICATION_SERVICES = (NTS)

启动监听器似乎工作正常:

C:\Users\<Username>>lsnrctl start

LSNRCTL for 64-bit Windows: Version 11.2.0.2.0 - Production on 04-F╔VR.-2015 10:
45:27

Copyright (c) 1991, 2014, Oracle.  All rights reserved.

Starting tnslsnr: please wait...

TNSLSNR for 64-bit Windows: Version 11.2.0.2.0 - Production
System parameter file is C:\oraclexe\app\oracle\product\11.2.0\server\network\ad
min\listener.ora
Log messages written to C:\oraclexe\app\oracle\diag\tnslsnr\<Username>\listener\a
lert\log.xml
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(PIPENAME=\\.\pipe\EXTPROC1ipc
)))
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=127.0.0.1)(PORT=1521)))

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1)))
STATUS of the LISTENER
------------------------
Alias                     LISTENER
Version                   TNSLSNR for 64-bit Windows: Version 11.2.0.2.0 - Produ
ction
Start Date                04-F╔VR.-2015 10:45:32
Uptime                    0 days 0 hr. 0 min. 5 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Default Service           XE
Listener Parameter File   C:\oraclexe\app\oracle\product\11.2.0\server\network\a
dmin\listener.ora
Listener Log File         C:\oraclexe\app\oracle\diag\tnslsnr\<Username>\listener
\alert\log.xml
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(PIPENAME=\\.\pipe\EXTPROC1ipc)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=127.0.0.1)(PORT=1521)))
Services Summary...
Service "CLRExtProc" has 1 instance(s).
  Instance "CLRExtProc", status UNKNOWN, has 1 handler(s) for this service...
Service "PLSExtProc" has 1 instance(s).
  Instance "PLSExtProc", status UNKNOWN, has 1 handler(s) for this service...
The command completed successfully

我确信答案已经存在,但是两天的谷歌搜索还没有找到解决方案......

1 个答案:

答案 0 :(得分:0)

请在侦听器和TNSNAMES文件中使用IP地址127.0.0.1而不是LOCALHOST。

重新启动监听器并尝试再次连接。