ITPub博客

首页 > 数据库 > 数据库开发技术 > DB2日志相关

DB2日志相关

原创 数据库开发技术 作者:abstractcyj 时间:2020-12-22 11:06:42 0 删除 编辑

日志控制文件:

SQLOGCTL.LFH

例:

[root@dporacle01 ~]# find / -name SQLOGCTL*

/database/db2inst1/NODE0000/SQL00001/SQLOGCTL.LFH.1

/database/db2inst1/NODE0000/SQL00001/SQLOGCTL.LFH.2

LSN(Log Sequence Number)

此文件有点类似与oracle的控制文件,但是这里记录了minbufLSN, lowtranLSN以及其他重要的LSN, 崩溃恢复时,会从这里读取两个LSN, 用于确定崩溃日志应用的起点。(Oracle在做checkpoint时,也会将SCN更新到控制文件)


DB2获取日志相关配置方法:

[db2inst1@dporacle01 ~]$ db2 get db cfg for testdb | grep "log"

 User exit for logging status                            = NO

 Catalog cache size (4KB)              (CATALOGCACHE_SZ) = 300

 Number of primary log files                (LOGPRIMARY) = 13

 Number of secondary log files               (LOGSECOND) = 4

 Changed path to log files                  (NEWLOGPATH) = 

 Path to log files                                       = /database/db2inst1/NODE0000/SQL00001/SQLOGDIR/

 Overflow log path                     (OVERFLOWLOGPATH) = 

 Mirror log path                         (MIRRORLOGPATH) = 

 First active log file                                   = 

 Block log on disk full                (BLK_LOG_DSK_FUL) = NO

 Block non logged operations            (BLOCKNONLOGGED) = NO

 Percent max primary log space by transaction  (MAX_LOG) = 0

 Num. of active log files for 1 active UOW(NUM_LOG_SPAN) = 0

 Percent log file reclaimed before soft chckpt (SOFTMAX) = 520

 User exit for logging enabled                (USEREXIT) = OFF

 HADR log write synchronization mode     (HADR_SYNCMODE) = NEARSYNC

 First log archive method                 (LOGARCHMETH1) = OFF

 Options for logarchmeth1                  (LOGARCHOPT1) = 

 Second log archive method                (LOGARCHMETH2) = OFF

 Options for logarchmeth2                  (LOGARCHOPT2) = 

 Failover log archive path                (FAILARCHPATH) = 

 Number of log archive retries on error   (NUMARCHRETRY) = 5


查看归档日志信息:

[db2inst1@dporacle01 ~]$ db2 list history archive log all for testdb


                    List History File for testdb


Number of matching file entries = 1



 Op Obj Timestamp+Sequence Type Dev Earliest Log Current Log  Backup ID

 -- --- ------------------ ---- --- ------------ ------------ --------------

  X  D  20201203115725      1    D  S0000001.LOG C0000000      

 ----------------------------------------------------------------------------


 ----------------------------------------------------------------------------

    Comment:                                                                  

 Start Time: 20201203115725

   End Time: 20201203115725

     Status: A

 ----------------------------------------------------------------------------

  EID: 24 Location: /data1/archlog/db2inst1/TESTDB/NODE0000/C0000000/S0000001.LOG


[db2inst1@dporacle01 ~]$ db2 get db cfg for testdb | grep -i log

 Log retain for recovery status                          = RECOVERY

 User exit for logging status                            = YES

 Catalog cache size (4KB)              (CATALOGCACHE_SZ) = 300

 Log buffer size (4KB)                        (LOGBUFSZ) = 256

 Log file size (4KB)                         (LOGFILSIZ) = 1024

 Number of primary log files                (LOGPRIMARY) = 13

 Number of secondary log files               (LOGSECOND) = 4

 Changed path to log files                  (NEWLOGPATH) = 

 Path to log files                                       = /database/db2inst1/NODE0000/SQL00001/SQLOGDIR/

 Overflow log path                     (OVERFLOWLOGPATH) = 

 Mirror log path                         (MIRRORLOGPATH) = 

 First active log file                                   = S0000002.LOG



first active log file代表了最早的活动日志,在此之前的日志文件都是, 本例中是S0000000.LOG是inactive的



来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/8520577/viewspace-2744266/,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论
曾从事java方向开发多年。近年已经转入数据库方向。主要擅长SQL优化,Oracle数据库问题诊断,Oracle备份与恢复等。服务于医药物流,医院等行业

注册时间:2010-01-26

  • 博文量
    582
  • 访问量
    948525