DB2 Online backup operation solution "feast"

Source: Internet
Author: User

The following articles mainly describe the actual operation solution of DB2 Online backup. This article describes how to modify Database parameters and modify the relevant parameters of database online backup, the following describes the main content of the text.

Online, solution Online, Solution

Modify database Parameters

Modify online database backup Parameters

 
 
  1. db2 update db cfg using logretain recovery  
  2. db2 update db cfg using userexit yes  
  3. db2 update db cfg using trackmod yes  

Offline DB2 Online backup database

 
 
  1. db2 terminate  
  2. db2 backup db qncenter to /home/db2inst1  

2. modify the program

Copy source program

 
 
  1. cp /home/db2inst1/sqllib/samples/c/ db2uext2.cdisk /home/db2inst1/sqllib/adm/db2uext2.c  
  2. vi /home/db2inst1/sqllib/adm/db2uext2.c  

Modify content

 
 
  1. define ARCHIVE_PATH "/db2log/"  
  2. define RETRIEVE_PATH "/db2log/"  
  3. define AUDIT_ACTIVE 1  
  4. define ERROR_ACTIVE 1  
  5. define AUDIT_ERROR_PATH "/db2log/"  
  6. define AUDIT_ERROR_ATTR "a"  
  7. define BUFFER_SIZE 32  

Compile

 
 
  1. cc -D_INCLUDE_POSIX_SOURCE db2uext2.c -o db2uext2 

3. Configure the Archive Log Path

Create path

 
 
  1. su – root  
  2. mkdir /db2log/ QNCENTER/NODE0000  

Grant recursive permission to each directory in the directory structure

 
 
  1. chmod 777 /db2log 

Change Group

 
 
  1. chown -R db2inst1:db2grp1 /db2log 

4. Set the DB2 Online backup script

Online full backup

 
 
  1. db2 backup db qncenter online to /home/db2inst1/ >`date +%Y%m%d`.bklog 2>&1 

Online Incremental Backup

 
 
  1. db2 backup db qncenter online incremental delta to /home/db2inst1 >`date +%Y%m%d`.bklog 2>&1 

Back up Archive Log

 
 
  1. tar zcvf $`date +%Y%m%d`_arc.tar.gz /db2log/CEILING 

5. database recovery plan

Restore Archive Log

Tar xvf $ 'date when policyuncdomaind'_arc.tar.gz

To recover the database, you must ensure that the database has a full backup.

Media recovery

 
 
  1. db2 restore db qncenter from /home/db2inst1 taken at Timestamp 

Perform Archive Log rollback

 
 
  1. db2 rollforward database qncenter to end of logs and stop 

If archive logs are backed up offline

 
 
  1. db2 restore db qncenter from /home/db2inst1 taken at Timestamp  
  2. db2 rollforward database qncenter to end of logs and stop  

Offline backup

 
 
  1. db2 backup db qncenter to /home/db2inst1/ 

If there is no archive log for offline backup

 
 
  1. db2 restore db qncenter from /home/db2inst1 taken at Timestamp without rolling forward  

The above content is a description of the DB2 Online backup solution, hoping to help you in this regard.

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.