Oracle current_date and sysdate time are inconsistent

Source: Internet
Author: User

Oracle current_date and sysdate time are inconsistent

Some time ago, it was found that the operating system time of a newly loaded Rac database was incorrect. When dbtimezone was queried, it was found to be-, indicating that the time zone was incorrect;
Select dbtimezone from dual;
 
DBTIME
 
---------
 
-06:00
 
OK. Stop rac first, start the database in a segment, and change the time_zone parameter:
 
Alter database set time_zone = '+ 08:00 ';

After changing the parameters, shut down the database and start the Rac database;

Run the following SQL to check whether the time is calibrated:
 
Select sysdate from dual;
 
Select current_date from dual;
 
Select current_timestamp from dual;
 
Host date
 
Select distinct imestamp from dual;
 
The time is consistent in sqlplus, but the display time is inconsistent when pl/SQL queries are used in the development response. That is, sysdate, systimestamp is very current_date, and the time of current_timestamp is inconsistent.
 
We all know that sysdate and systimestamp take the system time. Why is the query value in sqlplus accurate, and the query value through pl/SQL is not accurate?
 
To identify whether the database is faulty, use DBCA to re-create a test database on the operating system, and then view the test database. The problem persists, from this point, we can estimate that it is not a database problem, but an operating system problem.
 
In the AIX operating system date, you can see that the operating system time zone is BEIST-8, because it is a test database, after changing the operating system time zone to CST (Asia/shanghai), restart the operating system, use pl/SQL to connect to the database. If the problem is solved, all the time is the same and the database is located in the GMT + 8.

--------------------------------------------------------------------------------

Installing Oracle 12C in Linux-6-64

Install Oracle 11gR2 (x64) in CentOS 6.4)

Steps for installing Oracle 11gR2 in vmwarevm

Install Oracle 11g XE R2 In Debian

--------------------------------------------------------------------------------

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.