DB2 Backup and Recovery Cheat Sheet
- Jha Chandan

- Oct 8, 2021
- 2 min read
Backup and recovery strategies are intended to preserve the data secure. In Graphical User Interface (GUI) or Command Line Interface (CLI) utilizing backup and recovery utilities and can perform the backup or reestablish the information of databases in DB2 UDB.

In this blogpost you will see and learn Db2 Bufferpools related syntaxes and methods which help you using Db2 database product.
DB2 Database Backup
DB2 Database Backup command can duplicate the whole database. This backup duplicate incorporates the database informational files, controlled information system records, log records. A DB2 Backup consisting of:
Offline backup
Online backup
Offline backup
List the active applications/databases
db2 list application Terminate Database Connection
db2 terminate Deactivate Database
db2 deactivate database testdb Take the backup file
db2 backup database <db_name> to <location> Online backup
Check if the database is using circular or archive logging
db2 get db cfg for testdb | grep LOGARCH Updating logarchmeth1 with required archive directory
Make directories
mkdir OnlineBackup
mkdir OnlineBackup/ArchiveDest Provide user permissions for folder
chown db2inst1:db2iadm1 OnlineBackup/ArchiveDest Update configuration LOGARCHMETH1
db2 update database configuration for testdb using LOGARCHMETH1'DISK:/home/db2inst1/OnlineBackup/ArchiveDest'Take online backup
db2 backup database testdb online to
/home/db2inst1/OnlineBackup/ compress include logs Verify Backup
db2ckbkp <location/backup file> Listing the history of backup files
db2 list history backup all for testdbDB2 Database Restore
For restoring a database from backup all the necessary commands has to be performed for backing up the DB2 database.
Restore the database from backup file
db2 restore database <db_name> from <location>
taken at <timestamp> Roll forward all the logs located in the log directory, including the latest changes just before the disk drives failure.
db2 rollforward db <db_name> to end of logs and stop That's all in this post. If you liked this blog and interested in knowing more about IBM Db2. Please Like, Follow, Share & Subscribe to www.ImJhaChandan.com.











Comments