我假设这是一个配置问题。一些背景知识。我正在运行带有 VM Player 的 Windows 7 VM。我在 VM 中安装了 Oracle 11gR2 以及客户端、企业管理器、SQL Developer 和 ODP.NET 驱动程序(32 位和 64 位)。在这个项目之前,我没有使用过 Oracle,但我遵循了由了解情况的人设置的相当详细的步骤列表。
如果我通过 ODP.NET 驱动程序 (v4.112.1.2) 连接到服务,并且连接字符串中包含“HA EVENTS=True”,则无法连接。如果我从连接字符串中删除“HA EVENTS=True”,则将连接。我已经使用我创建的小型控制台应用程序对此进行了测试,该应用程序只是打开一个连接,然后尝试从中读取并关闭。返回的错误消息是“Oracle.DataAccess.Client.OracleException ORA-24912:侦听器线程失败。%s”。令人惊讶的是,互联网上没有关于该错误代码的信息。我能找到的唯一解决方案是需要重新启动侦听器并重新安装 Oracle。我可以通过 SQL Developer、SQL Plus、ODBC 进行连接。有什么想法我下一步应该去哪里?
tnslsnr 日志中的消息如下所示:
<msg time='2013-01-22T17:02:48.306-08:00' org_id='oracle' comp_id='tnslsnr' type='UNKNOWN' level='16' host_id='MACHINENAME' host_addr='::1'>
<txt>22-JAN-2013 17:02:48 * (connect_data=(service_name=oradev1_a)(failover_mode=(type=select))(CID=(PROGRAM=c:\users\username\documents\visual?studio?2010\Projects\TestOdpNetConnect\TestOdpNetConnect\bin\Debug\TestOdpNetConnect.vshost.exe)(HOST=MACHINENAME)(USER=username))) * (ADDRESS=(PROTOCOL=tcp)(HOST=::1)(PORT=50915)) * establish * oradev1_a * 0
</txt>
</msg>
<msg time='2013-01-22T17:02:48.364-08:00' org_id='oracle' comp_id='tnslsnr' type='UNKNOWN' level='16' host_id='MACHINENAME' host_addr='::1'>
<txt>22-JAN-2013 17:02:48 * (connect_data=(service_name=oradev1_a)(failover_mode=(type=select))(CID=(PROGRAM=c:\users\username\documents\visual?studio?2010\Projects\TestOdpNetConnect\TestOdpNetConnect\bin\Debug\TestOdpNetConnect.vshost.exe)(HOST=MACHINENAME)(USER=username))) * (ADDRESS=(PROTOCOL=tcp)(HOST=::1)(PORT=50916)) * establish * oradev1_a * 0
</txt>
</msg>
注意:成功的连接在此日志中看起来相同。
‘lsnrctl services’ 如下所示:
LSNRCTL for 64-bit Windows: Version 11.2.0.1.0 - Production on 23-JAN-2013 08:38:38
Copyright (c) 1991, 2010, Oracle. All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1521)))
Services Summary...
Service "CLRExtProc" has 1 instance(s).
Instance "CLRExtProc", status UNKNOWN, has 1 handler(s) for this service...
Handler(s):
"DEDICATED" established:0 refused:0
LOCAL SERVER
Service "oradev1" has 1 instance(s).
Instance "oradev1", status READY, has 1 handler(s) for this service...
Handler(s):
"DEDICATED" established:178 refused:0 state:ready
LOCAL SERVER
Service "oradev1XDB" has 1 instance(s).
Instance "oradev1", status READY, has 1 handler(s) for this service...
Handler(s):
"D000" established:0 refused:0 current:0 max:1022 state:ready
DISPATCHER <machine: MACHINENAME, pid: 3916>
(ADDRESS=(PROTOCOL=tcp)(HOST=MachineName)(PORT=49297))
Service "oradev1_a" has 1 instance(s).
Instance "oradev1", status READY, has 1 handler(s) for this service...
Handler(s):
"DEDICATED" established:178 refused:0 state:ready
LOCAL SERVER
Service "oradev1_b" has 1 instance(s).
Instance "oradev1", status READY, has 1 handler(s) for this service...
Handler(s):
"DEDICATED" established:178 refused:0 state:ready
LOCAL SERVER
The command completed successfully
监听器.ora:
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(SID_NAME = CLRExtProc)
(ORACLE_HOME = C:\oracle\product\11.2.0\dbhome_1)
(PROGRAM = extproc)
(ENVS = "EXTPROC_DLLS=ONLY:C:\oracle\product\11.2.0\dbhome_1\bin\oraclr11.dll")
)
)
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
(ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
)
)
ADR_BASE_LISTENER = C:\oracle
TnsNames.ora:
ORACLR_CONNECTION_DATA =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
)
(CONNECT_DATA =
(SID = CLRExtProc)
(PRESENTATION = RO)
)
)
ORADEV1 =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = oradev1)
)
)
注意:我已在 Listener.ora 和 TnsNames.ora 中尝试使用“HOST = MachineName”,但似乎没有什么区别。
ODP.NET 日志:
TIME:2013/01/22-17:02:46:751 TID: 930 (VERSION) (4.112.2.0)
TIME:2013/01/22-17:02:46:751 TID: 930 (REGISTRY) (DllPath : C:\Oracle\x64\11.2.0.1.2\bin)
TIME:2013/01/22-17:02:46:751 TID: 930 (REGISTRY) (TraceFileName : C:\odplog\odpnet4.trc)
TIME:2013/01/22-17:02:46:751 TID: 930 (REGISTRY) (TraceLevel : 63)
TIME:2013/01/22-17:02:46:751 TID: 930 (REGISTRY) (TraceOption : 1)
TIME:2013/01/22-17:02:46:751 TID: 930 (REGISTRY) (CheckConStatus : 1)
TIME:2013/01/22-17:02:46:751 TID: 930 (REGISTRY) (UdtCacheSize : 4096)
TIME:2013/01/22-17:02:46:751 TID: 930 (REGISTRY) (StatementCacheSize : 0)
TIME:2013/01/22-17:02:46:751 TID: 930 (REGISTRY) (DynamicEnlist : 0)
TIME:2013/01/22-17:02:46:751 TID: 930 (REGISTRY) (FetchSize : 131072)
TIME:2013/01/22-17:02:46:751 TID: 930 (REGISTRY) (OCI_EVENTS : 0)
TIME:2013/01/22-17:02:46:751 TID: 930 (REGISTRY) (StatementCacheWithUdts : 1)
TIME:2013/01/22-17:02:46:751 TID: 930 (REGISTRY) (MetadataPooling : 1)
TIME:2013/01/22-17:02:46:751 TID: 930 (REGISTRY) (DBNotificationPort : -1)
TIME:2013/01/22-17:02:46:751 TID: 930 (REGISTRY) (ThreadPoolMaxSize : -1)
TIME:2013/01/22-17:02:46:751 TID: 930 (REGISTRY) (DBNotificationRegInterval : 0)
TIME:2013/01/22-17:02:46:751 TID: 930 (REGISTRY) (DemandOraclePermission : 0)
TIME:2013/01/22-17:02:46:751 TID: 930 (REGISTRY) (SelfTuning : True)
TIME:2013/01/22-17:02:46:751 TID: 930 (REGISTRY) (MaxStatementCacheSize : 100)
TIME:2013/01/22-17:02:46:751 TID: 930 (REGISTRY) (AppEdition : )
TIME:2013/01/22-17:02:46:751 TID: 930 (REGISTRY) (MetaDataXml : )
TIME:2013/01/22-17:02:46:751 TID: 930 (REGISTRY) (RevertBatchUpdateErrorHandling : 0)
TIME:2013/01/22-17:02:46:751 TID: 930 (REGISTRY) (FetchArrayPooling : 1)
TIME:2013/01/22-17:02:46:752 TID: 930 (REGISTRY) (PerformanceCounters : None)
TIME:2013/01/22-17:02:46:752 TID: 930 (REGISTRY) (PSPE : 1)
TIME:2013/01/22-17:02:46:752 TID: 930 (REGISTRY) (ThreadPoolMaxSize : -1 [Original: 32767; Set: -1; Post-Set: 32767])
TIME:2013/01/22-17:02:46:755 TID: 930 (ENTRY) OracleConnection::OracleConnection(2)
TIME:2013/01/22-17:02:46:819 TID: 930 (EXIT) OracleConnection::OracleConnection(2)
TIME:2013/01/22-17:02:47:692 TID: 930 (ENTRY) OracleCommand::OracleCommand(3)
TIME:2013/01/22-17:02:47:692 TID: 930 (EXIT) OracleCommand::OracleCommand(3)
TIME:2013/01/22-17:02:48:227 TID: 930 (ENTRY) OracleConnection::Open()
TIME:2013/01/22-17:02:48:227 TID: 930 (ENTRY) OpsConAllocValCtx()
TIME:2013/01/22-17:02:48:227 TID: 930 (EXIT) OpsConAllocValCtx(): RetCode=0 Line=399
TIME:2013/01/22-17:02:48:294 TID: 930 (ENTRY) OpsConOpen()
TIME:2013/01/22-17:02:48:294 TID: 930 (HA) OpsConOpen(): OciEvents=0 Line=1773
TIME:2013/01/22-17:02:48:331 TID: 930 (ENTRY) OpsConAddRef(): (20fb600)=34584064
TIME:2013/01/22-17:02:48:331 TID: 930 (EXIT) OpsConAddRef(): RefCount=1 RetCode=0 Line=3320 (20fb600)=34584064
TIME:2013/01/22-17:02:48:331 TID: 930 (ENTRY) OpsErrAllocCtx(): (20fb600)=34584064
TIME:2013/01/22-17:02:48:331 TID: 930 (EXIT) OpsErrAllocCtx(): RetCode=0 Line=197 (20fb600)=34584064
TIME:2013/01/22-17:02:48:331 TID: 930 (EXIT) OpsConOpen(): RetCode=0 Line=2353 (20fb600)=34584064
TIME:2013/01/22-17:02:48:337 TID: 930 (ENTRY) OpsConInitSubscrEnv()
TIME:2013/01/22-17:02:48:338 TID: 930 (EXIT) OpsConInitSubscrEnv(): RetCode=0 Line=3597
TIME:2013/01/22-17:02:48:341 TID: 930 (ENTRY) OpsConAllocValCtx()
TIME:2013/01/22-17:02:48:341 TID: 930 (EXIT) OpsConAllocValCtx(): RetCode=0 Line=399
TIME:2013/01/22-17:02:48:343 TID: 930 (ENTRY) OpsConRegisterCallbacks()
TIME:2013/01/22-17:02:48:343 TID: 930 (ENTRY) OpsConOpen()
TIME:2013/01/22-17:02:48:373 TID: 930 (ENTRY) OpsConAddRef(): (20fb880)=34584704
TIME:2013/01/22-17:02:48:373 TID: 930 (EXIT) OpsConAddRef(): RefCount=1 RetCode=0 Line=3320 (20fb880)=34584704
TIME:2013/01/22-17:02:48:373 TID: 930 (ENTRY) OpsErrAllocCtx(): (20fb880)=34584704
TIME:2013/01/22-17:02:48:373 TID: 930 (EXIT) OpsErrAllocCtx(): RetCode=0 Line=197 (20fb880)=34584704
TIME:2013/01/22-17:02:48:373 TID: 930 (EXIT) OpsConOpen(): RetCode=0 Line=2353 (20fb880)=34584704
TIME:2013/01/22-17:02:48:500 TID: 930 (HA) CreateSubscription(): RetCode=-1 Line=3723
TIME:2013/01/22-17:02:48:500 TID: 930 (EXIT) OpsConRegisterCallbacks(): RetCode=-1 Line=3836
TIME:2013/01/22-17:02:48:500 TID: 930 (ENTRY) OpsConClose(): (20fb880)=34584704
TIME:2013/01/22-17:02:48:503 TID: 930 (ENTRY) OpsConRelRef(): (20fb880)=34584704
TIME:2013/01/22-17:02:48:503 TID: 930 (ENTRY) OpsErrFreeCtx()
TIME:2013/01/22-17:02:48:503 TID: 930 (EXIT) OpsErrFreeCtx(): RetCode=0 Line=224
TIME:2013/01/22-17:02:48:503 TID: 930 (EXIT) OpsConRelRef(): RefCount=0 RetCode=0 Line=3496 (0)=0
TIME:2013/01/22-17:02:48:503 TID: 930 (EXIT) OpsConClose(): RetCode=0 Line=1293 (20fb880)=34584704
TIME:2013/01/22-17:02:48:503 TID: 930 (ENTRY) OpsConDispose(): (0)=0
TIME:2013/01/22-17:02:48:503 TID: 930 (EXIT) OpsConDispose(): RetCode=0 Line=1371
TIME:2013/01/22-17:02:48:510 TID: 930 (ENTRY) OpsConClose(): (20fb600)=34584064
TIME:2013/01/22-17:02:48:513 TID: 930 (ENTRY) OpsConRelRef(): (20fb600)=34584064
TIME:2013/01/22-17:02:48:513 TID: 930 (ENTRY) OpsErrFreeCtx()
TIME:2013/01/22-17:02:48:513 TID: 930 (EXIT) OpsErrFreeCtx(): RetCode=0 Line=224
TIME:2013/01/22-17:02:48:516 TID: 930 (EXIT) OpsConRelRef(): RefCount=0 RetCode=0 Line=3496 (0)=0
TIME:2013/01/22-17:02:48:517 TID: 930 (EXIT) OpsConClose(): RetCode=0 Line=1293 (20fb600)=34584064
TIME:2013/01/22-17:02:48:520 TID: 930 (ENTRY) OpsConDispose(): (0)=0
TIME:2013/01/22-17:02:48:520 TID: 930 (EXIT) OpsConDispose(): RetCode=0 Line=1371
TIME:2013/01/22-17:02:48:534 TID: 930 (ENTRY) OpsErrGetOraMesg()
TIME:2013/01/22-17:02:48:534 TID: 930 (EXIT) OpsErrGetOraMesg(): RetCode=0 Line=310