Oracle rac,sysdate is not correct, and machine time difference 3 hours

Source: Internet
Author: User

The time of the operating system itself is correct, Oracle current_date, Current_timestamp are normal, that is sysdate problem. The workaround provided is a similar command:rvctl setenv database-d <dbname>-T tz=eat-8

To debug:
Telnet to the Unix box and connect using Sqlplus in the Telnet session:
1) Once trought the listener using a tnsnames alias
Select To_char (sysdate, ' Dd-mon-yy HH24:MI:SS ') from dual;
2) Once trough a "local" ORACLE_SID connection
Select To_char (sysdate, ' Dd-mon-yy HH24:MI:SS ') from dual;
If the result is different then it means, the listener is started with a different TZ
Then your current user env->; Stop and start listener with the TZ want.
If you is using RAC then use ' Srvctl setenv database-d <dbname>; -T tz=<the tz you want>; ' to define the correct tz.

Reason:

Sysdate is called the Gettimeofday function in the operating system, independent of the time zone set in the Oracle database, using the operating system's time zone. For Linux, it is the time zone set in the environment variable. According to this explanation, the command before running is correct, and the problem is on the TZ value.

Run Command Cat/etc/sysconfig/clock

See the time zone is asia/beijing, not EAT-8, and then to the system directory/usr/share/zoneinfo query, found no EAT-8. Then modify the previous command, the TZ set to asia/beijing, problem solving.
Before this, someone has had this hint, but not very clear the database inside the mechanism, stumbled, always set the wrong, understand the principle, also targeted.


Change the time zone setting for Oracle.
such as alter DATABASE SET time_zone= ' +8.00 ';
After modification, restart the Oracle database.

Oracle rac,sysdate is not correct, and machine time difference 3 hours

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.