连接Oracle数据库

最近大家在服务器上运行ASP或.net程序连接Oracle的时候出现报“找不到Oracle 客户端和网络组件”的错,错误信息类似如下两种:
1:
System.Data.OracleClient requires Oracle client software version 8.1.7 or greater.
但是程序在自己开发机上运行却一切正常。

2:
System.Exception: System.Data.OracleClient 需要 Oracle 客户端软件 8.1.7 或更高版本。 在 System.Data.OracleClient.OCI.DetermineClientVersion() 在 System.Data.OracleClient.OracleInternalConnection.OpenOnLocalTransaction(String userName, String password, String serverName, Boolean integratedSecurity, Boolean unicode, Boolean omitOracleConnectionName) 在 System.Data.OracleClient.OracleInternalConnection..cto

经查原因如下:
这是Oracle 9i release 2 (9.2.0.1)客户端安装程序的bug。例如安装到c:\oracle\ora92目录下,该目录及以下子目录的访问权限缺省应该是administrators和system完全控制,Authenticated Users读取和运行。
安装程序对于Authenticated Users的权限设置有问题,造成该目录下的部分文件对于Authenticated Users无法访问,系统就报“找不到Oracle 客户端和网络组件”的错。
大家在自己电脑上开发的时候一般都是用本地的administrators组的用户登陆本机,所以访问没有问题。因为安装程序对于oracle目录及子目录的administrators的访问权限设置正确。

二个解决办法:
1、安装好Oracle 9i client后再安装Oracle 9i client 补丁,目前最新补丁是9.2.0.8,在\\10.10.200.210\software\oracle\patch目录下

2、只要给Authenticated Users 组加上访问Oracle Home目录的权限即可
以Administrator权限登录Windows.
启动Window 资源浏览器找到ORACLE_HOME目录,如C:\Oracle\ora92
右键弹出菜单,选择该目录共享与安全
点击 “安全” 页签
在组和用户名称列表中点击“Authenticated Users” 项.
在该用户的权限列表中,将“读取和运行”的选择框置为不选中状态
再次点击“读取和运行”的选择框,将其设置为选中状态
点击“高级”按钮并在权限项目中确定“Authenticated Users” 是否拥有“读取并运行”权限并应用于“该文件夹,及子文件夹和文件”. 如果不是,双击这样,并确保权限可以“应用于” “该文件夹,及子文件夹和文件”. 该项非常重要你一定要核查.
点击“确定” 按钮

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:
  a) Oracle Provider for OLE DB     Error Type: Microsoft OLE DB Service Components (0x80070005)     Access is denied.
  b) 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.
  c) 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).
  d) 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.
  e) Oracle Objects for OLE
  i. while using a GLOBAL.ASA file       Error Type: Active Server Pages (0x0)       An error occurred while creating object ’OraSession’.
  ii. not using a GLOBAL.ASA file       Error Type: Microsoft VBScript runtime (0x800A0046)       Permission denied: ’CreateObject’   (6)
  f) Other miscellaneous errors
  
  The Specified Module Could Not Be Found  Solution Description -------------------- You need to give the Authenticated User privilege to the Oracle Home by following these steps:
  i. Log on to Windows as a user with Administrator privileges.
  ii. Launch Windows Explorer from the Start Menu and and navigate to the    ORACLE_HOME directory.
  iii. Right-click on the ORACLE_HOME folder and choose the "Properties" option    from the drop down list. A "Properties" window should appear.
  iv. Click on the "Security" tab on the "Properties" window.
  v. Click on "Authenticated Users" item in the "Name" list (on Windows XP the    "Name" list is called "Group or user names").
  vi. 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.
  vii. Check the "Read and Execute" box. This is the box you just unchecked.
  viii. Click the "Apply" button.
  ix. Click the "OK" button.
  x. 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

 

原文地址 http://www.ithr.org.cn/blogs/index.php?blog=5&title=a_sao_ei_a_yoraclea_da_rao_a_oc_d_a_fac_&more=1&

posted @ 2010-11-19 10:48  Cage  阅读(420)  评论(0编辑  收藏  举报