How can we recover a DB2 database?

Source: Internet
Author: User

The following articles mainly describe the correct operation steps for restoring the DB2 database and the related operations involved in the actual operations for restoring the DB2 database, the following is a detailed description of the relevant content, hoping to help you in this regard.

Restore database

1) manually drop the database to simulate disaster recovery of the DB2 database. 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 perform version recovery first. The DB2 database 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 (tablespace-name) clause to perform similar backup and recovery based on 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 the DB2 database recovery in sequence. Pay attention to the recommended sequence and number of times of using DB2ckrst.) then roll forward.

 
 
  1. DB2 force applications all  
  2. DB2 backup db ldapDB2 to directory_or_device 

DB2 restore db ldapDB2 from directory_or_device replace existing where directory_or_device is the name of the directory or device that stores the backup.

Migrate windows to linux:

 
 
  1. DB2move tfms export;  
  2. create db tfms;  
  3. DB2move tfms -u -p import > a.txt;  
  4. DB2move tfmsw179 import -u DB2admin -p DB2admin > a.txt 

Confirm execution: TERMINATE

6. Restore the database

(1) first create an empty Database: DB2 create db NewdbName

(2) DB2 restore olddbName (DB2 database recovery database name is required) taken at Times (Time Point) into NewdbName (new database name)

Note: The name of the recovered database is the same as that of the newly created database.

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.