Windows XP Windows 7 Windows 2003 Windows Vista Windows 綜合教學 Linux 系統教學
Windows 10 Windows 8 Windows 2008 Windows NT Windows Server 電腦軟體教學
您现在的位置: Windows教程網 >> Windows教程 >  >> 電腦軟體教學 >> 伺服器技術 >> 關於伺服器

ASP.NET 無法載入 oci.dll 連接 Oracle 9i:權限修復與 DLL 複製兩大解法

編輯:關於伺服器

錯誤現象

Unable to load oci.dll
Entry point ocienvcreate not found in oci.dll

方案一:修正 Oracle Client 目錄權限 (推薦)

  1. 定位 Oracle Client 安裝目錄 (如 E:\oracle\ora92)。
  2. 右鍵「屬性」→「安全性」→ 移除 ASP.NET、Users 後重新新增,授予 **完全控制** 或 **修改** 權限。
  3. 同步授予 Everyone 完全控制 (測試環境)。
  4. **關鍵**:網站目錄同樣授予 Everyone 或對應應用程式池身分完全存取,否則 Oracle 通過但網站仍 401/500。
  5. 重啟 IIS (iisreset)。

方案二:啟用 ASP.NET 模擬身分

在 web.config <system.web> 區段加入:

以高權限帳號運行請求繞過權限檢查,**生產環境慎用**。

方案三:複製核心 DLL 至 System32 (暴力但有效)

copy E:\oracle\ora92\bin\oraclient8.dll  C:\Windows\System32\
copy E:\oracle\ora92\bin\orasql9.dll   C:\Windows\System32\
copy E:\oracle\ora92\bin\oci.dll       C:\Windows\System32\

並確認註冊表 MSDTC 區段指向正確:

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\MSDTC\MTxOCI]
"OracleXaLib"="oraclient8.dll"
"OracleSqlLib"="orasql8.dll"
"OracleOciLib"="oci.dll"

XP/2003 顯示「安全性」頁籤

資料夾選項 → 檢視 → 取消勾選「使用簡單檔案共享 (推薦)」。

最佳實踐建議

  • 優先使用方案一 (最小權限原則)。
  • Oracle Client 版本與資料庫版本對應 (9i Client 連 9i DB),避免版本不匹配導致 ocienvcreate 入口點缺失。
  • 64 位系統確保使用 64 位 Oracle Client (或啟用 32 位應用程式池搭配 32 位 Client)。
Copyright © Windows教程網 All Rights Reserved