DB2 common backup, recovery command and correct usage description of DB2move

Source: Internet
Author: User

The following articles mainly describe the commonly used backups of DB2 and the correct use of the recovery command and DB2move, if you are interested in the correct use of the recovery command and DB2move, you can click the following article to view the details.

DB2

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

1. Full offline backup

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

 
 
  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 requires offline full backup of the database. 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 the commonly used DB2 backup adutl and DB2 list history to view the 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) Remarks:

Similarly, this operation is performed 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 recovery help tools commonly used in DB2 backup:

 
 
  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:

Db

 
 
  1. 2 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 restoration in sequence. Note that the recommended restoration sequence and number of times for DB2ckrst are used.

 
 
  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 (database name to be restored) 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.

My own applications:

Export data:

1: Run DB2CMD in DOS

2: Create a New CMS folder on disk D and CD it to the CMS directory in DOS of DB2CMD.

3: Run DB2move to back up the database name export-u username-p Password

4: Successful

Export data:

1: Build an empty database default buffer pool and tablespace size in the DB2 common backup console set up a large point up to 32 K, code set up UTF-8)

2. Select a folder such as cms on disk D.

3: Run DB2move test import-u username-p Password

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.