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实现 LeetCode 313 超级丑数

    313. 超级丑数 编写一段程序来查找第 n 个超级丑数. 超级丑数是指其所有质因数都是长度为 k 的质数列表 primes 中的正整数. 示例: 输入: n = 12, primes = [2,7, ...

  2. Java 实现 蓝桥杯 历届试题 分糖果

    问题描述 有n个小朋友围坐成一圈.老师给每个小朋友随机发偶数个糖果,然后进行下面的游戏: 每个小朋友都把自己的糖果分一半给左手边的孩子. 一轮分糖后,拥有奇数颗糖的孩子由老师补给1个糖果,从而变成偶数 ...

  3. Java实现第八届蓝桥杯兴趣小组

    兴趣小组 为丰富同学们的业余文化生活,某高校学生会创办了3个兴趣小组 (以下称A组,B组,C组). 每个小组的学生名单分别在[A.txt],[B.txt]和[C.txt]中. 每个文件中存储的是学生的 ...

  4. vue+jquery使用FormData向后端传递数据和文件,express如何获取

    使用multiparty 模块 下载 cnpm install multiparty --save 前端代码: <template> <div class="add-are ...

  5. Spring Data JPA入门及深入

    一:Spring Data JPA简介 Spring Data JPA 是 Spring 基于 ORM 框架.JPA 规范的基础上封装的一套JPA应用框架,可使开发者用极简的代码即可实现对数据库的访问 ...

  6. Java重置Mysql主键自增长值

    MySql 主键自增重置器(统一处理多个表) resetAutoincrement 是一款基于 Java 开发的程序,其功能为重置 mysql 数据库表的主键自增的值为最近的一个. 介绍 开发背景主要 ...

  7. 数据结构与算法-python描述-单链表

    # coding:utf-8 # 单链表的相关操作: # is_empty() 链表是否为空 # length() 链表长度 # travel() 遍历整个链表 # add(item) 链表头部添加元 ...

  8. java类的加载顺序和实例化顺序(Demo程序)

    一.main函数中实例化对象 父类 package com.learn; public class Father { //静态变量 public static int num_1 = 1; //静态代 ...

  9. 总结:修改相关postgres用户密码

    1.修改linux系统postgres用户的密码 PostgreSQL会创建一个默认的linux用户postgres,修改该用户密码的方法如下: 步骤一:删除用户postgres的密码 sudo  p ...

  10. centos7上安装redis以及PHP安装redis扩展(一)

    1.关闭防火墙: systemctl stop firewalld.service #停止firewall systemctl disable firewalld.service #禁止firewal ...