IIS連線ORACLE的一個問題

asword發表於2007-04-13
ZT[@more@]

今天在連線ORACLE9I的時候遇到一個問題:

Microsoft OLE DB Provider for ODBC Drivers (0×80004005) Specified driver could not be loaded due to system error 5 (Oracle in OraHome92).
使用oracle client software連線測試資料庫工作正常,但是IIS總是不能連線資料庫,網上google了一把,
可能的原因有:
1.許可權問題,IUSER_ or Everyone給與READ&EXEC許可權。
2.MDAC版本問題。
折騰了半天1是不行的,2 我的作業系統是XP+SP2本省就是MDAC2.8SP1最新版本,MDAC根本就不讓安裝,鬱悶。
不甘心,再找,發現下面的文章,最終解決問題:

Subject: Unable to Connect to Database with Oracle Client Software for Windows
Doc ID: Note:215255.1 Type: PROBLEMLast Revision Date: 17-MAR-2006 Status: PUBLISHED

Problem Description—————————-

When running an application using any of these versions of the Oracle client software for Windows

o Oracle9i Release 2 (9.2.0.1.0) o Oracle10g Release 1 (10.1.0.2.0)

and you attempt to connect to an Oracle database through an environment that uses the “Authenticated User” group

NOTE: This typically occurs when running applications from inside Microsoft’s Internet Information Server (IIS) that connect to Oracle and you are using any of these programmatic interfaces from your application
1. Oracle Provider for OLE DB2. Microsoft OLE DB Provider for Oracle
3. Oracle ODBC Driver
4. Microsoft ODBC for Oracle
5. Oracle Objects for OLE (OO4O)
6. Microsoft .NET Framework Data Provider for Oracle
7. Oracle Data Provider for .NET (ODP.NET)
you may receive one of the following errors:
(1) Oracle Provider for OLE DB(a) Error Type: Microsoft OLE DB Service Components (0×80070005) Access is denied.
(b) OraOLEDB.Oracle Provider is not registered on the local machine
(c) SQL Server Enterprise Manager (Using a Linked Server)
Error 7311: Could not obtain the schema rowset from OLE DB provider ‘UNKNOWN’. The provider supports the interface, but returns failure code when it is used. OLE DB error trace [OLE/DB Provider ‘UNKNOWN’ IDBSSchemaRowset::GetRowset returned 0×80040e37: ].
(d) OLEDBException: TNS-12154: TNS could not resolve service name
(e) Run-time error ‘3706’: Provider cannot be found. It may not be properly installed.
(2) Microsoft OLE DB Provider for Oracle
(a) Error Type: Microsoft OLE DB Provider for Oracle (0×80004005)
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.
(b) Error Type: Microsoft OLE DB Provider for Oracle (0×80004005)

Oracle error occurred, but error message could not be retrieved from Oracle.
(c) SQL Server Enterprise Manager (Using a Linked Server) Error 7399: OLE DB Provider ‘MSDAORA’ reported an error. OLE DB error trace [OLE/DB Provider ‘MSDAORA’ IDBInitialize::Initialize returned 0×80004005: ].
(3) Oracle ODBC Driver
(a) Error Type: Microsoft OLE DB Provider for ODBC Drivers (0×80004005) Specified driver could not be loaded due to system error 5 (Oracle in OraHome92).
(b) Microsoft OLE DB Provider for ODBC Drivers (0×80004005) [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified
(c) SQLSTATE: IM004 Native Error Code: 0 Driver Message: [Microsoft][ODBC Driver Manager] Driver’s SQLAllocHandle on SQL_HANDLE_ENV failed.
(4) Microsoft ODBC for Oracle
(a) The Oracle? 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.
(b) Error number: -2147467259 Error Description: [Microsoft][ODBC Driver Manager] Driver’s SQLAllocHandle on SQL_HANDLE_ENV failed
(5) Oracle Objects for OLE(a) while using a GLOBAL.ASA file Error Type: Active Server Pages (0×0) An error occurred while creating object ‘OraSession’.
(b) not using a GLOBAL.ASA file Error Type: Microsoft VBScript runtime (0×800A0046) Permission denied: ‘CreateObject’
(6) Microsoft .NET Framework Data Provider for Oracle
(a) System.DllNotFoundException: Unable to load DLL (oci.dll). at System.Data.OracleClient.DBObjectPool.GetObject(Boolean& isInTransaction) at System.Data.OracleClient.OracleConnectionPoolManager. GetPooledConnection(String encryptedConnectionString, OracleConnectionString options, Boolean& isInTransaction) at System.Data.OracleClient.OracleConnection.OpenInternal (OracleConnectionString parsedConnectionString, Object transact) at System.Data.OracleClient.OracleConnection.Open() at WCWSItemAvailability.ETAAvailability.SingleAvailability(String ItemNumber, String BusinessUnit, Int32 OrderQty, Int32& AvailableQty, Int32& OnHandQty, String& ETADate, Int32& Error) at WCWSItemAvailability.ETAAvailability.XMLAvailability(String XMLInput)
(b) Server Error in ‘’ Application. Could not create an environment: OCIEnvCreate returned -1. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.Exception: Could not create an environment: OCIEnvCreate returned -1. Stack Trace: [Exception: Could not create an environment: OCIEnvCreate returned -1.] System.Data.OracleClient.DBObjectPool.GetObject(Boolean& isInTransaction) +467 System.Data.OracleClient.OracleConnectionPoolManager. GetPooledConnection(String encryptedConnectionString, OracleConnectionString options, Boolean& isInTransaction) +165 System.Data.OracleClient.OracleConnection.OpenInternal (OracleConnectionString parsedConnectionString, Object transact) +836 System.Data.OracleClient.OracleConnection.Open() +32
(c) Unable to find entry point named OCIEnvCreate in OCI.DLL
(7) Oracle Data Provider for .NET (ODP.NET)
(a) ORA-01012: not logged on
(b) ORA-12154 “TNS:could not resolve service name”
(8) Other miscellaneous errors
(a) The Specified Module Could Not Be Found
(b) ORA-00604: error occurred at recursive SQL level 1 ORA-12705: invalid or unknown NLS parameter value specified
(c) Unable to load DLL (OraOps9.dll): ... [DllNotFoundException: Unable to load DLL (OraOps9.dll).]
(d) System Error 998 trying to run ASP page
(e) Your OCI application returns a -1 when calling OCIEnvCreate
(f) You receive an Access Violation Exception from OraGeneric9.dll when trying to write to memory.

Solution Description——————————
NOTE: This problem DOES NOT exist in the Oracle10g Release 2 (10.2.0.1.0) and

later client software for Windows. If you think you are are running into a similar issue on 10.2.0.1.0 or later software, please see the “References” section below for other possible solutions.

There are two ways to resolve this problem:

SOLUTION 1 - If you must remain on the current version of the client software this solution will step you through the manual process for fixing the permissions problem. SOLUTION 2 - If you are able to patch your client software to a later version this solution will advise you on what patch to apply to resolve this problem. NOTE - If you are using the Oracle10g Instant Client you MUST follow SOLUTION 1. SOLUTION 1 ====== Oracle Client software requires that you 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 folder. This is typically… – the “Ora92” folder under the “Oracle” folder (i.e. D:OracleOra92) in Oracle9iR2 or – the “Client_1” folder under the “Oracleproduct10.1.0” folder (i.e. D:Oracleproduct10.1.0Client_1) in Oracle10gR1 or – the “Db_1” folder under the “Oracleproduct10.1.0” folder (i.e. D:Oracleproduct10.1.0Db_1) in Oracle10gR1

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 of the “Properties” window.

NOTE: If you are running Windows XP and do not have a “Security” tab please do the following: (a) Open “Folder Options” in your Control Panel. (b) Choose the “View” tab. (c) Under “Advanced Settings” uncheck the option “Use simple file sharing (Recommended)”. The “Security” tab should now be available.

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 under the

“Allow” column (on Windows XP the “Permissions” list is called “Permissions for Authenticated Users”).

7. Re-check the “Read and Execute” box under the “Allow” column (this is

the box you just unchecked).

8. Click the “Advanced” button and in the “Permission Entries” list make

sure you see the “Authenticated Users” listed there with: Permission = Read & Execute Apply To = This folder, subfolders and files If this is NOT the case, edit that line and make sure the “Apply onto” drop-down box is set to “This folder, subfolders and files”. This should already be set properly but it is important that you verify this.

9. Click the “Ok” button until you close out all of the security properties

windows. The cursor may present the hour glass for a few seconds as it applies the permissions you just changed to all subfolders and files.

10. You must REBOOT YOUR COMPUTER to assure that these changes have taken

effect. Failure to do this can prevent this procedure from working!

11. Re-execute the application and it should now work.

NOTE: If the problem is still present after following steps 1-11 and

rebooting your computer in step 10 you should perform the following two additional permissions settings at step 8 as described below. This may be necessary due to permissions that have been configured beyond the standard permissions setup when the OS was originally installed:

12. If the problem is still present, go back through these same 11 steps

above, but when performing step 8 additionally check both boxes entitled “Inherit from parent the permission entries that apply to child objects. Include these with entries explicitly defined here.” AND “Replace permission entries on all child objects with entries shown here that apply to child objects” AND be sure to reboot in step 10.

SOLUTION 2======

If you are running Oracle9i Release 2 (9.2.0.1.0) client software please

apply the following 9.2.0.4.0 patch OR LATER (i.e. 9.2.0.x.x): * Patch Number: 3095277 Description: 9.2.0.4 PATCH SET FOR ORACLE DATABASE SERVER Product: Oracle Database Family Release: Oracle 9.2.0.4 Platform: Microsoft Windows (32-bit) Last Uploaded: 11-SEP-2003 Size: 256M (269101182 bytes)

If you are running Oracle10g Release 1 (10.1.0.2.0) client software please

apply the following 10.1.0.3.0 patch OR LATER (i.e. 10.1.0.x.x): * Patch Number: 3761843 Description: 10.1.0.3 PATCH SET FOR ORACLE DATABASE SERVER Product: Oracle Database Family Release: Oracle 10.1.0.3 Platform: Microsoft Windows (32-bit) Last Uploaded: 22-AUG-2004 Size: 447M (469761432 bytes)

NOTE: Although these patches appear to be database-only patches they can

also be applied to the client software as well. See the patch release notes for more information on how to install the patch onto client software.

Explanation—————-

If you install Oracle9i Release 2 (9.2.0.1.0) or Oracle10g Release 1
(10.1.0.2.0) client software on a computer running Windows with an NTFSpartition, 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 or 10.1.

NOTE: The application will continue to work if it runs as the Administrator of the machine.

Any application that is using the Authenticated User or possibly another
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.

Additional Information———————————
The above error messages may not only be encountered when using Oracle 9.2 or
10.1 client software but may also exist when running into general permissions
issues using third party products accessing Oracle on a Windows platform.

References—————

Bug 2498880 – Oracle 9I Release 2 Installation Issue on Windows 2000 NTFS File System (9.2.0.1.0) Bug 3067666 – ORAWSFIX9.EXE Doesn’t Run when Patching Client Only Install (9.2.0.3.0) Bug 3671964 – OUI Does Not Properly Set File Permissions on Oracle Home Directory (10.1.0.2.0) The following note describes a similar problem but different solution for a permissions issue on 10gR2 client software using the Remote Desktop Sharing capability of a Windows OS. Note 361325.1 – Unable To Connect By Remote Desktop with ODBC Application IM-004
?
其實解決問題的方法挺簡單的,先去掉Authenticated Users 的READ&EXECUTE 許可權,再加上READ&EXECUTE,然後複選
Replace permission entries on all child objects with entries shown here that apply to child objects,....鉤選筐,apply就ok了

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/82387/viewspace-910487/,如需轉載,請註明出處,否則將追究法律責任。

相關文章