Oracle ORA-01805 on Oracle 11g database

我的未来我决定 提交于 2019-12-09 13:26:44

问题


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.


回答1:


Use "genezi -v" to know the timezone file version.

Here is a sample in my Linux box:

$ genezi -v
Client Shared Library 32-bit - 11.2.0.2.0

System name:    Linux
Release:    2.6.32-34-generic
Version:    #77-Ubuntu SMP Tue Sep 13 19:39:17 UTC 2011
Machine:    x86_64

Operating in Instant Client mode.
Small timezone file = timezone_14.dat
Large timezone file = timezlrg_14.dat



回答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?




回答3:


I have the same problem whit ORA-01505 in Oracle 11G using Docker

ActiveRecord::StatementInvalid (OCIError: ORA-01805: possible error in date/time operation: SELECT  "USERS".* FROM "USERS" WHERE "USERS"."EMAIL" = :a1 ORDER BY "USERS"."ID" ASC FETCH FIRST :a2 ROWS ONLY):

I was using in the docker-compose.yml

    environment:
      - TZ=America/Guatemala

So just comment the line and every thing works

      environment:
      #- TZ=America/Guatemala


来源:https://stackoverflow.com/questions/7678485/oracle-ora-01805-on-oracle-11g-database

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!