DB2 offline and online full backup, Incremental backup, and recovery operations

Source: Internet
Author: User

The following articles mainly describe the correct operation steps for offline and online full backup, Incremental backup, and recovery of DB2, the following is a detailed description of the correct operation steps for DB2 offline and online full backup, Incremental backup, and recovery.

DB2 offline, online full backup, Incremental backup, recovery

DB2 offline and online full backup, Incremental backup and recovery operations

1. Full offline backup

1) first, make sure that no user uses DB2:

 
 
  1. $db2 list applications for db sample  

2) Stop the database and restart it to disconnect all connections:

 
 
  1. db2stop force   
  2. db2start  

3) execute the BACKUP command: Use TSM as the backup media)

 
 
  1. db2 backup db sample use tsm  

If the backup is successful, a timestamp is returned.

4) check that the backup is successful:

Db2 list history backup all for sample. You can see that this backup record is missing.

The return value can also be seen in the Db2adutl query command.

5) Remarks:

First, execute the BACKUP command on the nodes where the catalog tablespace is located on the master node, and then perform this operation on other nodes.

2. Online backup:

1) First, open the database configuration parameters that support online backup:

Db2 update db cfg for sample using userexit on Enable User exit

Db2 update db cfg for sample using logretain on enable archiving logs

Db2 update db cfg for sample using trackmod on enable Incremental Backup

(Each Node must be set separately)

After these parameters are enabled, the database is in the backup pending state, and DB2 offline full backup is required. Perform full offline backup. Refer to the above command.

2) The online backup command is as follows:

 
 
  1. db2 backup db sample online use tsm  

If the backup is successful, a timestamp is returned.

3) You can also use db2adutl and db2 list history to view backup records.

4) Remarks:

Similarly, this operation is performed on each node.

3. Online Incremental Backup

1) when three required parameters are enabled, perform Incremental Backup:

 
 
  1. db2 backup db sample online incremental use tsm  

If the backup is successful, a timestamp is returned.

2) You can also use db2adutl and db2 list history to view backup records.

3) There is also a delta backup:

 
 
  1. db2 backup db sample online incremental delta use tsm  

The difference between the two backups is similar to the Incremental and Cumulative modes of Oracle Exports. The incremental method of db2 corresponds to the cumulative mode of oracle, while the delta mode of db2 corresponds to the incremental mode of oracle.

4) Note: perform this operation on each node.

4. Restore the database

1) manually drop the database to simulate disaster recovery. perform the following operations:

 
 
  1. db2 drop db sample  

2) restore the backup history every time, regardless of the type, the history file will be backed up ). The timestamp here should be the latest:

 
 
  1. db2 restore db sample history file use tsm taken at 20030102223107 buffer 100  

3) use the db2 recovery help tool:

 
 
  1. db2ckrst -d sample -t 20030101224424 -r database  

Command to return the recommended required recovery operation command.

4) follow the prompts of the help tool to restore the version first. The recovery command is as follows:

 
 
  1. db2 restore db sample incremental use tsm taken at 20030101224424 buffer 100  

Recover the master node and other nodes.

5) when the database is in the rollforward-pending state, you need to perform the roll forward operation:

 
 
  1. db2 rollforward db sample to 2003-01-12-13.27.25.000000 on all nodes and stop  

Roll to the same time point. This operation must be performed on the master node.

5. Instructions:

1) recovery operations also have online and offline operations, just like backup operations.

2) Add the TABLESPACE clause (tablespace-name) according to the backup and recovery of the TABLESPACE. Tablespace-level backup/recovery operations require that the database be in the archive log and Incremental backup mode.

3) In the recovery example, only version recovery is performed. If there is an updated full backup and Incremental backup image, you can perform restoration in sequence. Note that the recommended restoration sequence and number of times for db2ckrst are used.
The above content describes the offline and online full backup, Incremental backup, and recovery operations of DB2. We hope 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.