Home > Articles > Data > DB2

This chapter is from the book

Database Recovery Concepts

Over time, a database can encounter any number of problems, including power interruptions, storage media failure, and application abends. All of these can result in database failure and each failure scenario requires a different recovery action.

The concept of backing up a database is the same as that of backing up any other set of data files: you make a copy of the data and store it on a different medium where it can be accessed in the event the original becomes damaged or destroyed. The simplest way to backup a database is to shut it down to ensure that no further transactions are processed, and then back it up using the BACKUP utility provided with DB2 UDB. Once the backup image has been made, you can rebuild the database if for some reason it becomes damaged or corrupted.

The process of rebuilding a database is known as recovery and with DB2 UDB, three types of recovery are available. They are:

  • Crash recovery

  • Version recovery

  • Roll-forward recovery

Crash Recovery

When an event or condition occurs that causes a database and/or the DB2 Database Manager to end abnormally, one or more transaction failures may result. Conditions that can cause transaction failure include:

  • A power failure at the workstation where the DB2 Database Manager is running.

  • A serious operating system error.

  • A hardware failure such as memory corruption, disk failure, CPU failure, or network failure.

  • An application failure.

When a transaction failure takes place, all work done by partially completed transactions that was still in memory is lost. And because some of that work may not have been externalized to the database, the database is left in an inconsistent state (and therefore is unusable). Crash recovery is the process that returns such a database to a consistent and usable state. Crash recovery is performed by using information stored in the transaction log files to roll back all incomplete transactions found and complete any committed transactions that were still in memory (but had not yet been externalized to the database) when the transaction failure occurred. Once a database is returned to a consistent and usable state, it has attained what is known as a "point of consistency."

Version Recovery

Version recovery is the process that returns a database to the state it was in at the time a backup image was made. Version recovery is performed by replacing the current version of a database with a previous version, using an image that was created with a backup operation; the entire database is rebuilt using a backup image created earlier. Unfortunately, when a version recovery is performed, all changes that have been made to the database since the backup image was created will be lost. Version recovery can be used to restore an entire database or it can be used to restore individual tablespaces—provided individual tablespace backup images exist.

Roll-Forward Recovery

Roll-forward recovery takes version recovery one step farther by replacing a database or individual tablespaces with a backup image and replaying information stored in transaction log files to return the database/tablespaces to the state they were in at an exact point in time. In order to perform a roll-forward recovery operation, you must have archival logging enabled, you must have a full backup image of the database available, and you must have access to all archived log files (or at least the ones you want to use for recovery) that have been created since the backup image was made. Like version recovery, roll-forward recovery can be applied to an entire database or to individual tablespaces.

Recoverable and Non-recoverable Databases

Although any DB2 UDB database can be recovered from transaction log files (crash recovery) or a backup image (version recovery), whether or not a database is considered recoverable is determined by the values of the database's logretain and userexit configuration parameters; a database is recoverable if the logretain parameter is set to RECOVERY and/or the userexit parameter is set to YES. (When both of these configuration parameters are set to NO, which is the default, circular logging is used and the database is considered non-recoverable.) A database is considered recoverable when crash recovery, version recovery, and roll-forward recovery is possible. A database is considered non-recoverable if roll-forward recovery is not supported. Other differences between recoverable and non-recoverable databases are shown in Table 7-1.

Table 7-1. Differences between Recoverable and Non-recoverable Databases

Recoverable Database

Non-recoverable Database

Archive logging is used.

Circular logging is used.

The database can be backed up at any time, regardless of whether or not applications are connected to it and transactions are in progress.

The database can only be backed up when all connections to it have been terminated.

The entire database can be backed up or individual tablespaces can be backed up. Tablespaces can also be restored independently.

The entire database must be backed up; tablespace level backups are not supported.

A damaged database can be returned to the state it was in at any point in time; crash recovery, version recovery, and roll-forward recovery are supported.

A damaged database can only be returned to the state it was in at the time the last backup image was taken; only crash recovery and version recovery are supported.

The decision of whether a database should be recoverable or non-recoverable is based on several factors:

  • If a database is used to support read-only operations, it can be non-recoverable; since no transactions will be logged, roll-forward recovery is not necessary.

  • If relatively few changes will be made to a database and if all changes made can be easily recreated, it may be desirable to leave the database non-recoverable.

  • If a large amount of changes will be made to a database or if it would be difficult and time-consuming to recreate all changes made, a recoverable database should be used.

Online versus Offline Backup and Recovery

From a backup and recovery perspective, a database is either online or offline. When a database is offline, other applications and users cannot gain access to it; when a database is online, just the opposite is true. Backup and recovery operations can only be performed against a non-recoverable database after that database has been taken offline. Recoverable databases, on the other hand, can be backed up at any time, regardless of whether the database is offline or online. However, in order to restore a recoverable database (using version recovery and roll-forward recovery), the database must be taken offline. (It is important to note that a recoverable database only has to be taken offline if the entire database is to be restored; individual tablespaces can be restored while the database is online.)

When an online backup operation is performed, roll-forward recovery ensures that all changes made while the backup image is being made are captured and can be recreated with a roll-forward recovery operation. Furthermore, online backup operations can be performed against individual tablespaces as well as entire databases. And, unlike when full database version recovery operations are performed, tablespace version recovery operations and tablespace roll-forward recovery operations can be performed while a database remains online. When a tablespace is backed up online, it remains available for use and all simultaneous modifications to the data stored in that tablespace are recorded in the transaction log files. However, when an online restore or online roll-forward recovery operation is performed against a tablespace, the tablespace itself is not available for use until the operation has completed.

Incremental Backup and Recovery

As the size of a database grows, the time and hardware needed to backup and recover the databases also grows substantially. Furthermore, creating full database and tablespace backup images is not always the best approach when dealing with large databases, because the storage requirements for multiple copies of such databases can be enormous. A better alternative is to create one full backup image and several incremental backup images as changes are made. An incremental backup is a backup image that only contains pages that have been updated since the previous backup image was made. Along with updated data and index pages, each incremental backup image also contains all of the initial database meta-data (such as database configuration, tablespace definitions, recovery history file, etc.) that is normally found in full backup images.

Two types of incremental backup images are supported: incremental and delta. An incremental backup image is a copy of all database data that has changed since the most recent, successful, full backup operation has been performed. An incremental backup image is also known as a cumulative backup image, because a series of incremental backups taken over a period of time will have the contents of the previous incremental backup image. The predecessor of an incremental backup image is always the most recent successful full backup of the same object.

A delta backup image is a copy of all database data that has changed since the last successful backup (full, incremental, or delta) of the object in question. A delta backup image is also known as a differential, or noncumulative, backup image; the predecessor of a delta backup image is the most recent successful backup image that contains a copy of each of the objects found in the delta backup image.

The key difference between incremental and delta backup images is their behavior when successive backups are taken of an object that is continually changing over time. Each successive incremental image contains the entire contents of the previous incremental image, plus any data that has changed, or has been added, since the previous full backup image was produced. Delta backup images only contain the pages that have changed since the previous backup image of any type was produced. In either case, database recovery involves restoring the database using the most recent successful full backup image available and applying each incremental backup image produced, in the order in which they were made. (The recovery history file keeps track of which incremental and delta backup images are needed and the order that they were made in.)

InformIT Promotional Mailings & Special Offers

I would like to receive exclusive offers and hear about products from InformIT and its family of brands. I can unsubscribe at any time.

Overview


Pearson Education, Inc., 221 River Street, Hoboken, New Jersey 07030, (Pearson) presents this site to provide information about products and services that can be purchased through this site.

This privacy notice provides an overview of our commitment to privacy and describes how we collect, protect, use and share personal information collected through this site. Please note that other Pearson websites and online products and services have their own separate privacy policies.

Collection and Use of Information


To conduct business and deliver products and services, Pearson collects and uses personal information in several ways in connection with this site, including:

Questions and Inquiries

For inquiries and questions, we collect the inquiry or question, together with name, contact details (email address, phone number and mailing address) and any other additional information voluntarily submitted to us through a Contact Us form or an email. We use this information to address the inquiry and respond to the question.

Online Store

For orders and purchases placed through our online store on this site, we collect order details, name, institution name and address (if applicable), email address, phone number, shipping and billing addresses, credit/debit card information, shipping options and any instructions. We use this information to complete transactions, fulfill orders, communicate with individuals placing orders or visiting the online store, and for related purposes.

Surveys

Pearson may offer opportunities to provide feedback or participate in surveys, including surveys evaluating Pearson products, services or sites. Participation is voluntary. Pearson collects information requested in the survey questions and uses the information to evaluate, support, maintain and improve products, services or sites, develop new products and services, conduct educational research and for other purposes specified in the survey.

Contests and Drawings

Occasionally, we may sponsor a contest or drawing. Participation is optional. Pearson collects name, contact information and other information specified on the entry form for the contest or drawing to conduct the contest or drawing. Pearson may collect additional personal information from the winners of a contest or drawing in order to award the prize and for tax reporting purposes, as required by law.

Newsletters

If you have elected to receive email newsletters or promotional mailings and special offers but want to unsubscribe, simply email information@informit.com.

Service Announcements

On rare occasions it is necessary to send out a strictly service related announcement. For instance, if our service is temporarily suspended for maintenance we might send users an email. Generally, users may not opt-out of these communications, though they can deactivate their account information. However, these communications are not promotional in nature.

Customer Service

We communicate with users on a regular basis to provide requested services and in regard to issues relating to their account we reply via email or phone in accordance with the users' wishes when a user submits their information through our Contact Us form.

Other Collection and Use of Information


Application and System Logs

Pearson automatically collects log data to help ensure the delivery, availability and security of this site. Log data may include technical information about how a user or visitor connected to this site, such as browser type, type of computer/device, operating system, internet service provider and IP address. We use this information for support purposes and to monitor the health of the site, identify problems, improve service, detect unauthorized access and fraudulent activity, prevent and respond to security incidents and appropriately scale computing resources.

Web Analytics

Pearson may use third party web trend analytical services, including Google Analytics, to collect visitor information, such as IP addresses, browser types, referring pages, pages visited and time spent on a particular site. While these analytical services collect and report information on an anonymous basis, they may use cookies to gather web trend information. The information gathered may enable Pearson (but not the third party web trend services) to link information with application and system log data. Pearson uses this information for system administration and to identify problems, improve service, detect unauthorized access and fraudulent activity, prevent and respond to security incidents, appropriately scale computing resources and otherwise support and deliver this site and its services.

Cookies and Related Technologies

This site uses cookies and similar technologies to personalize content, measure traffic patterns, control security, track use and access of information on this site, and provide interest-based messages and advertising. Users can manage and block the use of cookies through their browser. Disabling or blocking certain cookies may limit the functionality of this site.

Do Not Track

This site currently does not respond to Do Not Track signals.

Security


Pearson uses appropriate physical, administrative and technical security measures to protect personal information from unauthorized access, use and disclosure.

Children


This site is not directed to children under the age of 13.

Marketing


Pearson may send or direct marketing communications to users, provided that

  • Pearson will not use personal information collected or processed as a K-12 school service provider for the purpose of directed or targeted advertising.
  • Such marketing is consistent with applicable law and Pearson's legal obligations.
  • Pearson will not knowingly direct or send marketing communications to an individual who has expressed a preference not to receive marketing.
  • Where required by applicable law, express or implied consent to marketing exists and has not been withdrawn.

Pearson may provide personal information to a third party service provider on a restricted basis to provide marketing solely on behalf of Pearson or an affiliate or customer for whom Pearson is a service provider. Marketing preferences may be changed at any time.

Correcting/Updating Personal Information


If a user's personally identifiable information changes (such as your postal address or email address), we provide a way to correct or update that user's personal data provided to us. This can be done on the Account page. If a user no longer desires our service and desires to delete his or her account, please contact us at customer-service@informit.com and we will process the deletion of a user's account.

Choice/Opt-out


Users can always make an informed choice as to whether they should proceed with certain services offered by InformIT. If you choose to remove yourself from our mailing list(s) simply visit the following page and uncheck any communication you no longer want to receive: www.informit.com/u.aspx.

Sale of Personal Information


Pearson does not rent or sell personal information in exchange for any payment of money.

While Pearson does not sell personal information, as defined in Nevada law, Nevada residents may email a request for no sale of their personal information to NevadaDesignatedRequest@pearson.com.

Supplemental Privacy Statement for California Residents


California residents should read our Supplemental privacy statement for California residents in conjunction with this Privacy Notice. The Supplemental privacy statement for California residents explains Pearson's commitment to comply with California law and applies to personal information of California residents collected in connection with this site and the Services.

Sharing and Disclosure


Pearson may disclose personal information, as follows:

  • As required by law.
  • With the consent of the individual (or their parent, if the individual is a minor)
  • In response to a subpoena, court order or legal process, to the extent permitted or required by law
  • To protect the security and safety of individuals, data, assets and systems, consistent with applicable law
  • In connection the sale, joint venture or other transfer of some or all of its company or assets, subject to the provisions of this Privacy Notice
  • To investigate or address actual or suspected fraud or other illegal activities
  • To exercise its legal rights, including enforcement of the Terms of Use for this site or another contract
  • To affiliated Pearson companies and other companies and organizations who perform work for Pearson and are obligated to protect the privacy of personal information consistent with this Privacy Notice
  • To a school, organization, company or government agency, where Pearson collects or processes the personal information in a school setting or on behalf of such organization, company or government agency.

Links


This web site contains links to other sites. Please be aware that we are not responsible for the privacy practices of such other sites. We encourage our users to be aware when they leave our site and to read the privacy statements of each and every web site that collects Personal Information. This privacy statement applies solely to information collected by this web site.

Requests and Contact


Please contact us about this Privacy Notice or if you have any requests or questions relating to the privacy of your personal information.

Changes to this Privacy Notice


We may revise this Privacy Notice through an updated posting. We will identify the effective date of the revision in the posting. Often, updates are made to provide greater clarity or to comply with changes in regulatory requirements. If the updates involve material changes to the collection, protection, use or disclosure of Personal Information, Pearson will provide notice of the change through a conspicuous notice on this site or other appropriate way. Continued use of the site after the effective date of a posted revision evidences acceptance. Please contact us if you have questions or concerns about the Privacy Notice or any objection to any revisions.

Last Update: November 17, 2020