1、查看当前数据库时区
SQL> select dbtimezone from dual; DBTIMEZONE ------------ +00:002、查看会话时区
SQL> select sessiontimezone from dual; SESSIONTIMEZONE -------------------------------------------------------------------------------- +08:00可以看到会话时区是北京时区。和数据库 时区不一致。
3、修改数据库的时区为CST
alter database set time_zone='+8:00'; SQL> alter database set time_zone='+8:00'; Database altered.4、重启数据库
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