The starting time of rman backup is different from setting time of OS cron job

Recently I helped one of my customers deploying oracle data guard 11gR2 primary and physical standby utilising two numer of database servers that reside on China Telecom Cloud. Yes, the customer purchased cloud Virtual Machine Hosts that are able to fully satisfy his business requirement.

Because he doesn’t pay attention to the TIMEZONE setting after installing Linux OS successfully but the current date is correct on OS, afterwards I certainly installed oracle software and data guard environment.

The next day the business program has been reported the time is always interval 8 hours than now by application developer, the Linux administrator is suddenly aware of the problem of OS timezone. After he adjusted the timezone of OS from “+00:00” to “+08:00” the program looks like to be normal, at that moment it doesn’t seem like to have any time error on oracle database.

After the rman backup task lasts for running several days the actual start running time of rman backup attracted my attention because which is apparently different from the beginning time of OS cron job about rman backup, such as, cron job is starting from 22:30 every day but the rman backup log has shown starting from 14:30 every day. OMG it exists interval 8 hours as well and the issue indicates that it comes from timezone of oracle database then I went to check the current timezone and the current date via SQL*Plus.

SQL> 
SQL> select sysdate from dual;

SYSDATE
-------------------
2023-08-11 10:11:27

SQL> 
SQL> select systimestamp from dual;

SYSTIMESTAMP
---------------------------------------------------------------------------
11-AUG-23 10.11.33.587180 AM +08:00

SQL> 
SQL> select dbtimezone from dual;

DBTIMEZONE
------------------
+00:00

SQL> select sessiontimezone from dual;

SESSIONTIMEZONE
--------------------------------------------------------------------------------
+08:00

As you can see from above the highlight line 16 and 20 dbtimezone shows “+00:00” but sessiontimezone with “+08:00” is right hence the root cause of this issue is on dbtimezone of oracle database as well as the dbtimezone value comes from the OS timezone setting unfortunately the dbtimezone has never been adjusted after the OS timezone is adjusted.

Of course, the solution is so easy we just need run “alter database set time_zone=+08:00′;” on SQL*Plus then ask application team seeking for the specified the windows of shutdown database we restart oracle database.

P.S.: We are quite careful about the TIMEZONE setting of the linux server of the cloud vendor supplied in particular after installing the OS.

Hope to help you …

Leave a comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.