今天在測試ASP.NET程式,在串連ORACLE資料庫時報出了“Oracle client and networking components were not found. These components are supplied by Oracle Corporation and are part of the Oracle Version 7.3.3 or later client software installation. Provider is unable to function until these components are installed”的錯誤。可我本機上確確實實已經裝了Oracle Client,而且在我本機上運行時也正常,一旦通過IIS發布,在運行時就會報上述錯誤。通過尋找網路資料,該問題已經成功解決。現將解決過程發布,供大家參考。
首先,把可能出現該問題的情況簡單闡述一下:a:Oracle 9.02i 版的問題b:是NTFS格式分區造成的。Oracle公司對此問題也給出了描述:Problem Description ------------------- When running an application that connects to Oracle and uses the Authenticated User privilege (such as Microsoft’s Internet Information Server (IIS)) via Oracle’s 9.2 client software and any of these programmatic interfaces 1. Oracle Provider for OLE DB 2. Microsoft OLE DB Provider for Oracle 3. Oracle ODBC Driver 4. Microsoft ODBC for Oracle 5. Oracle Objects for OLE (OO4O) you will receive one of the following errors: (1) Oracle Provider for OLE DB Error Type: Microsoft OLE DB Service Components (0x80070005) Access is denied. (2) Microsoft OLE DB Provider for Oracle Error Type: Microsoft OLE DB Provider for Oracle (0x80004005) Oracle client and networking components were not found. These components are supplied by Oracle Corporation and are part of the Oracle Version 7.3.3 or later client software installation. Provider is unable to function until these components are installed. Or Error Type: Microsoft OLE DB Provider for Oracle (0x80004005) Oracle error occurred, but error message could not be retrieved from Oracle. (3) Oracle ODBC Driver Error Type: Microsoft OLE DB Provider for ODBC Drivers (0x80004005) Specified driver could not be loaded due to system error 5 (Oracle in OraHome92). (4) Microsoft ODBC for Oracle The Oracle(tm) client and networking components were not found. These components are supplied by Oracle Corporation and are part of the Oracle Version 7.3 (or greater) client software installation. You will be unable to use this driver until these components have been installed. (5) Oracle Objects for OLE (a) while using a GLOBAL.ASA file Error Type: Active Server Pages (0x0) An error occurred while creating object ’OraSession’. (b) not using a GLOBAL.ASA file Error Type: Microsoft VBScript runtime (0x800A0046)Permission denied: ’CreateObject’ (6) Other miscellaneous errors (a) The Specified Module Could Not Be Found
接著,我們來解決此問題,方法很簡單,找到ORACLE_HOME檔案夾,右擊—〉屬性—〉安全,選Authenticated Users,查看它的屬性,將Read and Execute的勾先去掉(預設情況下該勾是選中的),在勾上,然後重新啟動你的機器,在運行程式,該問題就成功解決了。ORACLE公司也給出瞭解決方案:Solution Description -------------------- You need to give the Authenticated User privilege to the Oracle Home by following these steps: 1. Log on to Windows as a user with Administrator privileges. 2. Launch Windows Explorer from the Start Menu and and navigate to the ORACLE_HOME directory. 3. Right-click on the ORACLE_HOME folder and choose the "Properties" option from the drop down list. A "Properties" window should appear. 4. Click on the "Security" tab on the "Properties" window. 5. Click on "Authenticated Users" item in the "Name" list (on Windows XP the "Name" list is called "Group or user names"). 6. Uncheck the "Read and Execute" box in the "Permissions" list (on Windows XP the "Permissions" list is called "Permissions for Authenticated Users"). This box will be under the "Allow" column. 7. Check the "Read and Execute" box. This is the box you just unchecked. 8. Click the "Apply" button. 9. Click the "OK" button. 10. You may need to reboot your computer after these changes have been made. Re-execute the application and it should now work. Explanation ----------- If you install Oracle9i Release 2 (9.2.0.1) on a computer running Windows with an NTFS partition, the contents of ORACLE_HOME directory will not be visible to users who are authenticated on that machine. These permissions were not set properly when the software was installed. Applications that were working fine with previous versions of Oracle software will stop working when they upgrade to Oracle 9.2. NOTE: The application will continue to work if the user has logged onto the machine as an Administrator. Any application that is using the Authenticated User privilege will not work. A notable example would be IIS which might service some of the requests based on the Authenticated User privileges. To demonstrate the problem in further detail, you can log on to the operating system as an authenticated machine user. You won’t be able browse the contents of the ORACLE_HOME directory demonstrating your inability to load any Oracle DLLs or make a connection. References ---------- Bug:2498880 - Oracle 9I Release 2 Installation Issue on Windows 2000 NTFS File System Additional Search Words ----------------------- OLEDB
需要注意的是:在XP系統下,屬性中可能找不到安全選項卡,如何去解決呢?很簡單,開啟一個表單,選擇“工具”—〉檔案夾選項...—〉查看,將使用簡單檔案分享權限設定前的勾去掉,確認即可(如)。