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
--------------------------------------------------------------------------------