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 69 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 69. 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. If the disk containing the current log is damaged or unavailable (offsite disaster recovery scenarios), you cannot use log archives to recover the database. To avoid this situation, you should create a backup of the log file after each log archive. You can then restore this file to rebuild the log history area.
Database archives or log archives can be either dynamically or statically assigned.
With dynamic tape allocation, only one tape drive can be allocated for archiving. If the archive exceeds the storage of the tape, the tape must be rewound, unloaded, and a second tape must be mounted manually. With static tape allocation, more than one tape drive can be allocated for archiving. The tape drives are statically assigned in the start-up JCL.
The following is a sample JCL:
// JOB ARCHIVE // LIBDEF *,SEARCH=(PRD2.DB2710) // ASSGN SYS005,cuu1 // ASSGN SYS005,cuu2,ALT // TLBL ARIARCH, ... // TLBL ARILARC, ... // EXEC ARISQLDS,SIZE=AUTO, PARM='STARTUP=W,LOGMODE=L' /* /&
You are prompted with message ARI0299A. For dynamic tape allocation, respond with the tape address cuu. For static tape allocation, respond 1.