Table of Contents
A DB2 Performance Tuning Roadmap --LOG INTRODUCTION
1 LOG OVERVIEW
DB2 LOG FUNDAMENTALS
2 UNDERSTANDING OF LOG
LOG IMPLEMENTATION
LOG STRUCTURE
LOG USAGE
LOG UTILITES,WORKING WITH THE LOG
LOG RELATED DATASET
LOG PAGE FORMAT
Home php教程 php手册 A DB2 Performance Tuning Roadmap --LOG INTRODUCTION

A DB2 Performance Tuning Roadmap --LOG INTRODUCTION

Jun 13, 2016 am 08:46 AM
android

A DB2 Performance Tuning Roadmap --LOG INTRODUCTION

本文的内容是在整理报表时,对DB2 STAT LOG AVITIVITY部分的一个补充,主要介绍了DB2 LOG作用,overhead,涉及的部件以及部件之间的工作机制如何利用DB2 log,现有的IBM 提供的 DB2 Log utilities。最后对DB2 log的逻辑给出一个感性的认识。
  • 1 LOG OVERVIEW
    • DB2 LOG FUNDAMENTALS
      • LOG AIM:
      • WHY NEED LOGGING
      • IN PERFECT WORLD
      • OVERVIEW OF LOG WORK MECHANISM
  • 2 UNDERSTANDING OF LOG
    • LOG IMPLEMENTATION
      • 1 LOG RBA
      • 2 WHEN DATA SHARING INVOLED-LRSN
      • 3 LOG PAGE DATA SETS
        • FACTORS OF ACTIVE LOG DATA SETS:
        • BSDS – Boot Strap Data Set
        • SYSLGRNX-DLD
        • FACTORS OF ARCHIVE LOG DATASETS
    • LOG STRUCTURE
      • WHAT IS BEING LOGGED?
        • INFORMATION OF UR
        • PAGE SET INFORMATION
        • RECOVERY INFOMATION FOR
        • SYSTEM CHECKPOINTS
        • UNDO/REDO LOG EXMPLAE
        • COMPENSATION OF LOG EXMPLE
        • RECOVERY INFORMATION EXAMPLE
        • SYSTEM CHECKPOINTS DETAIL
      • WHEN IS LOGGING
    • LOG USAGE
      • Start DB2
      • Recovery of objects
      • REPLICATION
      • SOX Compliance
      • HEALTH CHECKS
    • LOG UTILITES,WORKING WITH THE LOG
      • DSN1LOGP
      • DSNJU004、DSNJU003
        • DSNJU004
        • DSNJU003 (a.k.a Change Log Inventory)
      • DSNJLOGF
      • RECOVER BSDS
        • #RECOVER BSDS
  • LOG RELATED DATASET
    • LOG PAGE FORMAT


1 LOG OVERVIEW

DB2 LOG FUNDAMENTALS

LOG AIM:

The DB2 log has two main functions: to reapply or back out units of recovery, and to rebuild DB2 back to a consistent state in the event of a failure

WHY NEED LOGGING
  1. overhead
  2. it costs in ters of performance,dasd,dministration,cleanup
  3. it's assurance-just in case of an accidentIN PERFECT WORLD
    1. no need to rollback
    2. no need to recover
    3. no program errors
    4. no hardware errors
    5. no power failtures
    6. no hurricances,terror attacks,fraud....

Let’s get the MOST out of the LOG since it’s here

OVERVIEW OF LOG WORK MECHANISM


USAGE OF EACH COMPONENTS

  1. Active logs
    Where DB2 puts the current log information
  2. Log Buffers
    Where log information is held BEFORE externalisation to DASD
  3. Bootstrap Datasets
    These hold information about the current active and archive log datasets
  4. Archive logs
    These are copies of ‘old’ active log datasets
  5. SYSLGRNX
    DB2 keeps track of WHEN objects are (possibly) being updated

2 UNDERSTANDING OF LOG

LOG IMPLEMENTATION

1 LOG RBA

BYTE ADDRESSABLE(RBA=RELATIVE BYTE ADDRESS)
RBA START=0X00000000000
RBA END=0XFFFFFFFFFFF
RBA UNIQUELY DEFINE A LOG RECORD

2 WHEN DATA SHARING INVOLED-LRSN


LRSN=LOG SEQUENCE RANGE NUMBER,WHICH IS A MODIFIED TIMESTAMP BASE ON SYSPLEX STORCE CLOCK

3 LOG PAGE DATA SETS

LOG OUTPUTBUFFER
ACTIVE LOG
ARCHIVE LOG


WHEN DB2 GO TO THE LAST ACTIVE DATA SETS ,WRAP ROUND TO FIRST ACTIVE LOG DATA SETS

FACTORS OF ACTIVE LOG DATA SETS:
  1. ACTIVE LOG DATA SETS NUMBER
  2. ACTIVE LOG DATA SETS SIZE
  3. SINGLE OR DUAL ACTIVE LOG
  4. PERFORMANCE CONSIDERATION:
    1. FAST DASD
    2. CONSIDER STRIPPING
    3. DB2 ZPARM OUTBUFFER+ LOGAPSTG
BSDS – Boot Strap Data Set

? Name: catalog.BSDS01 and catalog.BSDS02
? Must be two identical datasets
? Contains highest RBA logged
? Contains active log description (begin – end RBA and status)
? Contains archive log description
? Dataset name
? Volume name
? RBA range
? Contains other necessary system information
? System checkpoint history, BP-description, CCSID info etc

SYSLGRNX-DLD

? Table in Directory so no user access available
? Contains the RBA when any tablespace or
partition is opened or closed for update
? Note this information is also in DB2 log
? SYSLGRNGX is used by DB2 to speed up
recovery by limiting the amount of log data which needs to be scanned
? MODIFY utility removes this information along with SYSCOPY rows

SYSLGRNGX is key to speeding up log processing during recovery Contains RBAs when tablespaces are open for update. Log ranges out ranges cannot contain updates for this tablespace and therefore we needed during the recovery process.SYSLGRNGX is also updated by running the Modify Recovery utility 
Copy after login
FACTORS OF ARCHIVE LOG DATASETS
  1. ALWAYS PRODUCE TWO FILES FOR ONE ACTIVE LOGS
    IT IS AN ASYNCHRONOUS PROCESS
    VCAT.ARCHLOGN.BNNNNNN
    CONTAINDS THE BSDS INFORMATION BEFORE ARCHIVE IS WRITTEN FIRST LOG BEING ARCHIVED,IS STILL KNOWN AS ACTIVE LOG IN BSDS 
    Copy after login
    VCAT.ARCHIVEN.ANNNNNN
    CONTAINS THE ACTUAL LOG FOR LOG RBA RANGE OF THAN LOG DATA SETSUPDATES BSDS WHEN COMPLETE 
    Copy after login
  2. DB2 ZPARMS ARCHPFX1+ARCHPFX2+TSTAMP=YES|NO|EXT
    VCAT.ARCHIVEN.DXXXXX.TXXXXX.BNNNNNNNN
  3. WHEN ARCHIVE:
    ACTIVE LOG FULL
    TRUNCATED:ARCHIVE LOG COMAMND OR ERROR

LOG STRUCTURE

WHAT IS BEING LOGGED?INFORMATION OF UR
  1. BEGIN/END UR INFORMATION
  2. UNDO/REDO STATEMENTS and compensation log rec
  3. commit rollback processing

PAGE SET INFORMATION
  1. OPEN/CLOSE PAGE SET
  2. PENDING STATUS INFORMATION(COPY,CHECK,REORG)
  3. START/STOP INFORMATION(include which mode ut)
  4. DBD INFORECOVERY INFOMATION FORINVOLED TABLES:
    SYSIBM.SYSUTILX SYSIBM.DBD01 SYSIBM.SYSCOPY 
    Copy after login
    SYSTEM CHECKPOINTSUNDO/REDO LOG EXMPLAE

UPDATE T
SET COL='BBB'
WHERE ID=1
LRH004A002F 06000001 0E800006 CEA48CC9 0006CEA4 8D590526 0006CEA4 8D59C7C0
AF504B23 0000

*LG** 80010C00 02000000 02000006 CEA4049E 2B02 0000 00120101 00030900 000600C2 C2C200C1 C1C1 
Copy after login

C2C2C2='BBB'
C1C1C1='AAA'
URID(0006CEA48CC9)RBA OF UR STARTED IN LOG
010C=DBID
0002==PAGE SET OBID
000000 02=PAGE ID

COMPENSATION OF LOG EXMPLE


In case of the example the current value is BBB and after the update it should become AAA, but for some reason a ROLLBACK occurs, in that
case DB2 needs to undo this update. This undo by itself is also being logged. These log records are called compensation log records.

SUBTYPE(UPDATE IN-PLACE IN A DATA PAGE) CLR(YES)*LG** 80010C00 02000000 02000006 CEA550BF AB00 0000 00120101 00030900 000600C2 C2C200C1 C1C1 
Copy after login

CLR(YES) which indicates it is a compensation log record

RECOVERY INFORMATION EXAMPLE

DB2 writes “syscopy” information for certain system tables to the log instead of writing it to syscopy. The reason is simple. In case of a
disaster recovery, we need to recover the system in precise steps.Meaning that certain system tables have to be recovered before we can recover sysibm.syscopy. Therefore the backup information of those objects is written to the log.

SYSTEM CHECKPOINTS DETAIL

SYSTEM CHECKPOINT (snapshot of activity on system)

  1. WHAT IS IN SYSTEM CHECKPOINT
    1. Entry per active thread (amongst other status inflight/in commit etc)
    2. Entry per open page set (including exception status)
    3. Page externalization
  2. How often should one be taken ?
    1. Every 3-5 minutes (many sites are at 15-20 minutes)
    2. CHKFREQ : V9 : # LOG records or # seconds
       V10: Minimum of # LOG records and # seconds 
      Copy after login
  3. Important for (re)start up performance
    ? Start up ALWAYS from LAST CHECKPOINT
WHEN IS LOGGING

As the work is being done
? In Log output buffer (OUTBUFF)
? Regularly flushed to Active Log Dataset
Sequentially first active copy1 then active copy2 (DB2 V10 应该是双写)

? At Commit
? At Rollback
? Log Write threshold (WRTHRSH 20 pages without commit)
? Archive log command
? System Checkpoint
? Log Write Ahead Force

LOG USAGE

Start DB2

4 phases :

  1. Log initialization
    Read/compare BSDS
    Find current active log dataset and end of log
  2. Current status rebuild
    Read last system checpoint
  3. Forward log recovery
    Do all work for INCOMMIT and INDOUBT threads
  4. Backward log recovery
    Do all work for INABORT and INFLIGHT threads
  5. ALWAYS start from LAST SYSTEM CHECKPOINT
    Amount of work varies (ab)normal shutdowN
Recovery of objects

DB2 新增了一个参数BACKOUT(YES),这个参数应该不是太常用,更多的情况应该是使用imgcopy+log的方式去追,即point-in-time,这里不进行介绍。

REPLICATION

现在IDC内相当火的一个topic,它是实现双活或是多活的基础,平台版本的DBMS也有实现,比如mysql的mater-slave方式,即mysql本身就支持,不需要新增软件,但是是单线程进行处理,为此很多vendors提供了增强版的版本使slave上支持并发。zos 上使用QREP+MQ实现,支持异构数据库,延迟可以控制在分钟以内。RPT=2MIN,RTO=2HOUR,

SOX Compliance

这个更多是的是内审,外审的用途。相对来说使用审计LOG的方式,成本还是比较高的,有alternative software。

HEALTH CHECKS

BEST PRACTICE,根据系统现在的运行情况,查看时候ACTIVE LOG,ACHIVE LOG是否运行异常。

LOG UTILITES,WORKING WITH THE LOG

多少一句,这个应该是目前平台比较欠缺的,可能目前也存在,只是我孤陋寡闻了。

DSN1LOGP

? Formats DB2 log in a readable output
? Detailed or summarized (SUMMARY(YES/NO/ONLY)
? Include page set status (DATAONLY(YES/NO)
? Include SYSCOPY info (SYSCOPY(YES/NO)
? Limit range (from – to)
? Limit scope (e.g. URID,DBID,)
? Cannot read current active log
? Cannot read compressed logs by DFSMS

DSNJU004、DSNJU003DSNJU004

Will list certain parts of the BSDS information
? Log data set name(s), log ranges, volume(s) etc
? Active log status
? Conditional restart history
? System checkpoint history
? Backup system history
? Archive log history
? CCSID information
? Does not show Buffer pool configuration
? Be careful time values are in GMT except LTIME column

DSNJU003 (a.k.a Change Log Inventory)

? Only runs when DB2 is down
? Allows to change BSDS content, USE WITH CARE!
? Add/Delete active and archive Logs
? Add/Delete system checkpoints
? Create conditional restart record (CRESTART)
? STARTRBA
? ENDRBA
? COLD START ? STARTRBA=ENDRBA
? Causes most of the time DATA LOSS

DSNJLOGF

DSNJLOGF
? Pre-formats new active log dataset
? Avoids delay at first use !!

RECOVER BSDS#RECOVER BSDS

? MUST have TWO identical BSDS to start up
? What if one BSDS is broken ?
? DSNJ126I I/O ERROR FORCED SINGLE BSDS
? Do NOT stop DB2
? Issue command –RECOVER BSDS ? automate this!
? What if one BSDS is broken at start up?
? DB2 does not start
? IDCAMS rename/define, REPRO

LOG PAGE FORMAT

对LOG PAGE 有一个感性认识,LOG 的逻辑结构复杂了,后续如果有需要在补充上吧。
1 BYTE=8BITS
1 NIBBLE=4BITS
LOG PAGE SIZE=4KB
LOG PAGE AVAIABLE SPACE=4075
LOG PAGE CONTROL INTERVAL
SIZE: LAST 21/X'15' BYTE OF PAGE
USAGE:CI DESCRIBE THE LOG PAGE
START RAB OF THE PAGE
LOG RBA DO NOT HAVE RBA-----IT'S START RBA of the page plus offset into page of the record
1 log rec maybe span may log pages
本文所有的内容均整理自互联网,仅供参考学习,如有涉及版权问题,请自行删除本文,谢谢。

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
2 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Repo: How To Revive Teammates
4 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Hello Kitty Island Adventure: How To Get Giant Seeds
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

New report delivers damning assessment of rumoured Samsung Galaxy S25, Galaxy S25 Plus and Galaxy S25 Ultra camera upgrades New report delivers damning assessment of rumoured Samsung Galaxy S25, Galaxy S25 Plus and Galaxy S25 Ultra camera upgrades Sep 12, 2024 pm 12:23 PM

In recent days, Ice Universe has been steadily revealing details about the Galaxy S25 Ultra, which is widely believed to be Samsung's next flagship smartphone. Among other things, the leaker claimed that Samsung only plans to bring one camera upgrade

Samsung Galaxy S25 Ultra leaks in first render images with rumoured design changes revealed Samsung Galaxy S25 Ultra leaks in first render images with rumoured design changes revealed Sep 11, 2024 am 06:37 AM

OnLeaks has now partnered with Android Headlines to provide a first look at the Galaxy S25 Ultra, a few days after a failed attempt to generate upwards of $4,000 from his X (formerly Twitter) followers. For context, the render images embedded below h

IFA 2024 | TCL\'s NXTPAPER 14 won\'t match the Galaxy Tab S10 Ultra in performance, but it nearly matches it in size IFA 2024 | TCL\'s NXTPAPER 14 won\'t match the Galaxy Tab S10 Ultra in performance, but it nearly matches it in size Sep 07, 2024 am 06:35 AM

Alongside announcing two new smartphones, TCL has also announced a new Android tablet called the NXTPAPER 14, and its massive screen size is one of its selling points. The NXTPAPER 14 features version 3.0 of TCL's signature brand of matte LCD panels

Vivo Y300 Pro packs 6,500 mAh battery in a slim 7.69 mm body Vivo Y300 Pro packs 6,500 mAh battery in a slim 7.69 mm body Sep 07, 2024 am 06:39 AM

The Vivo Y300 Pro just got fully revealed, and it's one of the slimmest mid-range Android phones with a large battery. To be exact, the smartphone is only 7.69 mm thick but features a 6,500 mAh battery. This is the same capacity as the recently launc

New report delivers damning assessment of rumoured Samsung Galaxy S25, Galaxy S25 Plus and Galaxy S25 Ultra camera upgrades New report delivers damning assessment of rumoured Samsung Galaxy S25, Galaxy S25 Plus and Galaxy S25 Ultra camera upgrades Sep 12, 2024 pm 12:22 PM

In recent days, Ice Universe has been steadily revealing details about the Galaxy S25 Ultra, which is widely believed to be Samsung's next flagship smartphone. Among other things, the leaker claimed that Samsung only plans to bring one camera upgrade

Samsung Galaxy S24 FE billed to launch for less than expected in four colours and two memory options Samsung Galaxy S24 FE billed to launch for less than expected in four colours and two memory options Sep 12, 2024 pm 09:21 PM

Samsung has not offered any hints yet about when it will update its Fan Edition (FE) smartphone series. As it stands, the Galaxy S23 FE remains the company's most recent edition, having been presented at the start of October 2023. However, plenty of

Motorola Razr 50s shows itself as possible new budget foldable in early leak Motorola Razr 50s shows itself as possible new budget foldable in early leak Sep 07, 2024 am 09:35 AM

Motorola has released countless devices this year, although only two of them are foldables. For context, while most of the world has received the pair as the Razr 50 and Razr 50 Ultra, Motorola offers them in North America as the Razr 2024 and Razr 2

Xiaomi Redmi Note 14 Pro Plus arrives as first Qualcomm Snapdragon 7s Gen 3 smartphone with Light Hunter 800 camera Xiaomi Redmi Note 14 Pro Plus arrives as first Qualcomm Snapdragon 7s Gen 3 smartphone with Light Hunter 800 camera Sep 27, 2024 am 06:23 AM

The Redmi Note 14 Pro Plus is now official as a direct successor to last year'sRedmi Note 13 Pro Plus(curr. $375 on Amazon). As expected, the Redmi Note 14 Pro Plus heads up the Redmi Note 14 series alongside theRedmi Note 14and Redmi Note 14 Pro. Li

See all articles