ORACLE OleDb连接的E_FAIL(0x80004005)错误解决方法

博客讲述了Windos2003(SP1)+Oracle8.16+DotNetFormwork v1.1.4322系统连接Oracle数据库时出现错误的问题。给出了将Oracle所在分区转换为NTFS格式、赋予权限等解决办法,还提到重新编译Web项目仍有问题,重启电脑可解决,以及减少SQL参数、选用ODBC驱动等建议。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

Windos2003(SP1)+Oracle8.16+DotNetFormwork v1.1.4322系统
在连接Oracle数据时候,开始没有问题,可是过了一会就出现了:System.Data.OleDb.OleDbException: 未指定的错误: E_FAIL(0x80004005)的问题,于是Google了一下,没有什么解决方案,Baidu了一下,才找到了解决办法:
把相应的Oracle所在分区转换为NTFS格式.
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.

按照上面的方法其实还是不行,重新编译Web项目后,不时的还会出现上述问题,但是重新启动电脑就没有问题了.不知道到底是什么原因,安装了MDAC2.8,以后最好不要使用Sysetm.Data.OleDb,最好使用System.Data.OracleClient(需要安装ADO.NET for Oracle Data Provider)
Google搜到的一些资料

SYMPTOMS
The following error message may appear when 5000 records or more are retrieved, and when each record contains 4 bytes of data:
8007000e Not enough storage is available to complete this operation.
With a client-side cursor (in other words, when an ActiveX Data Objects (ADO) Recordset's CursorLocation property is set to adUseClient), the following error occurs instead:
80004005 Data provider or other service returned an E_FAIL status
Note that the computer is not really out of memory. Microsoft OLE DB Provider for Oracle and its internal algorithm, which attempts to allocate a buffer to hold the rows, fails if the rowset size is 4 bytes or less.


SYMPTOMS
A call to certain stored procedures that contain parameters may fail, resulting in OLE DB error 0x80004005 when using the Microsoft OLEDB Provider for Oracle older than version 2.10.3912.0.

CAUSE
In the MS Oracle OLEDB Provider at times there is not enough memory allocated to handle stored procedure parameters of a specific cumulative size or greater. This condition appears to generate an Oracle error 6215, but the provider does not trap for this particular error and simply fails the call with the generic "0x80004005 Errors occurred" error.

RESOLUTION
It is possible to reduce the number of parameters in your SQL Statement and thereby avoid this error. Or you can choose to select the Microsoft OLEDB Provider for ODBC, so you may connect to the Oracle database through an Oracle ODBC driver.

转载于:https://www.cnblogs.com/caca/archive/2005/05/05/149797.html

### 错误代码 0x80004005 的原因 错误代码 `E_FAIL (0x80004005)` 表明操作失败,通常由多种潜在因素引起。对于 ORACLE OleDb 连接中的此错误,当 MS Oracle OLEDB 提供程序分配的内存不足以处理存储过程参数的特定累积大小或更大时,可能会发生这种情况[^1]。 这种情况下,提供程序未能捕获具体的 Oracle 错误 6215 并简单地返回通用错误消息 “Errors occurred”。这表明底层资源管理存在问题,特别是在涉及大量数据传输的情况下。 ### 解决方案 针对上述情况提出的解决方案如下: #### 调整应用程序逻辑 优化应用层面对数据库调用的方式,减少单次请求的数据量,避免触发内存不足的情况。如果可能的话,考虑分批执行查询而不是一次性加载过多记录。 #### 修改配置设置 调整客户端和服务器端的相关配置项来适应更大的工作负载需求。具体措施可以包括但不限于增加可用内存量、更改连接池大小以及优化SQL语句性能等。 #### 更新驱动版本 确认使用的OleDb驱动是最新的稳定版;旧版本可能存在已知缺陷,在新版本中或许已被修复。官方发布的更新往往包含了对之前发现的各种问题的支持改进。 ```sql -- 检查现有连接字符串并确保其正确无误 Provider=MSDAORA;Data Source=myOracleDB;User Id=myUsername;Password=myPassword; ``` 通过以上手段应该能够有效缓解乃至彻底消除该类异常现象的发生频率。当然,实际环境中还需要结合具体情况做进一步分析诊断才能得出最合适的应对策略。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值