Progress
Database Administration
Guide and Reference


Crash Recovery

Crash recovery occurs automatically. With this feature, the database engine uses information from the primary recovery (BI) log to recover from system failures.

The BI files are a vital part of the database. You should treat the files as an integral part of the database unit. When you back up and restore the database, back up and restore the DB and BI files together. Never manually delete the BI files.

While the database is running, database transaction information exists in three areas:

When database records are modified, the changes occur first in memory. When a transaction is committed, the change is recorded to the BI file. Over time, the database engine makes the change to the database file on disk. If the system fails, the information stored in the buffer pool is lost. The database engine performs crash recovery using the information logged to the BI file to re-create lost transactions and undo transactions that were not committed.

Before updating the database, the database engine makes a copy of the current information and writes it to the BI file. This activity begins at the end of an update operation. If the system fails during the transaction, the engine uses the information in the BI file to restore the database to its pretransaction state. The engine also uses the information in the BI files during normal processing to undo transactions.

For example, suppose you execute the following Progress 4GL procedure:

FOR EACH customer: 
  UPDATE name max-credit. 
END. 

You update customers 1 and 2, and while you are updating customer 3, the system fails. When you restart the database, messages appear in the database .lg file similar to the following:

11:13:54 Single-user session begin for marshall on /dev/pts/25 (451) 
11:13:54 Begin Physical Redo Phase at 256 . (5326) 
11:13:56 Physical Redo Phase Completed at blk 800 of 8165 and 31829 (7161) 
11:13:56 Begin Physical Undo 1 transactions at blk 800 offset 8189 (7163) 
11:14:38 Physical Undo Phase Completed at 1020 . (5331) 
11:14:38 Begin Logical Undo Phase, 1 incomplete transactions are being backed 
out. (7162) 
11:14:38 Logical Undo Phase Complete. (5329) 
11:14:46 Single-user session end. (334) 

The messages indicate the necessary phases of crash recovery performed by the database engine to bring the database to the consistent state that existed prior to the system failure. Since the engine performs crash recovery every time you open the database, not all of the recovery phases are logged in the database .lg file. For example, the engine performs and logs the Physical Redo phase unconditionally, but the Physical Undo and Logical Undo phases are only performed and logged when outstanding transactions are found.

When you rerun the same procedure, customers 1 and 2 remain updated, but the database engine has used the BI file to restore customer 3 to the state it was in before you began the update.

Crash recovery protects you from system failures, but it does not protect you from loss of media. In the event of media loss, you must restore from a backup, and either manually re-enter the lost transactions or use the roll-forward recovery mechanism to re-create the transaction.


Copyright © 2004 Progress Software Corporation
www.progress.com
Voice: (781) 280-4000
Fax: (781) 280-4095