The following articles mainly describe what DB2 should do when implementing backup. We are talking about the backup of a pure DB2 database. If you want to use dedicated software for dual-host real-time hot backup, generally, the backup command is used. The following describes the specific solution. I hope it will be helpful in your future study.
Including the DB2 backup database name and DB2 restore database name the following are common operation commands for DB2 offline and online full backup, incremental DB2 to implement backup and recovery steps:
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) run the backup command: use TSM as the medium for DB2 backup.) 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). Note: run the BACKUP command on the node 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 parameter that supports online backup: DB2 update db cfg for sample.
- using userexit on
Enable User exit
- DB2 update db cfg for sample using logretain on
Enable the archive log DB2 update db cfg for sample using trackmod on
Enable the Incremental backup function (each Node needs to 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:
- 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) 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
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: 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: 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: DB2 restore db sample history file use tsm taken at 20030102223107 buffer 100
3) use the DB2 recovery help tool: DB2ckrst-d sample-t 20030101224424-r database to a certain author