Oracle归档日志所在目录时间不对&&Oracle集群日志时间显示错误

前言

这个问题在18年的时候遇到了,基本不注意并且集群或者数据库运行正常是很难注意到的。

忘记当时怎么发现的了,最近拿出来重现一下问题。

具体描述一下问题:

比如当前时间是2020年07月03日0点,数据库对redo log发起归档。

在OMF下,归档会按照日期进行分类归档。

但是发起归档之后,新的归档文件会放在的20200702的目录中。

另外,db和asm和集群的警告日志的时间也和操作系统的date时间不一致。

现象

在我的测试环境中,关闭所有节点的集群之后,更改时间:

[root@rac1 ~]# date -s "2020-07-03 00:00:00"
Fri Jul :: CST

然后,启动所有节点的集群,可以依次观察

集群的警告日志,grid用户下,$ORACLE_HOME/log/rac1/alertrac1.log

-- ::26.667:
[ohasd()]CRS-:The OLR service started on node rac1.
-- ::26.675:
[ohasd()]CRS-:Oracle High Availability Service started on node rac1.
-- ::26.676:
[ohasd()]CRS-:location: /etc/oracle/lastgasp has reboot advisory log files, were announced and errors occurred
-- ::30.080:
[/u01/app/11.2./grid/bin/orarootagent.bin()]CRS-:Cannot get GPnP profile. Error CLSGPNP_NO_DAEMON (GPNPD daemon is not running).
-- ::34.563:
[gpnpd()]CRS-:GPNPD started on node rac1.
-- ::36.992:
[cssd()]CRS-:CSSD daemon is started in clustered mode
-- ::38.798:
[ohasd()]CRS-:Resource state recovery not attempted for 'ora.diskmon' as its target state is OFFLINE
-- ::01.319:
[cssd()]CRS-:Lease acquisition for node rac1 number completed
-- ::02.612:
[cssd()]CRS-:CSSD voting file is online: /dev/mapper/asm-ocr02; details in /u01/app/11.2./grid/log/rac1/cssd/ocssd.log.
-- ::02.620:
[cssd()]CRS-:CSSD voting file is online: /dev/mapper/asm-ocr03; details in /u01/app/11.2./grid/log/rac1/cssd/ocssd.log.
-- ::02.623:
[cssd()]CRS-:CSSD voting file is online: /dev/mapper/asm-ocr01; details in /u01/app/11.2./grid/log/rac1/cssd/ocssd.log.
-- ::15.917:
[cssd()]CRS-:CSSD Reconfiguration complete. Active nodes are rac1 rac2 .
-- ::18.061:
[ctssd()]CRS-:The Cluster Time Synchronization Service on host rac1 is in observer mode.
-- ::18.421:
[ctssd()]CRS-:The new Cluster Time Synchronization Service reference node is host rac1.
-- ::18.422:
[ctssd()]CRS-:The Cluster Time Synchronization Service started on host rac1.
-- ::20.023:
[ohasd()]CRS-:Resource state recovery not attempted for 'ora.diskmon' as its target state is OFFLINE
[client()]CRS-:-Jul- : ACFS-: Checking for existing ADVM/ACFS installation.
[client()]CRS-:-Jul- : ACFS-: Validating ADVM/ACFS installation files for operating system.
[client()]CRS-:-Jul- : ACFS-: Verifying ASM Administrator setup.
[client()]CRS-:-Jul- : ACFS-: Loading installed ADVM/ACFS drivers.
[client()]CRS-:-Jul- : ACFS-: Loading 'oracleoks.ko' driver.
[client()]CRS-:-Jul- : ACFS-: Loading 'oracleadvm.ko' driver.
[client()]CRS-:-Jul- : ACFS-: Loading 'oracleacfs.ko' driver.
........

ASM实例警告日志,

Thu Jul  ::
NOTE: No asm libraries found in the system
NOTE: No asm libraries found in the system
MEMORY_TARGET defaulting to .
* instance_number obtained from CSS = , checking for the existence of node ...
* node does not exist. instance_number =
Starting ORACLE instance (normal)
WARNING: You are trying to use the MEMORY_TARGET feature. This feature requires the /dev/shm file system to be mounted for at least bytes. /dev/shm is either not mounted or is mounted with available space less than this size. Please fix this so that MEMORY_TARGET can work as expected. Current available is and used is bytes. Ensure that the mount point is /dev/shm for this directory.
LICENSE_MAX_SESSION =
LICENSE_SESSIONS_WARNING =
Initial number of CPU is
Number of processor cores in the system is
Number of processor sockets in the system is
Private Interface 'eth1:1' configured from GPnP for use as a private interconnect.
[name='eth1:1', type=, ip=169.254.146.181, mac=-0c----8b, net=169.254.0.0/, mask=255.255.0.0, use=haip:cluster_interconnect/]
Public Interface 'eth0' configured from GPnP for use as a public interface.
[name='eth0', type=, ip=192.168.180.100, mac=-0c----, net=192.168.180.0/, mask=255.255.255.0, use=public/]
Picked latch-free SCN scheme
Using LOG_ARCHIVE_DEST_1 parameter default value as /u01/app/11.2./grid/dbs/arch
Autotune of undo retention is turned on.
LICENSE_MAX_USERS =
SYS auditing is disabled
NOTE: Volume support enabled
Starting up:
Oracle Database 11g Enterprise Edition Release 11.2.0.4. - 64bit Production
With the Real Application Clusters and Automatic Storage Management options.
ORACLE_HOME = /u01/app/11.2./grid
System name: Linux
Node name: rac1.example.com
Release: 2.6.-.el6.x86_64
Version: # SMP Wed Jul :: EDT
Machine: x86_64
VM name: VMWare Version:
Using parameter settings in server-side spfile +OCR/rac-cluster/asmparameterfile/registry.253.1034884609

DB的警告日志,

Thu Jul  ::
Adjusting the default value of parameter parallel_max_servers
from to due to the value of parameter processes ()
Starting ORACLE instance (normal)
LICENSE_MAX_SESSION =
LICENSE_SESSIONS_WARNING =
Initial number of CPU is
Number of processor cores in the system is
Number of processor sockets in the system is
Private Interface 'eth1:1' configured from GPnP for use as a private interconnect.
[name='eth1:1', type=, ip=169.254.146.181, mac=-0c----8b, net=169.254.0.0/, mask=255.255.0.0, use=haip:cluster_interconnect/]
Public Interface 'eth0' configured from GPnP for use as a public interface.
[name='eth0', type=, ip=192.168.180.100, mac=-0c----, net=192.168.180.0/, mask=255.255.255.0, use=public/]
Public Interface 'eth0:2' configured from GPnP for use as a public interface.
[name='eth0:2', type=, ip=192.168.180.111, mac=-0c----, net=192.168.180.0/, mask=255.255.255.0, use=public/]
Picked latch-free SCN scheme
Autotune of undo retention is turned on.
LICENSE_MAX_USERS =
SYS auditing is disabled
Starting up:
Oracle Database 11g Enterprise Edition Release 11.2.0.4. - 64bit Production
With the Partitioning, Real Application Clusters, OLAP, Data Mining
and Real Application Testing options.
ORACLE_HOME = /u01/app/oracle/product/11.2./db_1
System name: Linux
Node name: rac1.example.com
Release: 2.6.-.el6.x86_64

可以看到,日志开头全都是2020年07月02日的9点初。

我们再看看归档的情况,

在此之前,先删除之前的所有归档便于观察。

[oracle@rac2 ~]$ rman target /

Recovery Manager: Release 11.2.0.4.0 - Production on Fri Jul 3 00:20:01 2020

Copyright (c) 1982, 2011, Oracle and/or its affiliates.  All rights reserved.

connected to target database: ZKM (DBID=4210149549)

RMAN> delete force noprompt archivelog all;

using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=200 instance=zkm2 device type=DISK
List of Archived Log Copies for database with db_unique_name ZKM
===================================================================== Key Thrd Seq S Low Time
------- ---- ------- - ---------
91 1 56 A 02-JUL-20
Name: +ARCH/zkm/archivelog/2020_07_03/thread_1_seq_56.303.1044695873 92 2 21 A 02-JUL-20
Name: +ARCH/zkm/archivelog/2020_07_02/thread_2_seq_21.299.1044695875 deleted archived log
archived log file name=+ARCH/zkm/archivelog/2020_07_03/thread_1_seq_56.303.1044695873 RECID=91 STAMP=1044749873
deleted archived log
archived log file name=+ARCH/zkm/archivelog/2020_07_02/thread_2_seq_21.299.1044695875 RECID=92 STAMP=1044695874
Deleted 2 objects

其中一个节点发出命令归档redo log,

SYS@zkm1> alter session set nls_date_format='yyyy-mm-dd hh24:mi:ss';

Session altered.

SYS@zkm1>
SYS@zkm1> select sysdate from dual; SYSDATE
------------------------
2020-07-03 00:20:27 SYS@zkm1> alter system archive log current; System altered.

观察警告日志,显示的时间是“Thu Jul 02 09:20:32 2020”。

Thu Jul 02 09:20:32 2020
Thread 1 advanced to log sequence 58 (LGWR switch)
Current log# 2 seq# 58 mem# 0: +DATA/zkm/onlinelog/group_2.258.1034889845
Current log# 2 seq# 58 mem# 1: +ARCH/zkm/onlinelog/group_2.258.1034889845
Thu Jul 02 09:20:32 2020
Archived Log entry 93 added for thread 1 sequence 57 ID 0xfaf1eead dest 1:

进去ASM磁盘查看文件情况,

ASMCMD> ls -l
Type Redund Striped Time Sys Name
Y 2020_07_02/
ASMCMD> ls -l *
Type Redund Striped Time Sys Name
ARCHIVELOG UNPROT COARSE JUL 02 09:00:00 Y thread_1_seq_57.299.1044696033
ARCHIVELOG UNPROT COARSE JUL 02 09:00:00 Y thread_2_seq_22.303.1044696033
ASMCMD> pwd
+arch/zkm/ARCHIVELOG

至此,问题完全重现成功。

原因

不知道各位发现没有,实际上最开始启动集群(crsctl start crs)那一瞬间(大概是2020-07-03 00:00:00多,刚改完时间不到1分钟),

集群的警告日志最开始出现的时间为“2020-07-02 09:00:26.667:”,基本相差15小时。

因此很容易也可以猜出,是由于时区的原因。

系统的时区为:

[grid@rac1 ~]$ 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"

那么,集群应该也有自己的配置文件对应的时区,也就是集群不依赖OS的时区(-_-||)。

mos可以找到这么一篇文章:

How To Change Timezone for Grid Infrastructure (Doc ID 1209444.1)

Oracle归档日志所在目录时间不对&&Oracle集群日志时间显示错误的更多相关文章

  1. ORACLE 12C 之集群日志位置变化

    如果你还是使用 oracle 11g RAC 的目录结构方式寻找集群的日志,你会发现目录中所有的日志都是空的.actdb21:/oracle/app/12.2.0/grid/log/actdb21(+ ...

  2. windows 环境怎样恢复 (oracle 11g grid) ocr voting 损坏的集群

     windows 环境怎样恢复 (oracle 11g grid) ocr voting 损坏的集群 oracle 11g 以后 ocr 能够放到 asm 磁盘上,而ASM的启动依赖于ocr和vo ...

  3. Elasticstack 5.1.2 集群日志系统部署及实践

    Elasticstack 5.1.2 集群日志系统部署及实践 一.ELK Stack简介 ELK Stack 是Elasticsearch.Logstash.Kibana三个开源软件的组合,在实时数据 ...

  4. centos7搭建ELK Cluster集群日志分析平台(二):Logstash

    续  centos7搭建ELK Cluster集群日志分析平台(一) 已经安装完Elasticsearch 5.4 集群. 安装Logstash步骤 . 安装Java 8 官方说明:需要安装Java ...

  5. centos7搭建ELK Cluster集群日志分析平台

    应用场景:ELK实际上是三个工具的集合,ElasticSearch + Logstash + Kibana,这三个工具组合形成了一套实用.易用的监控架构, 很多公司利用它来搭建可视化的海量日志分析平台 ...

  6. 大数据项目之_15_帮助文档_NTP 配置时间服务器+Linux 集群服务群起脚本+CentOS6.8 升级到 python 到 2.7

    一.NTP 配置时间服务器1.1.检查当前系统时区1.2.同步时间1.3.检查软件包1.4.修改 ntp 配置文件1.5.重启 ntp 服务1.6.设置定时同步任务二.Linux 集群服务群起脚本2. ...

  7. ElasticSearch+Logstash+Filebeat+Kibana集群日志管理分析平台搭建

    一.ELK搜索引擎原理介绍 在使用搜索引擎是你可能会觉得很简单方便,只需要在搜索栏输入想要的关键字就能显示出想要的结果.但在这简单的操作背后是搜索引擎复杂的逻辑和许多组件协同工作的结果. 搜索引擎的组 ...

  8. centos7搭建ELK Cluster集群日志分析平台(四):Fliebeat-简单测试

    续之前安装好的ELK集群 各主机:es-1 ~ es-3 :192.168.1.21/22/23 logstash: 192.168.1.24 kibana: 192.168.1.25 测试机:cli ...

  9. centos7搭建ELK Cluster集群日志分析平台(三):Kibana

    续  centos7搭建ELK Cluster集群日志分析平台(一) 续  centos7搭建ELK Cluster集群日志分析平台(二) 已经安装好elasticsearch 5.4集群和logst ...

随机推荐

  1. Java实现 蓝桥杯 历届试题 横向打印二叉树

    问题描述 二叉树可以用于排序.其原理很简单:对于一个排序二叉树添加新节点时,先与根节点比较,若小则交给左子树继续处理,否则交给右子树. 当遇到空子树时,则把该节点放入那个位置. 比如,10 8 5 7 ...

  2. java代码(13) ---Predicate详解

    Predicate详解 遇到Predicate是自己在自定义Mybatis拦截器的时候,在拦截器中我们是通过反射机制获取对象的所有属性,在查看这些属性上是否有我们自定义的UUID注解 如果有该注解,那 ...

  3. c#发布补丁

    日常开发维护项目中,可能会遇到发布后出现bug,或者忘记改配置文件等等问题,这个时候,可能就需要重新进行下发布,有的开发小伙伴可能会把编译后的代码文件整个替换.这样做虽然也可以实现发布,但是有几个弊端 ...

  4. CMD指令和GIT指令

    CMD指令 dir 显示当前文件夹的所有的文件目录 mkdir 创建文件夹 cd> 创建文件 rd 删除文件夹 del 删除文件 cls 清屏 Linux指令 查看版本 node -v node ...

  5. python3 源码阅读-虚拟机运行原理

    阅读源码版本python 3.8.3 参考书籍<<Python源码剖析>> 参考书籍<<Python学习手册 第4版>> 官网文档目录介绍 Doc目录主 ...

  6. 实验五 shell脚本编程

    项目 内容 这个作业属于哪个课程 课程链接 这个作业的要求在哪里 作业要求 学号-姓名 17041428-朱槐健 作业学习目标 1. 了解shell脚本的概念及使用 2.掌握shell脚本语言的基本语 ...

  7. 关于adb的下载和基本使用

    我们无论是开发还是测试,对Android SDK一定都不陌生,如果我们要使用adb(Android debug bridge)命令,那么这个就必不可少了. 1.给大家提供一个下载地址:https:// ...

  8. 小技巧:如何用 Chrome 将 SVG 转成 PNG

    怎么把 SVG 转成 PNG ?用 Chrome 吧,非常好用,还能设定自己想要的尺寸. 什么是 SVG ? SVG (Scalable Vector Graphics,可缩放矢量图形) 是基于 XM ...

  9. kernel list 实践

    list.h /******* 链表实现,来自内核 **************************************************/ /** * container_of - c ...

  10. 【Transferable NAS with RL】2018-CVPR-Learning Transferable Architectures for Scalable Image Recognition

    Transferable NAS with RL 2018-CVPR-Learning Transferable Architectures for Scalable Image Recognitio ...