SlideShare a Scribd company logo
6
Most read
7
Most read
10
Most read
Backup and Recovery
     DB2 LUW




     Imran A Sayed
Logging
Circular logging (default)
Archival logging (Userexit or LOGARCHMETH1)
  Check archival logging is working
     db2 “archive log for db dbname”
     Check diag log
     db2pd –d dbname –logs
DB2 LUW - Backup and Recovery
Backup
Modes:-
     Offline
     Online


Granularity:-
     Database
     Tablespace
Backup Types
   Full
   Incremental
   [Incremental] Delta


NOTE: TRACMOD = YES for incremental backup
Backup checks
db2 list history backup since 20110101 for db
dbname
SQL to check last 7 successful backup
SELECT DISTINCT START_TIME,END_TIME,OPERATIONTYPE,
FROM SYSIBMADM.DB_HISTORY
WHERE OPERATION = 'B' AND
SQLCODE IS NULL
ORDER BY START_TIME DESC
FETCH FIRST 7 ROWS ONLY;

db2ckbkp can be used to check backup image
consistency
HANDY SQL
Check average and maximum time to perform full backup
(Change operation type to check for other types of backup, N denotes full online backup)
                                                             denotes
SELECT DBPARTITIONNUM,
AVG(TIMESTAMPDIFF(4,CHAR(TIMESTAMP(END_TIME) -
   TIMESTAMP(START_TIME)))) AS AVG_BTIME_MNS,
      MAX(TIMESTAMPDIFF(4,CHAR(TIMESTAMP(END_TIME) -
   TIMESTAMP(START_TIME)))) AS MAX_BTIME_MNS
FROM SYSIBMADM.DB_HISTORY
WHERE OPERATION = 'B'
    AND OPERATIONTYPE = 'N'
group by DBPARTITIONNUM;
Recovery
Types of recovery
   Crash Recovery
   Version Recovery
   Roll-forward Recovery

DB2 provides three commands to perform recovery
   Restart
   Restore
   Recover
Crash Recovery
Crash recovery can be performed when transactions
terminates abnormally
Restart database when the database has been stopped
abnormally for eg: power failure (this marks the
database as non accessible)
Crash recovery moves back database to consistent state
either by rolling back or committing in memory
transactions
RESTART DATABASE DBNAME
AUTORESTART = ON, in db cfg allows database
manager to perform crash recovery automatically
Restore
Restoring from Offline backup (Version
Recovery)
  Simple restore command, specify the timestamp of the target backup image
Restoring from Online backup
  Restore operation followed by rollforward to either end of logs or PIT or end of
  backup (since v9.5)
Restoring from Incremental backup
  Restore the target image (last incremental image)
  Restore the full backup image
  Restore the rest of the backup images till the last incremental image in correct order as per
  requirement
  Restore the last incremental image
  Use automatic option in the restore command and specify last target
  image timestamp and db2 automatically does the above steps
  db2ckrst can also be used to check the sequence of images for restore
Redirect Restore
Start restore with the redirect option
Define the storage paths using set tablespace
containers command
Continue restoration using the continue option
Recover

Another command to perform restore
Provide the timestamp it will automatically
find out the backup images needed and
the logs needed for rollforward
Very useful if you want to perform roll
forward on a full offline backup image and
perform PIT recovery
Backup Autonomics
OPEN x sessions
INCLUDE LOGS
COMPRESS (only on tablespaces which are not already
compressed)
Let DB2 decide the other parameters
Forget Me Not
Recovery strategy
Time to recover
(RTO)
PIT to recover (RPO)
Backup time
Backup image size
Housekeeping
Check backup image
frequently
Appendix
Backup command
 http://publib.boulder.ibm.com/infocenter/db2luw/v9/index.jsp?topic=/com.ibm.db2.udb.admin.doc/doc/r0001933.htm
 http://publib.boulder.ibm.com/infocenter/db2luw/v9/index.jsp?topic=/com.ibm.db2.udb.admin.doc/doc/r0001933.htm


Restore command
 http://publib.boulder.ibm.com/infocenter/db2luw/v9/index.jsp?topic=/com.ibm.db2.udb.admin.doc/doc/r0001976.htm
 http://publib.boulder.ibm.com/infocenter/db2luw/v9/index.jsp?topic=/com.ibm.db2.udb.admin.doc/doc/r0001976.htm



Rollforward command
 http://publib.boulder.ibm.com/infocenter/db2luw/v9/index.jsp?topic=/com.ibm.db2.udb.admin.doc/doc/r0001978.htm
 http://publib.boulder.ibm.com/infocenter/db2luw/v9/index.jsp?topic=/com.ibm.db2.udb.admin.doc/doc/r0001978.htm


Author’s profile
 http://in.linkedin.com/in/imranasayed
THANK YOU!!!

More Related Content

PPT
IBM DB2 LUW UDB DBA Online Training by Etraining.guru
PDF
DB2 TABLESPACES
PDF
IBM DB2 for z/OS Administration Basics
 
PDF
Db2 recovery IDUG EMEA 2013
PDF
Practical Recipes for Daily DBA Activities using DB2 9 and 10 for z/OS
PPTX
DB2 Basic Commands - UDB
PDF
Db2 performance tuning for dummies
PPTX
Ibm db2
IBM DB2 LUW UDB DBA Online Training by Etraining.guru
DB2 TABLESPACES
IBM DB2 for z/OS Administration Basics
 
Db2 recovery IDUG EMEA 2013
Practical Recipes for Daily DBA Activities using DB2 9 and 10 for z/OS
DB2 Basic Commands - UDB
Db2 performance tuning for dummies
Ibm db2

What's hot (20)

DOCX
Db2 Important questions to read
PPTX
SKILLWISE-DB2 DBA
PDF
DB2 for z/OS Architecture in Nutshell
PDF
DB2 for z/OS - Starter's guide to memory monitoring and control
PPSX
Solving the DB2 LUW Administration Dilemma
PDF
DB2 for z/OS Real Storage Monitoring, Control and Planning
DOC
DB2 utilities
PPTX
Data base management system
PPT
DB2 Interview Questions - Part 1
PPT
Db2
PPT
DB2 and storage management
DOC
online training for IBM DB2 LUW UDB DBA
DOC
DB2 DOCUMENT
PDF
Best practices for DB2 for z/OS log based recovery
PDF
ALL ABOUT DB2 DSNZPARM
 
PPTX
Presentation db2 best practices for optimal performance
PPT
2 db2 instance creation
PPTX
Sql server basics
PDF
Rman Presentation
Db2 Important questions to read
SKILLWISE-DB2 DBA
DB2 for z/OS Architecture in Nutshell
DB2 for z/OS - Starter's guide to memory monitoring and control
Solving the DB2 LUW Administration Dilemma
DB2 for z/OS Real Storage Monitoring, Control and Planning
DB2 utilities
Data base management system
DB2 Interview Questions - Part 1
Db2
DB2 and storage management
online training for IBM DB2 LUW UDB DBA
DB2 DOCUMENT
Best practices for DB2 for z/OS log based recovery
ALL ABOUT DB2 DSNZPARM
 
Presentation db2 best practices for optimal performance
2 db2 instance creation
Sql server basics
Rman Presentation
Ad

Viewers also liked (20)

PDF
High Availability Options for DB2 Data Centre
PDF
DB2 pureScale Technology Preview
PPT
Multi-Dimensional Clustering: A High-Level Overview
PPTX
High availability and disaster recovery in IBM PureApplication System
TXT
Db2 zos-sharing
PDF
Understanding and controlling transaction logs
PPTX
Log based and Recovery with concurrent transaction
PPT
Dbms ii mca-ch12-security-2013
PPTX
D02 Evolution of the HADR tool
PDF
DB2 V 10 HADR Multiple Standby
PPTX
Data tabulation related to field force and field
PPTX
normaliztion
PPTX
5 normal forms in relational database theory
PPTX
File and data base management
PPT
Normalization case
PPTX
security and privacy in dbms and in sql database
PPT
Dbms ii mca-ch11-recovery-2013
PPT
Dbms ii mca-ch4-relational model-2013
PPTX
Reserch design and sample design
PPTX
Viewing transformation
High Availability Options for DB2 Data Centre
DB2 pureScale Technology Preview
Multi-Dimensional Clustering: A High-Level Overview
High availability and disaster recovery in IBM PureApplication System
Db2 zos-sharing
Understanding and controlling transaction logs
Log based and Recovery with concurrent transaction
Dbms ii mca-ch12-security-2013
D02 Evolution of the HADR tool
DB2 V 10 HADR Multiple Standby
Data tabulation related to field force and field
normaliztion
5 normal forms in relational database theory
File and data base management
Normalization case
security and privacy in dbms and in sql database
Dbms ii mca-ch11-recovery-2013
Dbms ii mca-ch4-relational model-2013
Reserch design and sample design
Viewing transformation
Ad

Similar to DB2 LUW - Backup and Recovery (20)

PDF
MySQL Backup & Recovery
PPTX
Backup and restore
PPT
Les 02 Config Rec
PPTX
Data Guard New Features
PPT
Les 06 Perform Rec
PPT
Less14 Br Concepts
PDF
[Altibase] 13 backup and recovery
PPT
Les 05 Create Bu
PPT
Oracle backup and recovery
PPT
DB2UDB_the_Basics Day 5
PPT
2011 384 hackworth_ppt
PPT
Les 07 Rman Rec
PPTX
What’s new in oracle 12c recovery manager (rman)
PPTX
Unit Three: Database Recovery Points & Procedures
DOC
Missing redo logs in oracle
DOCX
Cloning database using srdf copy
PDF
RMAN in 12c: The Next Generation (WP)
PPT
IT103Microsoft Windows XP/OS Chap15
PPT
Chapter19
DOC
Oracle data guard configuration in 12c
MySQL Backup & Recovery
Backup and restore
Les 02 Config Rec
Data Guard New Features
Les 06 Perform Rec
Less14 Br Concepts
[Altibase] 13 backup and recovery
Les 05 Create Bu
Oracle backup and recovery
DB2UDB_the_Basics Day 5
2011 384 hackworth_ppt
Les 07 Rman Rec
What’s new in oracle 12c recovery manager (rman)
Unit Three: Database Recovery Points & Procedures
Missing redo logs in oracle
Cloning database using srdf copy
RMAN in 12c: The Next Generation (WP)
IT103Microsoft Windows XP/OS Chap15
Chapter19
Oracle data guard configuration in 12c

Recently uploaded (20)

PDF
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
PDF
Approach and Philosophy of On baking technology
PDF
Review of recent advances in non-invasive hemoglobin estimation
PPTX
Digital-Transformation-Roadmap-for-Companies.pptx
PPT
Teaching material agriculture food technology
PPTX
Understanding_Digital_Forensics_Presentation.pptx
PDF
Building Integrated photovoltaic BIPV_UPV.pdf
PDF
Unlocking AI with Model Context Protocol (MCP)
PPTX
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
PDF
CIFDAQ's Market Insight: SEC Turns Pro Crypto
PDF
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
PPTX
Cloud computing and distributed systems.
PDF
Shreyas Phanse Resume: Experienced Backend Engineer | Java • Spring Boot • Ka...
PDF
Agricultural_Statistics_at_a_Glance_2022_0.pdf
PDF
Per capita expenditure prediction using model stacking based on satellite ima...
PPTX
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
PDF
The Rise and Fall of 3GPP – Time for a Sabbatical?
PDF
Modernizing your data center with Dell and AMD
PDF
Bridging biosciences and deep learning for revolutionary discoveries: a compr...
PPTX
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
Approach and Philosophy of On baking technology
Review of recent advances in non-invasive hemoglobin estimation
Digital-Transformation-Roadmap-for-Companies.pptx
Teaching material agriculture food technology
Understanding_Digital_Forensics_Presentation.pptx
Building Integrated photovoltaic BIPV_UPV.pdf
Unlocking AI with Model Context Protocol (MCP)
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
CIFDAQ's Market Insight: SEC Turns Pro Crypto
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
Cloud computing and distributed systems.
Shreyas Phanse Resume: Experienced Backend Engineer | Java • Spring Boot • Ka...
Agricultural_Statistics_at_a_Glance_2022_0.pdf
Per capita expenditure prediction using model stacking based on satellite ima...
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
The Rise and Fall of 3GPP – Time for a Sabbatical?
Modernizing your data center with Dell and AMD
Bridging biosciences and deep learning for revolutionary discoveries: a compr...
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...

DB2 LUW - Backup and Recovery

  • 1. Backup and Recovery DB2 LUW Imran A Sayed
  • 2. Logging Circular logging (default) Archival logging (Userexit or LOGARCHMETH1) Check archival logging is working db2 “archive log for db dbname” Check diag log db2pd –d dbname –logs
  • 4. Backup Modes:- Offline Online Granularity:- Database Tablespace
  • 5. Backup Types Full Incremental [Incremental] Delta NOTE: TRACMOD = YES for incremental backup
  • 6. Backup checks db2 list history backup since 20110101 for db dbname SQL to check last 7 successful backup SELECT DISTINCT START_TIME,END_TIME,OPERATIONTYPE, FROM SYSIBMADM.DB_HISTORY WHERE OPERATION = 'B' AND SQLCODE IS NULL ORDER BY START_TIME DESC FETCH FIRST 7 ROWS ONLY; db2ckbkp can be used to check backup image consistency
  • 7. HANDY SQL Check average and maximum time to perform full backup (Change operation type to check for other types of backup, N denotes full online backup) denotes SELECT DBPARTITIONNUM, AVG(TIMESTAMPDIFF(4,CHAR(TIMESTAMP(END_TIME) - TIMESTAMP(START_TIME)))) AS AVG_BTIME_MNS, MAX(TIMESTAMPDIFF(4,CHAR(TIMESTAMP(END_TIME) - TIMESTAMP(START_TIME)))) AS MAX_BTIME_MNS FROM SYSIBMADM.DB_HISTORY WHERE OPERATION = 'B' AND OPERATIONTYPE = 'N' group by DBPARTITIONNUM;
  • 8. Recovery Types of recovery Crash Recovery Version Recovery Roll-forward Recovery DB2 provides three commands to perform recovery Restart Restore Recover
  • 9. Crash Recovery Crash recovery can be performed when transactions terminates abnormally Restart database when the database has been stopped abnormally for eg: power failure (this marks the database as non accessible) Crash recovery moves back database to consistent state either by rolling back or committing in memory transactions RESTART DATABASE DBNAME AUTORESTART = ON, in db cfg allows database manager to perform crash recovery automatically
  • 10. Restore Restoring from Offline backup (Version Recovery) Simple restore command, specify the timestamp of the target backup image Restoring from Online backup Restore operation followed by rollforward to either end of logs or PIT or end of backup (since v9.5) Restoring from Incremental backup Restore the target image (last incremental image) Restore the full backup image Restore the rest of the backup images till the last incremental image in correct order as per requirement Restore the last incremental image Use automatic option in the restore command and specify last target image timestamp and db2 automatically does the above steps db2ckrst can also be used to check the sequence of images for restore
  • 11. Redirect Restore Start restore with the redirect option Define the storage paths using set tablespace containers command Continue restoration using the continue option
  • 12. Recover Another command to perform restore Provide the timestamp it will automatically find out the backup images needed and the logs needed for rollforward Very useful if you want to perform roll forward on a full offline backup image and perform PIT recovery
  • 13. Backup Autonomics OPEN x sessions INCLUDE LOGS COMPRESS (only on tablespaces which are not already compressed) Let DB2 decide the other parameters
  • 14. Forget Me Not Recovery strategy Time to recover (RTO) PIT to recover (RPO) Backup time Backup image size Housekeeping Check backup image frequently
  • 15. Appendix Backup command http://publib.boulder.ibm.com/infocenter/db2luw/v9/index.jsp?topic=/com.ibm.db2.udb.admin.doc/doc/r0001933.htm http://publib.boulder.ibm.com/infocenter/db2luw/v9/index.jsp?topic=/com.ibm.db2.udb.admin.doc/doc/r0001933.htm Restore command http://publib.boulder.ibm.com/infocenter/db2luw/v9/index.jsp?topic=/com.ibm.db2.udb.admin.doc/doc/r0001976.htm http://publib.boulder.ibm.com/infocenter/db2luw/v9/index.jsp?topic=/com.ibm.db2.udb.admin.doc/doc/r0001976.htm Rollforward command http://publib.boulder.ibm.com/infocenter/db2luw/v9/index.jsp?topic=/com.ibm.db2.udb.admin.doc/doc/r0001978.htm http://publib.boulder.ibm.com/infocenter/db2luw/v9/index.jsp?topic=/com.ibm.db2.udb.admin.doc/doc/r0001978.htm Author’s profile http://in.linkedin.com/in/imranasayed