Oracle-RAC sysdate和current_date时间不一致,导致客户端连接时间延迟
Posted Leader.Z
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Oracle-RAC sysdate和current_date时间不一致,导致客户端连接时间延迟相关的知识,希望对你有一定的参考价值。
[oracle@oracle-db1 ~]$ date
Tue Oct 10 14:20:56 CST 2017
[oracle@oracle-db1 ~]$ cat /etc/sysconfig/clock
# The time zone of the system is defined by the contents of /etc/localtime.
# This file is only for evaluation by system-config-date, do not rely on its
# contents elsewhere.
ZONE="Asia/Shanghai"
[oracle@oracle-db1 ~]$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.3.0 Production on Tue Oct 10 14:21:11 2017
Copyright (c) 1982, 2011, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
Data Mining and Real Application Testing options
SYS@racdb1> select dbtimezone from dual;
DBTIMEZONE
------------
+00:00
SYS@racdb1> select sysdate from dual;
SYSDATE
-----------------------
10-OCT-2017 14:21:28
SYS@racdb1> select current_date from dual;
CURRENT_DATE
-----------------------
10-OCT-2017 14:21:37
SYS@racdb1>
但是用toad或plsql等第三方工具连接的时候就发现SYSDATE慢了三个小时
因为是集群数据库服务器, oracle 11.2.0.3 grid直接读取操作系统时区,
在oracle 11.2.0.3 grid的时区放在$ORACLE_HOME/crs/install/s_crsconfig_hostname_env.txt*这个文件中
查看该文件发现TZ与clock文件的zone值不一样
将两个节点服务的这个配置文件的TZ值改成跟CLOCK文件的值一样,即TZ="Asia/Shanghai"(ROOT用户下)
然后重启服务器
以上是关于Oracle-RAC sysdate和current_date时间不一致,导致客户端连接时间延迟的主要内容,如果未能解决你的问题,请参考以下文章
Oracle-RAC等价性验证错误:Result: PRVF-4007 : User equivalence check failed for user "grid"
如何生成 sysdate-30 和 sysdate+30 之间的所有日期列表?