Recovery

If a program dies, or there is some other system failure, files may become corrupted, destroyed, or left in an inconsistent state. If this occurs, the files may be recovered with the built-in library routine, C$RECOVER.

For any Vision files or relative files, C$RECOVER can be successful only if every operation on the files, including file OPEN, was done within a transaction.

To use the recovery function, you need the most recent backup copy of all the files that record their transactions. You also need all of the log files that were started immediately after the backup was created. Here's one way to perform a recovery:

  1. Get everyone off the system.
  2. Restore backup files to original locations.
  3. Run a program that calls the C$RECOVER library routine (for example, CALL C$RECOVER). Use the same configuration file that the applications use. Note that the log files specified with the filename-LOG variables are not used.

The C$RECOVER library routine only recovers the updates recorded in the log file specified by the configuration variable LOG-FILE. To recover updates recorded in multiple log files, specify each log file in the LOG-FILE variable and call C$RECOVER for each one. For example:

    SET CONFIGURATION "LOG-FILE" TO "default.log".
    CALL "C$RECOVER".
    SET CONFIGURATION "LOG-FILE" TO "file1.log".
    CALL "C$RECOVER".
    SET CONFIGURATION "LOG-FILE" TO "file2.log".
    CALL "C$RECOVER".
    SET CONFIGURATION "LOG-FILE" TO "file3.log".
    CALL "C$RECOVER".

To ensure that your data can be recovered, you should:

  1. Make sure all transactions are committed before you do a backup.
  2. Clear or delete the log files only after your backup is complete.
  3. Make sure there is no file activity between the time the backup is made and the time you clear or delete the log files.
  4. In between backups, you can periodically archive log files, then clear or delete them.
  5. If you use archived log files, make sure you recover using the logs in the chronological order in which they were written.
  6. Make sure there is no other activity on the files during recovery.
  7. Make backups and start new log files immediately if any log file gets corrupted or destroyed.
  8. Make sure you have good log files.

The backup data files should have the same absolute or relative pathname as when the original programs were run. If there are any cases where relative pathnames are used for the log or data files, run the program that calls the C$RECOVER routine from the same directory as the original programs. For the program that calls the C$RECOVER routine, specify the log file in the configuration file or in the environment.

If the recovery process terminates prematurely due to an error, and files are left open, they are automatically closed before the call to C$RECOVER returns.

If a failure occurs during the recovery process, and no other copies of the backup files are available, then automatic recovery is not possible. This means that you should make sure to have an extra backup copy of your data files.