Everything You Wanted to Know about DB2 Logs, but Were Afraid to Ask. Paul Pendle, Rocket Software Session: 16906



Similar documents
CA Log Analyzer for DB2 for z/os

The DB2 for z/os Catalog and Directory Is There Any Data More Important?

IBM DB2 Recovery Expert June 11, 2015

Best Practices for DB2 on z/os Backup and Recovery

Ingres Backup and Recovery. Bruno Bompar Senior Manager Customer Support

DB2 backup and recovery

DB2 for z/os Backup and Recovery: Basics, Best Practices, and What's New

Session: Archiving DB2 comes to the rescue (twice) Steve Thomas CA Technologies. Tuesday Nov 18th 10:00 Platform: z/os

How To Improve Your Database Performance

Oracle Database Links Part 2 - Distributed Transactions Written and presented by Joel Goodman October 15th 2009

CHAPTER 2 DATABASE MANAGEMENT SYSTEM AND SECURITY

New Security Options in DB2 for z/os Release 9 and 10

Simplify and Improve Database Administration by Leveraging Your Storage System. Ron Haupert Rocket Software

SAP HANA Backup and Recovery (Overview, SPS08)

Netezza PureData System Administration Course

Oracle Architecture. Overview

Data Propagator. author:mrktheni Page 1/11

Oracle 11g Database Administration

Oracle Database: SQL and PL/SQL Fundamentals NEW

Oracle. Brief Course Content This course can be done in modular form as per the detail below. ORA-1 Oracle Database 10g: SQL 4 Weeks 4000/-

DB2 for z/os: [Some] Backup and Recovery Utility Enhancements in V8/9/10

OLTP Meets Bigdata, Challenges, Options, and Future Saibabu Devabhaktuni

Unit 12 Database Recovery

Oracle 11gR2 : Recover dropped tablespace using RMAN tablespace point in time recovery

CICS Transactions Measurement with no Pain

Oracle DBA Course Contents

ORACLE DATABASE 11G: COMPLETE

Database Disaster Recovery using only RMAN Backups

50238: Introduction to SQL Server 2008 Administration

IMS Disaster Recovery Overview

Backup and Recovery. What Backup, Recovery, and Disaster Recovery Mean to Your SQL Anywhere Databases

Oracle Total Recall with Oracle Database 11g Release 2

Oracle Database 11 g Performance Tuning. Recipes. Sam R. Alapati Darl Kuhn Bill Padfield. Apress*

Database as a Service (DaaS) Version 1.02

Informatica ILM Archive and Application Retirement

Concepts of Database Management Seventh Edition. Chapter 7 DBMS Functions

Recovery System C H A P T E R16. Practice Exercises

Information Systems. Computer Science Department ETH Zurich Spring 2012

Administering a Microsoft SQL Server 2000 Database

Database 10g Edition: All possible 10g features, either bundled or available at additional cost.

Configuring and Integrating Oracle

DBACockpit for Oracle. Dr. Ralf Hackmann SAP AG - CoE EMEA Tech Appl. Platf. DOAG St. Leon-Rot 02. July 2013

Oracle 12c Recovering a lost /corrupted table from RMAN Backup after user error or application issue

SAP HANA - Main Memory Technology: A Challenge for Development of Business Applications. Jürgen Primsch, SAP AG July 2011

1.264 Lecture 15. SQL transactions, security, indexes

DB2 for z/os: Disaster Recovery for the Rest of Us

Workflow Templates Library

DB2 Backup and Recovery

Oracle Database Backup & Recovery, Flashback* Whatever, & Data Guard

Data Warehouse Center Administration Guide

Sanovi DRM for Oracle Database

Course Syllabus. Microsoft Dynamics GP Installation & Configuration. Key Data. Introduction. Audience. At Course Completion

SAP Note FAQ: SAP HANA Database Backup & Recovery

Lotus Domino 8 Monitoring and Maintenance

MCSE Objectives. Exam : TS:Exchange Server 2007, Configuring

5. CHANGING STRUCTURE AND DATA

Backup and Recovery...

Oracle Database 10g: Introduction to SQL

DBAs having to manage DB2 on multiple platforms will find this information essential.

Informatica Data Replication FAQs

Oracle Backup and Recover 101. Osborne Press ISBN

IBM DB2 Universal Database. Glossary. Version 8

SQL Replication Guide and Reference

Optimizing the Performance of the Oracle BI Applications using Oracle Datawarehousing Features and Oracle DAC

Using RMAN to restore a database to another server in an ASM environment

Chapter 13 File and Database Systems

Chapter 13 File and Database Systems

UVA. Failure and Recovery. Failure and inconsistency. - transaction failures - system failures - media failures. Principle of recovery

The safer, easier way to help you pass any IT exams. Exam : 1Z Upgrade Oracle9i/10g/11g OCA to Oracle Database 12c OCP.

If you have not multiplexed your online redo logs, then you are only left with incomplete recovery. Your steps are as follows:

Best practices for operational excellence (SharePoint Server 2010)

Chancery SMS Database Split

Together with SAP MaxDB database tools, you can use third-party backup tools to backup and restore data. You can use third-party backup tools for the

- 1 - Guidance for the use of the WEB-tool for UWWTD reporting

Backup and Restore Back to Basics with SQL LiteSpeed

Datenbanksysteme II: Implementation of Database Systems Recovery Undo / Redo

SQL Server 2008 Designing, Optimizing, and Maintaining a Database Session 1

Oracle 10g PL/SQL Training

DB2 for z/os System Level Backup Update

Restore and Recovery Tasks. Copyright 2009, Oracle. All rights reserved.

SQL SERVER Anti-Forensics. Cesar Cerrudo

ASG-Rochade Backing up Rochade Databases Quick Start Guide

Data Warehousing With DB2 for z/os... Again!

Microsoft SQL Server Security & Auditing. March 23, 2011 ISACA Chapter Meeting

EVENT LOG MANAGEMENT...

12. User-managed and RMAN-based backups.

MOC 20462C: Administering Microsoft SQL Server Databases

Using MySQL for Big Data Advantage Integrate for Insight Sastry Vedantam

Version 5.0. MIMIX ha1 and MIMIX ha Lite for IBM i5/os. Using MIMIX. Published: May 2008 level Copyrights, Trademarks, and Notices

Adaptive Server Enterprise

Monitoring System Status

Microsoft SQL Database Administrator Certification

How to Implement Multi-way Active/Active Replication SIMPLY

IBM InfoSphere Guardium for DB2 on z/os Technical Deep Dive

RMAN What is Rman Why use Rman Understanding The Rman Architecture Taking Backup in Non archive Backup Mode Taking Backup in archive Mode

SAP Performance Review/System Health Check

Backup and Recovery. Presented by DB2 Developer Domain

AV-004: Administering and Programming with ORACLE

Transcription:

Everything You Wanted to Know about DB2 Logs, but Were Afraid to Ask Paul Pendle, Rocket Software Session: 16906

Agenda DB2 Logs Introduction DB2 Logging Components Log Performance How to Leverage the DB2 Log DIY Log Analysis DB2 Log Analysis Tool

DB2 Log Introduction Central to every updating transaction Key resource for DB2 Integrity Recovery Bottleneck for transactional activity DB2 TX Logs

What s in a Log? Unit of recovery Checkpoint data Database page set control records Other miscellaneous stuff!

Unit of Recovery Data Type of activity (Insert, Update, Delete) Before and after images of rows/columns Redo and undo records Authid and plan name DBNAME and TSNAME DBID, PSID, OBID Compensatory log records RBA/LRSN (URID)

RBA and LRSN Changed from 6 bytes to 10 bytes with version 11 RBA (non-data-sharing) Ever increasing hexadecimal number LRSN (data sharing) Based on timestamps from the Sysplex Timer Starts with 0 when a new (non-data sharing) DB2 subsystem is started. Each log record is assigned a unique RBA/LRSN (URID) Increases with change activity Tracked in the BSDS

Checkpoint Log Record Triggers Elapsed time Number of log records CHECKPOINT FREQ Log switch End of successful restart Normal termination

Other Quirky Log Content Dataset creation and deletion Database Exception (DBET) -DIS DATABASE(name) RESTRICT Compression dictionaries (v11)

Image Copies Registered in the Log DSNDB01.SYSUTILX DSNDB01.DBD01 DSNDB06.SYSCOPY DSNDB01.SYSDBDXA

DB2 LOGGING COMPONENTS

DB2 Log Components Active Logs Archive Logs LOG 1 LOG 1 Arch N LOG 1 LOG 2 Arch N+1 LOG 1 LOG 3 Arch N+2

BSDS and the Logs Manages logs (active and archive) Tracks Active Logs and RBA range Archive Logs Recent log point Checkpoints

DSNJU003 (Change Log Inventory) Add or delete active or archive log data sets Add or delete checkpoint records Modify the value for the highest-written log RBA value or the highest-offloaded RBA value Other non-log stuff

DSNJU004 (Print Log Map) Log data set name, log RBA association, and log LRSN for both copy 1 and copy 2 of all active and archive log data sets Active log data sets that are available for new log data Contents of the checkpoint queue Archive log command history Other stuff

DSNZPARMs for Logs DSN6LOGP DEALLCT=(0000), MAXARCH=10000, MAXRTU=2, OUTBUFF=4000, TWOACTV=YES, TWOARCH=YES, ARC2FRST=NO ARCHIVE LOG FREQ ARCHIVE LOG RACF MAXARCH

LOG PERFORMANCE

Improving Log Performance Separate Archive logs and Active logs Separate volumes (physical disks if you can) Separate log copies (as above) Make log output buffers as large as feasible (OUTBUFF) VSAM stripe DB2 logs (or not!) generally unnecessary with the latest devices Remote replication considerations Latency introduction by synchronous array replication

DB2 Commit Process LOG TS DB2 App read Update Commit Wait t1 t2 t3 t4 t5

Synchronous Array Replication DB2 commit CE/DE PPRC / SRDF / Truecopy PPRC / SRDF /Truecopy Local Array Remote Array

zhyperwrite (Dec 2014) Reduces latency of synchronous replication New function provided by OA45662 (OA45125,OA44973,PI25747) IECIOSxx HYPERWRITE=yes/no SETIOS HYPERWRITE={YES NO} Pre-requisites z/os 2.1, Hyperswap/TPC-R Hyperswap/PPRC DS8870 (w/specific MCL)

Data Capture Changes Logs more data into the log Whole rows rather than single columns Provides an in-record context for an update

HOW TO LEVERAGE THE DB2 LOG

Log Data Use Cases Reporting of DB2 log activity Auditing of DB2 update, insert, delete activity Recovery of DB2 data Replication of DB2 activity

Reporting on DB2 Activity Change activity level and tracking Application RI reporting DDL tracking and reporting Report on non-z change activity

Auditing Catalog Changes Report activity affecting DB2 catalog objects Display INSERT, UPDATE, and DELETE activity Translate the activity to GRANT, REVOKE CREATE, ALTER, DROP Display the timestamp when the action occurred

Change Activity Auditing Who changed what and when Plan name Package name Table name Activity (insert, update, delete) Values (before and after) Show the sequence of the changes Valuable data for security-sensitive information Text alerts for unexpected changes

DB2 Log Auditing Monitor/Audit table activity UPDATE/INSERT/DELETE Who is changing data? What is the sequence of the changes? Load reports into audit tables for review

Recovery Possibilities Generate SQL to UNDO or REDO changes recorded in the log Support for dropped object recovery Report on and recover data for dropped objects After DDL is recreated, restore the data in the regenerated table back to its state prior to the table being dropped

Replication Possibilities Replay changes on another system / object LOAD or REDO SQL Used for data warehousing / internal processes Used for setting up test systems Use production data for authentic application testing

DIY LOG ANALYSIS

Log Record Structures Physical Records VSAM CI VSAM CI VSAM CI VSAM CI Logical Logical Logical Logical PT1 PT2 PT1 PT2 PT3

Log Record Types Record Type Event Type #Sub Types 0002 Page set control 9 0004 SYSCOPY utility 0010 System event 0020 Unit of recovery control 11 0100 Checkpoint 2 0200 Unit of recovery undo 0400 Unit of recovery redo 0800 Archive log command 2200 Savepoint 2 4200 End of rollback to savepoint 2 4400 Alter or modify recovery log record 1 sdsnmacs(dsndqj00)

Accessing the Log Data Using IFI -START TRACE(P) CLASS(30) IFCID(126) DEST(OPX) Real time access to log buffers in the online performance buffer Synchronous Asynchronous Log Capture Exit routine Performance critical exit DSNJL004

Image Copy Requirements Interrogate SYSCOPY Allocate the IMAGE COPY Reverse engineer the IMAGE COPY data pages Baseline the row content Data Capture Changes

Managing Odd Log events REORGs Not logged activities Adding Columns Table Versioning LOADs Compression dictionary rebuilds

Managing Compression Compressed rows require a compression dictionary to decompress Which compression dictionary? REORG kept/redefined CD? Understanding the CD layout How to reverse engineer the CD? How volatile is the structure?

SYSIBM.SYSLGRNX Arch1 Arch5 DB2 Directory SYSLGRNX Arch2 Arch3 Arch4 Arch6 Arch7 Arch8

Can DSN1LOGP help? Prints log records from active or archive logs Breaks up the physical records into logical records Still unformatted Useful for debugging your DYI code

DB2 LOG ANALYSIS TOOL

IBM DB2 Log Analysis Tool (LAT) Provides robust: Reporting/Auditing Recovery Replication Always day one support for new DB2 versions Even DB2 11 with the RBA size change Extensive use of ZIIP processors

LAT Reporting General report and detail report Custom reports by filter: Authid Plan Table owner/name Database, table space ID (OBID, PSID, DBID) Time range URID Activity (U/I/D)

General Report (1)

General Report (2)

LAT Recovery Dropped object Support this effort though DML Surgical transaction removal Through SQL engine Recovery to earlier state using SQL engine Backwards or forwards

Replication Create load files for other DB2 systems Create CSV, EBCDIC files Create fixed column output files (v3.5)

Summary The DB2 LOG contains a wealth of data that can be used for: Auditing Replication Recovery It can be processed by home-grown programs IBM DB2 Log Analysis Tool is a good alternative

References http://www-03.ibm.com/software/products/en/db2lat DB2 Admin Guide (Chapter 14)

Everything You Wanted to Know about DB2 Logs, but Were Afraid to Ask Paul Pendle, Rocket Software Session: 16906