8.2 – Description
The SET FILE/RU_JOURNAL command marks an RMS file for recovery unit journaling. To use recovery unit journaling for a data file, a data file must be marked for recovery unit journaling with the SET FILE/RU_JOURNAL command, and transactions must be defined in an application program using DECdtm transaction services. You can also use this command to specify the default volume on which recovery unit journals will be created for this file. Use the SET FILE/NORU_JOURNAL command to unmark a file for recovery unit journaling. After you use the SET FILE/NORU_JOURNAL command for a file, modifications to that data file will no longer be written to a recovery unit journal. If you wish to delete a file that has been marked for recovery unit journaling, you must use the SET FILE/NORU_JOURNAL command before you can delete the file. There is no reason other than performance to keep recovery unit journals on a different volume from the file being journaled. Unlike after-image journaling, which protects against a system failure such as a head crash that causes a loss of data, recovery unit journaling ensures that a predefined set of operations are either done in their entirety, or not done at all. In the event of an abnormal termination of the application, such as a system crash or a Ctrl/Y, any incomplete transactions are automatically rolled back (undone). Because all recovery unit journals must be available before the data files can be rolled back, locating recovery unit journals on a volume where availability might be low could reduce the availability of the data files that use those recovery unit journals. Specifying a location for recovery unit journals for a file does not guarantee that the recovery unit journals will always be located on the named device or volume. For any active transaction, there is always only one recovery unit journal for local files. Thus, if many files are involved in a transaction, a single recovery unit journal is used, even if different locations for the journals had been specified (for individual files) with different SET FILE/RU_JOURNAL commands. Remote files are an exception to this rule. Each remote file associated with a transaction has its own recovery unit and recovery unit journal. The recovery unit journal resides on the remote system. The volume is chosen in the same way as for local files. Remote files have no effect in determining where the local recovery unit journal resides. A journal is not deleted when the transaction has been completed. Recovery unit journals are automatically deleted only when all of the files involved in the transaction are closed and the application exits. RMS journaling automatically creates a recovery unit journal at run time, whenever the first record stream associates with a transaction. All record streams in the process associated with the same transaction share a single recovery unit journal. Once a recovery unit journal is created, it can be reused for another transaction by the process that created it. A recovery unit journal is created only when there is no available recovery unit journal opened by the process for the current transaction.
8.3 – Examples
1.$ SET FILE/RU_JOURNAL FINANCE_DISK:[PAYROLL]WEEKLY.DAT This command marks the file WEEKLY.DAT for recovery unit journaling. Any operation within an application that modifies this file must be in a defined transaction (defined by DECdtm transaction services). 2.$ SET FILE/AI_JOURNAL=(FILE=JNL_DISK:, CREATE)- _$ /RU_JOURNAL/LOG OVERDUE.DAT %SET-I-JCREATED, journal JNL_DISK:[PAYABLE]OVERDUE.RMS$JOURNAL;1 created %SET-I-FILMARKAI, WORK_DISK:[PAYABLE]OVERDUE.DAT;1 marked for RMS after-image journaling -SET-I-JFILE, using journal JNL_DISK:[PAYABLE]OVERDUE.RMS$JOURNAL;1 %SET-I-FILMARKRU, WORK_DISK:[PAYABLE]OVERDUE.DAT;1 marked for RMS recovery-unit journaling %SET-I-MODIFIED, WORK_DISK:[PAYABLE]OVERDUE.DAT;1 modified $ SET FILE/AI_JOURNAL=(FILE=JNL_DISK:OVERDUE)- _$ /RU_JOURNAL/LOG CURRENT.DAT %SET-I-FILMARKAI, WORK_DISK:[PAYABLE]CURRENT.DAT;1 marked for RMS after-image journaling -SET-I-JFILE, using journal JNL_DISK:[PAYABLE]OVERDUE.RMS$JOURNAL;1 %SET-I-FILMARKRU, WORK_DISK:[PAYABLE]CURRENT.DAT;1 marked for RMS recovery-unit journaling %SET-I-MODIFIED, WORK_DISK:[PAYABLE]CURRENT.DAT;1 modified In this example, the files OVERDUE.DAT and CURRENT.DAT are marked for after-image and recovery unit journaling using two SET FILE commands. In this example, a single journal (JNL_ DISK:[PAYABLE]OVERDUE.RMS$JOURNAL) is used for after-image journaling. The first SET FILE command uses the /CREATE qualifier to create a new after-image journal, JNL_ DISK:[PAYABLE]OVERDUE.RMS$JOURNAL, for the file OVERDUE.DAT. The file specification uses the current default directory [PAYABLE] and the default file extension RMS$JOURNAL. The second SET FILE command marks the file CURRENT.DAT for after-image and recovery unit journaling, checks the disk JNL_ DISK to see whether an after-image journal already exists, and uses the existing journal JNL_DISK:[PAYABLE]OVERDUE.RMS$JOURNAL for the file CURRENT.DAT.