Oracle

Oracle 連接失敗,連接字元串中出現“HA Events=True”

  • February 6, 2013

我假設這是一個配置問題。一些背景。我正在執行帶有 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

看起來這是沒有將 VM 連接到網路和域的問題。

這是我所做的:

  1. 盡我所能清除 Oracle 清理虛擬機。
  2. 安裝了環回適配器
  3. 為虛擬機分配了一個假域名。
  4. 設置 ORACLE_HOSTNAME 環境變數。
  5. 根據我的手冊和文件重新安裝了oracle。

在這一切之後,我安裝了一個工作正常的 Oracle,並且高可用性事件正常工作。當然,這些不是我嘗試的第一步,因此我可能在此列表中遺漏了其他一些因素。

引用自:https://serverfault.com/questions/471803