Oracle 11g 数据库上的 Oracle ORA-01805
我们的 Oracle 10g 数据库最近升级到了 11g。该数据库在 Windows Server 2003 X64 计算机上运行。在来自 .NET 应用程序访问具有 TIMESTAMP (6) WITH TIME ZONE 数据列的表的 SQL 查询中,我收到以下异常。
System.Data.OracleClient.OracleException:ORA-01805:日期/时间操作中可能出现错误
针对例外情况的建议操作是确保客户端和服务器版本相同:
ORA-01805: 日期/时间操作中可能出现错误 原因:客户端和服务器上的时区文件不匹配。根据本地时区文件,操作可能会导致错误的结果。 操作:请确保客户端和服务器时区版本相同。
我运行了以下查询来检查相关数据库的时区。我还没有找到有关如何为客户端设置时区(或更改时区文件)的信息。
SELECT dbtimezone FROM DUAL;
select * from v$timezone_file;
DBTIMEZONE
----------
+00:00
FILENAME VERSION
-------------------- ----------------------
timezlrg_14.dat 14
我假设客户端指的是我安装的即时客户端,版本为 11_2?我通过 .NET Framework 提供的 System.Data.OracleClient.OracleConnection 运行查询。 UI 假设“时区版本”指的是时区文件版本。我没有看到即时客户端哪里有时区文件。任何建议都表示赞赏。
Our Oracle 10g database was recently upgraded to 11g. The database is running on a Windows Server 2003 X64 machine. In SQL queries from a .NET application that access a table that has a TIMESTAMP (6) WITH TIME ZONE data columns, I am getting the following exception.
System.Data.OracleClient.OracleException : ORA-01805: possible error in date/time operation
The suggested action for the exception is to ensure that the client and server are the same version:
ORA-01805: possible error in date/time operation
Cause: The timezone files on client and server do not match. Operation can potentially result in incorrect results based on local timezone file.
Action: Please ensure client and server timezone versions are same.
I've ran the following queries to check the timezone on the database in question. I haven't found information on how I set the timezone (or change the timezone file) for the client.
SELECT dbtimezone FROM DUAL;
select * from v$timezone_file;
DBTIMEZONE
----------
+00:00
FILENAME VERSION
-------------------- ----------------------
timezlrg_14.dat 14
I assume the client is referring to the Instant Client I have installed, which is version 11_2? I'm running the queries through a System.Data.OracleClient.OracleConnection
as provided by the .NET Framework. U I assume by "timezone version" it's referring to the timezone file versions. I don't see where the instant client has a timezone file. Any suggestions are appreicated.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
我确定我安装了版本 11_2_0_1 的即时客户端。升级到11_2_0_2似乎已经缓解了这个问题。但是,我仍然不清楚即时客户端如何管理它的时区文件,甚至不清楚它在哪里或它是什么。我读过的所有资料都说要确保客户端和服务器具有相同的时区文件版本,但我不清楚客户端上实际上是如何完成的。也许除了使用不同版本的即时客户端之外我无法直接维护它?
I determined that I had version 11_2_0_1 of the instant client installed. Upgrading to 11_2_0_2 seems to have relieved this issue. However, I'm still not clear on how the instant client manages it timezone file, or even where it is or what it is. All the sources I've read say to ensure that the client and server have the same timezone file version, but it's not clear to me how that is actually done on the client. Perhaps it's not something I can directly maintain beyond using a different version of the instant client?
使用“genezi -v”了解时区文件版本。
这是我的 Linux 盒子中的一个示例:
Use "genezi -v" to know the timezone file version.
Here is a sample in my Linux box:
除了其他原因之外,当您进行时区转换并使用版本比数据库高得多的 cx-Oracle 库时,使用 python3.6 也会出现该问题。
它解释了“Manuel Pinot”的评论。当他评论 TZ 转换线时,它就起作用了。
我在使用最新的 cx-Oracle 8.1.0 的 python 3.6 中遇到了同样的问题,但连接到旧数据库 12.1。
调用不带时区转换的查询工作正常:
调用类似的查询时区转换失败:
我的解决方案:降级到较旧的 cx-Oracle 客户端(Oracle-instant 客户端 12.2 保持不变)
现在再次测试时区转换:
Beside other reasons, the problem occurs also using python3.6, when you're doing a timezone conversion and using cx-Oracle libraries with much higher version than database.
It explains the comment from "Manuel Pinot". As soon as he comments the TZ conversion line, it works.
I had the same issue with python 3.6 using most recent cx-Oracle 8.1.0, but connected to old database 12.1.
Calling a query without timezone conversion works fine:
Calling similar query with timezone conversion fails:
Solution in my case: Downgrade to older cx-Oracle client (Oracle-instant client 12.2 keeps unchanged)
Now testing again with timezone conversion:
我在 Oracle 11G 中使用 Docker 时遇到了同样的问题,即
我在 docker-compose.yml 中使用的
ORA-01505所以只需注释该行即可,一切正常
I have the same problem whit ORA-01505 in Oracle 11G using Docker
I was using in the docker-compose.yml
So just comment the line and every thing works