As the system administrator, you must establish recovery procedures for your installation. The procedures you put in place will determine the degree of protection for your database. Naturally, trade-offs exist; when you allocate system resources to protect against failures, these resources are unavailable to other users. However, if a failure occurs, the recovery takes less time.
This section discusses some of the options available. Based on this information, devise a plan that best suits your requirements.
One of the first decisions you must make when designing a recovery strategy is the type of log mode you want. The log mode is an initialization parameter that you specify when you start the application server. It has four possible values:
Log archives do not contain data, but only operations that change the database. If you use this log mode, you must take an occasional database archive as well. If a failure occurs, you can use the database archive, subsequent log archives, and the current log to recover the database.
The log archives must be continuous, recording all processing that occurred since the last database or log archive. If a gap exists, it will be impossible to restore the database to its current level. (The processing that occurred during the gap can never be reapplied to the database because it was never archived.) Gaps can occur in the sequence of log archives when, for example, you switch from LOGMODE=L to some other log mode. If the continuity of the log is broken in this manner, the database manager will force a database archive before you return to LOGMODE=L processing.
Once you have decided on a log mode, use it whenever you start the application server. Do not change it without thought and planning. If you must do so, you may have to carry out additional procedures. For information, refer to Switching Log Modes.
Figure 73 illustrates the relationships among the archives, the log, and the database when the log mode is A or L. You should consider several things before choosing one mode over the other.
Figure 73. Relationships among the Archives, the Log, and the Database
There are two advantages to log archiving (LOGMODE=L):
Note: | You can switch from LOGMODE=L to A and then back again without breaking the continuity of the log archives, provided that no database archive was taken while LOGMODE was set to A. |
A disadvantage of archiving the logs is that no logical units of work can be active during the checkpoint that immediately precedes the archive itself. Concurrent access is allowed once the checkpoint is complete, but users may experience delays both before and during the checkpoint.
Another disadvantage is that it takes longer to restore the database. For example, suppose you have been taking a database archive every Friday evening and a log archive on Tuesdays and Thursdays, and on a Friday afternoon there is a media failure on the DASD that contains the database directory. You must restore the most recent database archive (from the previous Friday), and then restore the log archives from Tuesday and Thursday as well as the changes recorded in the log that was current at the time of the failure. Because only the changes to the database are stored in the log, restoring the database is similar, in processing time, to redoing all the work from the week. If there was heavy activity that week, restoration can take a long time.
Had you used database archives (LOGMODE=A) as intermediate online archives, you would only need to restore Thursday's database archive and reapply the changes on the current log. The restore time is much shorter. On the other hand, more time would have been spent doing the intermediate archives. Because media failures are infrequent, it is usually better to take intermediate log archives instead of intermediate database archives. Depending on your own experience with media failures, it may even be worthwhile to lengthen the time between database archives taken at shutdown.
The database manager uses the history area of the current log to keep track of recovery events (for example, database archives and log archives). The database manager can then determine which log archives belong with which database archives. The ARIHSDS ARCHIVE file contains the updated history area. If both the work disk, containing the ARIHSDS ARCHIVE file, and the disk containing the current log are damaged or are unavailable (offsite disaster recovery scenarios), you cannot use log archives to restore the database. To be able to apply log archives, you should create a backup file of the ARIHSDS ARCHIVE file after each log archive. You can then use this backup file to rebuild the log history area.