问题描述:
AIX + ORACLE 9.2.0.8 四节点rac,使用pl/sql developer客户端程序连接数据库,查看数据库时间比现实时间晚8小时,具体如下:
使用plsql developer查询时间为:(select sysdate from dual;)
2013 10 16 2:52:00
实际时间为:
2013 10 16 10:52:00
解决步骤:
1、查看操作系统时区设置
root@rac01[/]#echo $TZ
BEIST-8
root@rac01[/]#date
Tue Oct 16 10:53:08 BEIST 2013
--操作系统时区及时间均设置正确。
2、在数据库服务器上登录sqlplus查询时间
SQL> alter session set nls_date_format ='yyyy-mm-dd hh24miss';
Session altered.
SQL> select sysdate from dual;
SYSDATE
-----------------
2013-10-16 115206
--此处查询时间与操作系统时间一致
3、查看dbtimezone时间设置
SQL> select dbtimezone from dual;
DBTIME
------
+00:00
--dbtimezone记录时区为+00:00
4、修改如下:
SQL> alter database set time_zone='+8:00';
Database altered.
修改后,分别重启RAC所有节点实例,如下:
SQL> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup
ORACLE instance started.
Total System Global Area 8055138456 bytes
Fixed Size 751768 bytes
Variable Size 4949278720 bytes
Database Buffers 3103784960 bytes
Redo Buffers 1323008 bytes
Database mounted.
Database opened.
5、再次查看dbtimezone时间设置
SQL> select dbtimezone from dual;
DBTIME
------
+08:00
--dbtimezone记录时区为+08:00
此时通过pl/sqldeveloper客户端连接数据库查询时间正常。
AIX + ORACLE 9.2.0.8 四节点rac,使用pl/sql developer客户端程序连接数据库,查看数据库时间比现实时间晚8小时,具体如下:
使用plsql developer查询时间为:(select sysdate from dual;)
2013 10 16 2:52:00
实际时间为:
2013 10 16 10:52:00
解决步骤:
1、查看操作系统时区设置
root@rac01[/]#echo $TZ
BEIST-8
root@rac01[/]#date
Tue Oct 16 10:53:08 BEIST 2013
--操作系统时区及时间均设置正确。
2、在数据库服务器上登录sqlplus查询时间
SQL> alter session set nls_date_format ='yyyy-mm-dd hh24miss';
Session altered.
SQL> select sysdate from dual;
SYSDATE
-----------------
2013-10-16 115206
--此处查询时间与操作系统时间一致
3、查看dbtimezone时间设置
SQL> select dbtimezone from dual;
DBTIME
------
+00:00
--dbtimezone记录时区为+00:00
4、修改如下:
SQL> alter database set time_zone='+8:00';
Database altered.
修改后,分别重启RAC所有节点实例,如下:
SQL> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup
ORACLE instance started.
Total System Global Area 8055138456 bytes
Fixed Size 751768 bytes
Variable Size 4949278720 bytes
Database Buffers 3103784960 bytes
Redo Buffers 1323008 bytes
Database mounted.
Database opened.
5、再次查看dbtimezone时间设置
SQL> select dbtimezone from dual;
DBTIME
------
+08:00
--dbtimezone记录时区为+08:00
此时通过pl/sqldeveloper客户端连接数据库查询时间正常。