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

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

前言

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

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

具体描述一下问题:

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

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

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

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

现象

版本:11.2.0.4.0

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

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

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

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

2020-07-02 09:00:26.667:

[ohasd(24600)]CRS-2112:The OLR service started on node rac1.2020-07-02 09:00:26.675:

[ohasd(24600)]CRS-1301:Oracle High Availability Service started on node rac1.2020-07-02 09:00:26.676:

[ohasd(24600)]CRS-8017:location: /etc/oracle/lastgasp has 2 reboot advisory log files, 0 were announced and 0errors occurred2020-07-02 09:00:30.080:

[/u01/app/11.2.0/grid/bin/orarootagent.bin(24643)]CRS-2302:Cannot get GPnP profile. Error CLSGPNP_NO_DAEMON (GPNPD daemon is not running).2020-07-02 09:00:34.563:

[gpnpd(24737)]CRS-2328:GPNPD started on node rac1.2020-07-02 09:00:36.992:

[cssd(24806)]CRS-1713:CSSD daemon is started inclustered mode2020-07-02 09:00:38.798:

[ohasd(24600)]CRS-2767:Resource state recovery not attempted for 'ora.diskmon'as its target state is OFFLINE2020-07-02 09:01:01.319:

[cssd(24806)]CRS-1707:Lease acquisition for node rac1 number 1completed2020-07-02 09:01:02.612:

[cssd(24806)]CRS-1605:CSSD voting file is online: /dev/mapper/asm-ocr02; details in /u01/app/11.2.0/grid/log/rac1/cssd/ocssd.log.2020-07-02 09:01:02.620:

[cssd(24806)]CRS-1605:CSSD voting file is online: /dev/mapper/asm-ocr03; details in /u01/app/11.2.0/grid/log/rac1/cssd/ocssd.log.2020-07-02 09:01:02.623:

[cssd(24806)]CRS-1605:CSSD voting file is online: /dev/mapper/asm-ocr01; details in /u01/app/11.2.0/grid/log/rac1/cssd/ocssd.log.2020-07-02 09:01:15.917:

[cssd(24806)]CRS-1601:CSSD Reconfiguration complete. Active nodes are rac1 rac2 .2020-07-02 09:01:18.061:

[ctssd(25418)]CRS-2403:The Cluster Time Synchronization Service on host rac1 is inobserver mode.2020-07-02 09:01:18.421:

[ctssd(25418)]CRS-2407:The new Cluster Time Synchronization Service reference node is host rac1.2020-07-02 09:01:18.422:

[ctssd(25418)]CRS-2401:The Cluster Time Synchronization Service started on host rac1.2020-07-02 09:01:20.023:

[ohasd(24600)]CRS-2767:Resource state recovery not attempted for 'ora.diskmon'as its target state is OFFLINE

[client(25475)]CRS-10001:02-Jul-20 09:01 ACFS-9391: Checking for existing ADVM/ACFS installation.

[client(25480)]CRS-10001:02-Jul-20 09:01 ACFS-9392: Validating ADVM/ACFS installation files foroperating system.

[client(25482)]CRS-10001:02-Jul-20 09:01 ACFS-9393: Verifying ASM Administrator setup.

[client(25485)]CRS-10001:02-Jul-20 09:01 ACFS-9308: Loading installed ADVM/ACFS drivers.

[client(25488)]CRS-10001:02-Jul-20 09:01 ACFS-9154: Loading 'oracleoks.ko'driver.

[client(25521)]CRS-10001:02-Jul-20 09:01 ACFS-9154: Loading 'oracleadvm.ko'driver.

[client(25548)]CRS-10001:02-Jul-20 09:01 ACFS-9154: Loading 'oracleacfs.ko' driver.

........

ASM实例警告日志,

Thu Jul 02 09:01:26 2020NOTE: No asm libraries foundinthe system

NOTE: No asm libraries foundinthe system

MEMORY_TARGET defaulting to1128267776.* instance_number obtained from CSS = 1, checking for the existence of node 0...* node 0 does not exist. instance_number = 1Starting 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 1140850688 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 976789504 and used is 73728 bytes. Ensure that the mount point is /dev/shm forthis directory.

LICENSE_MAX_SESSION= 0LICENSE_SESSIONS_WARNING= 0Initial number of CPU is4Number of processor coresin the system is 4Number of processor socketsin the system is 2Private Interface'eth1:1' configured from GPnP foruse as a private interconnect.

[name='eth1:1', type=1, ip=169.254.146.181, mac=00-0c-29-60-50-8b, net=169.254.0.0/16, mask=255.255.0.0, use=haip:cluster_interconnect/62]

Public Interface'eth0' configured from GPnP foruse as a public interface.

[name='eth0', type=1, ip=192.168.180.100, mac=00-0c-29-60-50-81, net=192.168.180.0/24, mask=255.255.255.0, use=public/1]

Picked latch-free SCN scheme 3Using LOG_ARCHIVE_DEST_1 parameter default value as/u01/app/11.2.0/grid/dbs/arch

Autotune of undo retention is turned on.

LICENSE_MAX_USERS= 0SYS auditing is disabled

NOTE: Volume support enabled

Starting up:

Oracle Database 11g Enterprise Edition Release11.2.0.4.0 -64bit Production

With the Real Application Clusters and Automatic Storage Management options.

ORACLE_HOME= /u01/app/11.2.0/grid

System name: Linux

Node name: rac1.example.com

Release:2.6.32-573.el6.x86_64

Version: #1 SMP Wed Jul 1 18:23:37 EDT 2015Machine: x86_64

VM name: VMWare Version:6Using parameter settingsin server-side spfile +OCR/rac-cluster/asmparameterfile/registry.253.1034884609

DB的警告日志,

Thu Jul 02 09:02:47 2020Adjusting the default value of parameter parallel_max_servers

from160 to 120 due to the value of parameter processes (150)

Starting ORACLE instance (normal)

LICENSE_MAX_SESSION= 0LICENSE_SESSIONS_WARNING= 0Initial number of CPU is4Number of processor coresin the system is 4Number of processor socketsin the system is 2Private Interface'eth1:1' configured from GPnP foruse as a private interconnect.

[name='eth1:1', type=1, ip=169.254.146.181, mac=00-0c-29-60-50-8b, net=169.254.0.0/16, mask=255.255.0.0, use=haip:cluster_interconnect/62]

Public Interface'eth0' configured from GPnP foruse as a public interface.

[name='eth0', type=1, ip=192.168.180.100, mac=00-0c-29-60-50-81, net=192.168.180.0/24, mask=255.255.255.0, use=public/1]

Public Interface'eth0:2' configured from GPnP foruse as a public interface.

[name='eth0:2', type=1, ip=192.168.180.111, mac=00-0c-29-60-50-81, net=192.168.180.0/24, mask=255.255.255.0, use=public/1]

Picked latch-free SCN scheme 3Autotune of undo retention is turned on.

LICENSE_MAX_USERS= 0SYS auditing is disabled

Starting up:

Oracle Database 11g Enterprise Edition Release11.2.0.4.0 -64bit Production

With the Partitioning, Real Application Clusters, OLAP, Data Mining

and Real Application Testing options.

ORACLE_HOME= /u01/app/oracle/product/11.2.0/db_1

System name: Linux

Node name: rac1.example.com

Release:2.6.32-573.el6.x86_64

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

我们再看看归档的情况,

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

[oracle@rac2 ~]$ rman target /Recovery Manager: Release11.2.0.4.0 - Production on Fri Jul 3 00:20:01 2020Copyright (c)1982, 2011, Oracle and/or its affiliates. Allrights reserved.

connectedto target database: ZKM (DBID=4210149549)

RMAN> delete force noprompt archivelog all;

using targetdatabase control file instead ofrecovery catalog

allocated channel: ORA_DISK_1

channel ORA_DISK_1: SID=200 instance=zkm2 device type=DISKListof Archived Log Copies for database withdb_unique_name ZKM=====================================================================

KeyThrd Seq S Low Time------- ---- ------- - ---------

91 1 56 A 02-JUL-20Name:+ARCH/zkm/archivelog/2020_07_03/thread_1_seq_56.303.1044695873

92 2 21 A 02-JUL-20Name:+ARCH/zkm/archivelog/2020_07_02/thread_2_seq_21.299.1044695875deleted archivedlogarchivedlog file name=+ARCH/zkm/archivelog/2020_07_03/thread_1_seq_56.303.1044695873 RECID=91 STAMP=1044749873deleted archivedlogarchivedlog file name=+ARCH/zkm/archivelog/2020_07_02/thread_2_seq_21.299.1044695875 RECID=92 STAMP=1044695874Deleted2 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 fromdual;

SYSDATE------------------------

2020-07-03 00:20:27SYS@zkm1> alter system archive log current;

System altered.

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

Thu Jul 02 09:20:32 2020Thread1 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.1034889845Thu Jul02 09:20:32 2020ArchivedLog 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 JUL02 09:00:00 Y thread_1_seq_57.299.1044696033ARCHIVELOG UNPROT COARSE JUL02 09:00:00 Y thread_2_seq_22.303.1044696033ASMCMD>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

# Thetime zone of the system is defined by the contents of /etc/localtime.

# Thisfile is only for evaluation by system-config-date, donot rely on its

# contents elsewhere.

ZONE="Asia/Shanghai"

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

mos可以找到这么一篇文章:How To Change Timezone for Grid Infrastructure (Doc ID 1209444.1)

因此可以发现Grid Infrastructure的时区配置文件位置在$GRID_HOME/crs/install/s_crsconfig__env.txt。

所以,现象的模拟其实,就是我把该文件的时区改成如下了:

[grid@rac1 ~]$ cd $ORACLE_HOME/crs/install[grid@rac1install]$ lscmdllroot.sh crsconfig_lib.pm crsdelete.pm inittab installRemove.excl oracle-ohasd.conf paramfile.crs rootcrs.pl s_crsconfig_defs s_crsconfig_rac1_env.txt.bak

crsconfig_addparams.sbs crsconfig_params crspatch.pminstall.excl onsconfig oracle-ohasd.service ParentDirPerm_rac1.txt roothas.pl s_crsconfig_lib.pm tfa_setup.shcrsconfig_fileperms.excl crsconfig_params.sbs hasdconfig.plinstall.incl oraacfs.pm oracss.pm preupdate.sh rootofs.shs_crsconfig_rac1_env.txt

[grid@rac1install]$ cats_crsconfig_rac1_env.txt

### Thisfile can be used to modify the NLS_LANG environment variable, which determines the charset to be used formessages.

### For example, a new charset can be configured by setting NLS_LANG=JAPANESE_JAPAN.UTF8

### Do not modify thisfileexcept to change NLS_LANG, or under the direction of Oracle Support Services

TZ=US/Pacific

NLS_LANG=AMERICAN_AMERICA.AL32UTF8

TNS_ADMIN=ORACLE_BASE=

网上找找看是不是刚好和上海时间相差15个小时。

https://time.is/PT

得证!!!

oracle数据库报300006,Oracle归档日志所在目录时间不对Oracle集群日志时间显示错误...相关推荐

  1. oracle数据库报300006,Bad HDD - Restoring VMs

    Hi, okay then- this is how you should be able to pull that stunt off- please note, that this might o ...

  2. 12c集群日志位置_Oracle 19C RAC 集群日志位置变化

    作者 | JiekeXu 来源 | JiekeXu之路(ID: JiekeXu_IT) 转载请联系授权 | (微信ID:xxq1426321293) 大家好,我是 JiekeXu,很高兴又和大家见面了 ...

  3. 连接oracle数据库报错:ORA-12505

    连接oracle数据库报错:ORA-12505 今天在使用程序连接oracle数据库时本来很简单的填写url,用户名和密码,测试连接提示失败.和pl_sql 对比了下写的也没毛病,有图为证: 看了下数 ...

  4. Navicate Premium连接Oracle数据库报错

    Navicat Premium连接MySQL数据库没有问题,在连接Oracle数据库的时候报错,提示:ORA-28547:connection to server failed,probable Or ...

  5. ORACLE数据库报错ORA-00910: specified length too long for its datatype

    ORACLE数据库报错ORA-00910: specified length too long for its datatype 原因分析 先直接说下对于ORA-00910报错的原因:在于Oracle ...

  6. oracle数据库报错,ORA-01652:无法通过128(在表空间TEMP中)扩展temp段

    oracle数据库报错,ORA-01652:无法通过128(在表空间TEMP中)扩展temp段 出现这个报错一般是两种情况,oracle的temp空间不足:存在性能非常差的带全表扫描的sql占用的资源 ...

  7. oracle数据库报错12154,PL/SQL登录Oracle数据库报错ORA-12154:TNS:无法解析指定的连接标识符解决方法...

    本篇文章小编给大家分享一下PL/SQL登录Oracle数据库报错ORA-12154:TNS:无法解析指定的连接标识符解决方法,小编觉得挺不错的,现在分享给大家供大家参考,有需要的小伙伴们可以来看看. ...

  8. Oracle数据库备份报错12514,Oracle 数据库报错 ORA-12514解决办法

    Oracle 数据库报错 ORA-12514解决办法 绝对实用 如果orale数据库报ORA-12514 无监听程序 错误 就要listener.ora 和 tnsnames.ora 文件修改 一下如 ...

  9. Oracle数据库报错ORA-00904: 标识符无效问题解决办法

    Oracle数据库报错ORA-00904: 标识符无效问题解决办法 一般来说,报错ORA-00904: 标识符无效主要是以下两种情况: 1.可能是由于字段名或者表名写错了,一定要仔细核对代码里面的字段 ...

最新文章

  1. 负载均衡工具haproxy安装,配置,使用
  2. 什么是结构风险?在决策树类相关算法中通常有哪些正则化参数来控制模型的结构风险?解读一下
  3. 2020年人工智能领域的最大创新
  4. Linux多线程矩阵,操作系统实验——多线程计算矩阵相乘
  5. 使用Deinstall专用工具删除Oracle Database
  6. AAAI 2020 开源论文 | 可建模语义分层的知识图谱补全方法
  7. 31. 如何计算对象已死(引用计数器算法、可达性分析算法)32.对象是否可 GC?33. Minor GC 和 Full GC
  8. Android之px 与 dp, sp换算公式
  9. 《Linux Shell脚本攻略》读书笔记第二章 命令之乐
  10. 【设计模式】工厂模式
  11. 一款用C++语言实现的3D游戏引擎(附源码),适用于想学3D游戏开发
  12. Ubuntu系统安装翼联(EDUP)USB无线网卡驱动
  13. F27.U盘-做过重装系统启动盘后内存变小方法解决方法-cmd格式化U盘
  14. 2022年2月国产数据库排行榜:冠军宝座面临挑战,OceanBase 重返 TOP3
  15. Android studio安卓虚拟机无法启动
  16. Control your destiny, or someone else will
  17. MySQL中varchar最大长度是多少(真正的官网解释,事实说话)
  18. ubuntu 16.04 桌面修复
  19. GoldWave V5.55 绿色汉化版_声音编辑
  20. 【AI论文精粹】图形化解释工具;神经网络数据质量;LiDAR 语义分割;机器学习的应用

热门文章

  1. 2015 史考特(Scottrade)开户指南 + 招商银行香港一卡通汇款【图文教程】
  2. city-picker城市代码
  3. c语言中5l是数值或字符常量,C语言练习题-选择题(带答案)
  4. 安卓模拟器之王genymotion图文安装教程
  5. 基于ARM9程序状态寄存器CPSR
  6. ES6学习笔记(五)
  7. toad for mysql 彻底卸载_toad for mysql 下载
  8. 【工作】如何写好论文
  9. C++ std map unordered_map hash_map 的查找性能测试代码及结果
  10. 如何使用服务器虚拟主机,购买虚拟主机后如何使用