The following articles mainly describe the steps for restoring a database through DB2 backup and recovery.) I am a fan of DB2 databases. I am interested in understanding all the knowledge of DB2, although I was just familiar with the DB2 database, I sorted out the backup steps and shared them. Please correct me if something is wrong !!
1. Set archiving parameters:
1. db2 update db cfg for <db_name> using implements logpath/home/db2inst1/mirror_log // mirror log
2. db2 get db cfg for <db_name> // check whether the operation is successful.
3. db2 update db cfg for <db_name> using userexit on // Enable User exit
4. db2 update db cfg for <db_name> using logretain on // enable archiving logs
5. db2 update db cfg for <db_name> using trackmod on // enable the Incremental backup function
6. db2stop force
7. db2start
8. After db2 backup db <db_name> to/home/db2inst1/off_back // starts the preceding parameter, the database is in the backup pending state and requires offline backup of the database, otherwise, the SQL1116N error is displayed.
Ii. Back up online databases
9. db2 backup db <db_name> online to/home/db2inst1/on_back // online backup
10. db2 backup db <db_name> online incremental to/home/db2inst1/on_back // perform incremental backup online
11. db2 list history backup all for <db_name> // view backup records
12. db2 get db cfg for <db_name> // view the location of the log, cp to a secure directory for rollforward.
13. db2stop force; db2start; db2 drop db <db_name> // manually drop the database to simulate disaster recovery
3. Restore Online Databases
14. db2ckrst-d <db_name>-t 20070608032820-r database // The help tool prompts restoration.
15. db2 restore db <db_name> incremental from/home/db2inst1/on_back taken at 20070608032820 // restore the data file
Recover the full backup first, and then restore the Incremental backup. You cannot automatically find the full backup file.
16. db2 rollforward database <db_name> to end of logs and complete overflow log path '(/home/db2inst1/log)' // roll back the log
The above content is an introduction to the steps for restoring the database from the DB2 DB2 backup and recovery. I hope you will get some benefits.
The above content is the description of the steps for restoring the database from the DB2 DB2 backup and recovery. We hope to provide you with some help in this regard.