A detailed description of the DB2 Online backup solution

Source: Internet
Author: User

The following articles mainly describe the DB2 Online backup solution. The following describes the specific content of the DB2 Online backup solution and hope it will help you in your future studies. If you are interested in the actual operations, you can click to view the following articles.

Online, Solution

Modify database Parameters

# Modifying database DB2 Online 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 database backup

 
 
  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

# Creating a path

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

# Grant recursive permission to each directory in the directory structure

 
 
  1. chmod 777 /db2log 

# Changing a group

 
 
  1. chown -R db2inst1:db2grp1 /db2log 

4. Set backup script

# Online full DB2 Online 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 

# Backing up Archive Log

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

5. database recovery plan

# Restore an Archive Log

 
 
  1. tar xvf $`date +%Y%m%d`_arc.tar.gz 

# Make sure that the database has a full backup.

# Media recovery

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

# Archive Log rollback

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

# Archive logs for DB2 Online backups

 
 
  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 an introduction to the DB2 Online backup solution. I hope you will have some gains.

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.