Oracle method to modify the time zone: 1. Use the "alter database set time_zone=' 8:00';" statement to modify the time zone; 2. Use the "shutdown immediate" and "startup" commands to restart the database.
The operating environment of this tutorial: Windows 10 system, Oracle 11g version, Dell G3 computer.
1. Check the current database time zone
SQL> select dbtimezone from dual; DBTIMEZONE ------------ +00:00
2. Check the session time zone
SQL> select sessiontimezone from dual; SESSIONTIMEZONE -------------------------------------------------------------------------------- +08:00
You can see that the session time zone is Beijing time zone. The time zone is inconsistent with the database time zone.
3. Modify the time zone of the database to CST
alter database set time_zone='+8:00'; SQL> alter database set time_zone='+8:00'; Database altered.
4. Restart the database
SQL> shutdown immediate Database closed. Database dismounted. ORACLE instance shut down. SQL> startup ORACLE instance started. Total System Global Area 784998400 bytes Fixed Size 2257352 bytes Variable Size 478154296 bytes Database Buffers 301989888 bytes Redo Buffers 2596864 bytes Database mounted. Database opened. SQL> select sessiontimezone, dbtimezone from dual; SESSIONTIMEZONE -------------------------------------------------------------------------------- DBTIMEZONE ------------ +08:00 +08:00
Recommended tutorial: "Oracle Video Tutorial"
The above is the detailed content of How to change time zone in oracle. For more information, please follow other related articles on the PHP Chinese website!