I have an Oracle 12c database in which I have detected that the scheduled jobs are running one hour apart after the change of time on the server, checking in the database I see that the SYSTIMESTAMP differ with the DBTIMEZONE
SQL> select dbtimezone, sessiontimezone from dual;
DBTIMEZONE
SESSIONTIMEZONE
-04: 00
-05: 00
In the operating system I run:
date + "% Z% z"
CST -0500
Is it correct that these values of SYSTIMESTAMP and DBTIMEZONE are different?, when the time change is made is it necessary to modify something in the database?
Best Answer
Forget anything about
DBTIMEZONE
, it has no practical use. The only purpose of DBTIMEZONE is: It defines the (internal) time zone to storeTIMESTAMP WITH LOCAL TIME ZONE
values - nothing else. Thus you cannot modify it when you have a table withTIMESTAMP WITH LOCAL TIME ZONE
column and such column contains data.SYSTIMESTAMP
(andSYSATE
) is returned in the time zone of database server's operating system!Thus they can be different of course.
Handling of time zones and daylight saving times for SCHEDULER JOBS is a big complicated. Have a look at Calendaring Syntax documentation:
See also https://stackoverflow.com/questions/29271224/how-to-handle-day-light-saving-in-oracle-database/29272926#29272926