Demonstration of online backup recovery for DB2 Databases

Source: Internet
Author: User

The following articles mainly describe the online backup and recovery practices of the DB2 database. If you are curious about the practices of online backup and recovery of the DB2 database, this article will unveil the mystery of this article, the following is a detailed description of the article.

Database, practice, online

Enable online backup

Enable log Archiving

 
 
  1. db2 update db cfg for test using LOGRETAIN ON 

Set the log archiving directory

 
 
  1. db2 update db cfg for test using LOGARCHMETH1 DISK:/db2/data/logs 

Make an offline backup; otherwise, the DB2 database will not be able to log on.

 
 
  1. db2 backup db test to /db2/data/backup 

Online backup

Online backup-the first activity log in the backup log will be backed up to the backup file together)

 
 
  1. db2 backup db test online to /db2/data/backup/ include logs 

Online backup-do not back up logs

 
 
  1. db2 backup db test online to /db2/data/backup/ 

Recover from a backup set containing logs

Restore

 
 
  1. db2 RESTORE db test  
  2. FROM /db2/data/backup taken at 20100514001917 LOGTARGET /db2/data/logs/ 

Roll Forward

 
 
  1. db2 "rollforward db test to end of logs and stop overflow log path(/db2/data/logs/)" 

Note that other archive logs are generated at intervals from the backup success to the DB2 database crash. You can copy these logs to/db2/data/logs, or you can directly roll back from the archive log directory, the same as "Roll Back" in "Backup set recovery without logs ")

Recover a backup set that never contains logs

Restore

 
 
  1. db2 RESTORE db test  
  2. FROM /db2/data/backup taken at 20100514001917  

Roll Forward

Db2 "rollforward db test to end of logs and stop overflow log path (/archive log directory /)"

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.