How does one back up a DB2 database on AIX?

Source: Internet
Author: User

The following articles mainly describe the actual operation steps for backing up DB2 databases on AIX, as well as the notes worth attention during actual operations, the following is a detailed description of the procedure. I hope you will have a better understanding of the procedure.

AIX, DB2, Backup AIX, database

The procedure for offline and online full backup, Incremental backup, and recovery of the DB2 database is as follows:

1. Full offline backup

(1) first, make sure that no user uses DB2: $ db2 list applications for db sample

(2) Stop the database and restart it to disconnect all connections: db2stop force db2start

(3) execute the backup command: (using TSM as the backup medium) db2 backup db sample use tsm is successfully backed up and 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, run the BACKUP command on the master node (the node where the catalog tablespace is located), and then perform this operation on other nodes.

2. Online backup:

(1) first, open the DB2 database configuration parameters that support online backup:

 
 
  1. db2 update db cfg for sample using userexit on  

Enable User exit

 
 
  1. db2 update db cfg for sample using logretain on  

Enable archiving logs

 
 
  1. db2 update db cfg for sample using trackmod on  

After you enable the Incremental backup feature (each Node needs to set these parameters separately), the database is in the backup pending state and requires offline full backup of the DB2 database.

Perform full offline backup. Refer to the above command.

(2) The online backup command is as follows:

Db2 backup db sample online use tsm is successfully backed up and a timestamp is returned.

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

(4) Note: perform this operation on each node.

3. Online Incremental Backup

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

Db2 backup db sample online incremental use tsm is successfully backed up and 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 (each backup, regardless of the type, will back up the history file ).

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:

The db2ckrst-d sample-t 20030101224424-r database command returns the recommended required recovery 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 DB2 database is in the rollforward-pending state, the roll forward operation is required:

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. Description:

(1) recovery operations also include online and offline operations. The difference is equivalent to backup operations.

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

(3) In the restoration example, only version restoration is performed. If there is an updated full backup and Incremental backup image, you can perform restoration in sequence (please pay attention to the recommended restoration order and number of times using db2ckrst), and finally roll forward.

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.