Correct understanding of DB2 backup

Source: Internet
Author: User

This article focuses on DB2 backup. I saw the DB2 backup data on the relevant website two days ago. I think it is quite good and I will share it with you. If you are curious about the data backed up by DB2, the following articles will unveil its mysteries. I hope you will gain some benefits after browsing.

Archive, set archive, Set

Similar to Oracle, DB2 also has two modes: log loop and archive log, which are non-archive and archive modes. Next we will give a brief introduction to these two modes.

Log Loop

Log loop is the default mode, which is not the archive mode. This mode only supports backup offline backup, and DB2 needs to stop the service during the backup process.

Note the following when running offline DB2 backup:

1. Stop the application's access to DB2.

2. Run the list appliacations command to view the existing connections, and then run the force appliacation command to end the connections.

3. Run the deactivate database command to ensure that the DATABASE is not active.

4. Use the backup database command to back up the DATABASE in DB2.

Archive logs

Archive logs are not in the default status and will only take effect after configuration. When using the Log Retention mode, DB2 uses a database that can be recovered, and supports online backup, rollback, and crash recovery.

The configuration of the DB2 archive log mode mainly relies on two parameters: Logarchmeth1 and Logarchmeth2. Note: The Logretain parameter has been replaced by Logarchmeth1 after DB2 v8. You do not need to worry about it ).

Set Logarchmeth1 to LOGRETAIN

With archive logs, databases are recoverable databases. Enable Rollback Recovery and crash recovery, but not the automatic archiving mode.

After archiving a log file, you must manually delete useless archived logs so that new log files can reuse disk space. Every time the log file is full, DB2 begins to write records to another log file and constantly creates new log files.

Logarchmeth1 is set to a value other than OFF or LOGRETAIN.

Use archive logs. A database is a recoverable database. Enable Rollback Recovery and crash recovery. When the log file is full, it is automatically archived. The Archiving destination is the location set by Logarchmeth1.

If an error occurs when archiving log files, the archive will be suspended for a period of time, which is specified by the ARCHRETRYDELAY database configuration parameters. You can also use NUMARCHRETRY database configuration parameters to specify the number of times DB2 tries to archive log files to the main or auxiliary archiving directories, then it tries to archive the log file to the Failover directory specified by the FAILARCHPATH Database Configuration Parameter ).

Logarchmeth1 and Logarchmeth2 may have the following combinations:

1. Set Logarchmeth1 to LOGRETAIN and Logarchmeth2 to OFF

The location of archived logs is the location of DB2 database logs. manual intervention is required to transfer archived logs and maintain space.

2. Set Logarchmeth1 to USEREXIT and Logarchmeth2 to OFF.

Archive log management is handled by USEREXIT. By setting USEREXIT for compilation, You can implement more complex archive management methods.

3. Set Logarchmeth1 to <Directory> and Logarchmeth2 to OFF.

Archiving logs is automatically performed. Logs to be archived are automatically archived to the specified location in <Directory>, the DB2 log directory contains only normal logprimary + logsecond database logs.

4. Set Logarchmeth1 to <Directory1> and Logarchmeth2 to <Directory2>

Archiving logs will be performed automatically. Logs to be archived will be automatically archived to the specified location <Directory1> and <Directory2>, that is to say, two archive logs will be generated. Because the archive is automatic, only normal logprimary + logsecond database logs are in the DB2 log directory.

Either <Directory1> or <Directory2> can be set to TSM. We recommend that you set <Directory1> to the file system and <Directory2> to TSM, which can be archived to TSM for offline storage and archived logs in the file system online for ease of use.

Note: After Logarchmeth1 and Logarchmeth2 are set, the database enters the backup pending state. You must perform an offline DB2 backup before the data enters the recovery mode and works properly.

The above content is an introduction to DB2 backup. I hope you will have some gains.

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.