Document revision date: 15 July 2002
[Compaq] [Go to the documentation home page] [How to order documentation] [Help on this site] [How to contact us]
[OpenVMS documentation]

OpenVMS System Manager's Manual


Previous Contents Index

11.14 Restoring Files and Directories

A BACKUP restore operation takes a save set and restores it to its original condition. Often a restore operation is the result of a crisis (you have deleted an important file or a disk has become corrupted, for example). When you restore files, BACKUP places the contents of the save set in the location that you specify.

To restore an entire disk, see Section 11.16.

How to Perform This Task

To restore files, use the BACKUP command in the following format:

BACKUP save-set-specifier [/SAVE_SET] /SELECT=[dir...] output-specifier:[dir...]

Use the /SAVE_SET qualifier if the save set is on a disk or diskette. The /SELECT qualifier lets you specify the exact file you want to restore.

If your save set is stored on more than one magnetic tape or sequential disk volume, it is possible to begin restore and compare operations with any volume of the save set. However, if you are restoring a save set with the command qualifier /IMAGE, processing must begin with the first volume. (An image restore operation restores all files to a volume or volume set.) If you attempt an image restore or compare operation and specify a tape that is not the first volume of the save set, you receive the following message:


%BACKUP-W-NOT1STVOL, tape 'name' is not the start of a save set

You can use the command qualifier /LOG to monitor the files as they are restored. To restore only a small number of files from a large save set, press Ctrl/Y to terminate processing once the files you need have been restored.

Examples

  1. If you mistakenly delete the file USER1:[WORK.SEPT]INVOICES.DAT but it has been backed up to a save set named NIGHTLY.BCK, you could restore it using the following command:


    $ BACKUP
    _From: MUA0:NIGHTLY.BCK/SELECT=[WORK.SEPT]INVOICES.DAT
    _To: USER1:[WORK.SEPT]INVOICES.DAT      
    

  2. You can also use wildcard characters to restore more than one file. For example:


    $ BACKUP/LOG
    _From: MUA0:NIGHTLY.BCK/SELECT=[WORK.SEPT]INVOICES*.*
    _To: USER1:[WORK.SEPT]INVOICES*.*
    %BACKUP-S-CREATED, created USER1:[WORK.SEPT]INVOICES_01.TXT;1 
    %BACKUP-S-CREATED, created USER1:[WORK.SEPT]INVOICES_02.TXT;1 
    %BACKUP-S-CREATED, created USER1:[WORK.SEPT]INVOICES_03.TXT;1 
    %BACKUP-S-CREATED, created USER1:[WORK.SEPT]INVOICES_04.TXT;1 
    %BACKUP-S-CREATED, created USER1:[WORK.SEPT]INVOICES_05.TXT;1 
    %BACKUP-S-CREATED, created USER1:[WORK.SEPT]INVOICES_06.TXT;1
       .
       .
       .
    

    The /LOG qualifier displays the file specification of the files that you restored.

  3. The following example restores files from the magnetic tape save set NOV12SAVE.BCK to subdirectories of the directory [LYKINS]:


    $ BACKUP TAPE:NOV12SAVE.BCK [LYKINS...]
    

  4. To restore a specific file from a save set, use the input save-set qualifier /SELECT. In the following example, the file STRAT1.DAT in the directory [LYKINS.GLENDO] was deleted accidentally. The user, who previously saved the file to a save set named NOV2SAVE.BCK, uses BACKUP to restore the file to the directory. Next, the user enters the DIRECTORY command to confirm that the file has been restored to the subdirectory [LYKINS.GLENDO].


    $ BACKUP
    _From: MIA0:NOV2SAVE.BCK/SELECT=[LYKINS.GLENDO]STRAT1.DAT;5
    _To: STRAT1.DAT;5
    $ DIRECTORY STRAT1.DAT
    Directory [LYKINS.GLENDO]
     
    STRAT1.DAT;5
     
    Total of 1 file.
    $
    

  5. Suppose you deleted the entire [REPORTS] directory, which previously contained the following subdirectories:


    $ SET DEFAULT [REPORTS]
    $ DIRECTORY *.DIR
    Directory USER3:[REPORTS] 
     
    INTERNAL.DIR             2 
    PUBLIC.DIR               5 
    SUMMARIES.DIR            1 
    TEST.DIR                 3 
    WEEKLY.DIR               2 
     
    Total of 5 files, 13 blocks.
    $
    

    If you made a backup save set of the directory and subdirectories, you could restore them. For example:


    $ BACKUP MUA0:MAY-10.BCK/SELECT=[REPORTS...] USER3:[REPORTS...]
    

    This command restores all the files in the [REPORTS] directory and the subdirectories ([.INTERNAL], [.PUBLIC], [.SUMMARIES], [.TEST], and [.WEEKLY]).

  6. To restore all files from a magnetic-tape save set named NOV12SAVE.BCK to the directory tree from which they were saved, enter the following command:


    $ BACKUP TAPE:NOV12SAVE.BCK/REWIND [*...]
    

    The /REWIND qualifier directs BACKUP to rewind the tape to the beginning-of-tape before beginning the restore operation. This ensures that the save set will be restored even if it is located before the current tape position.

11.14.1 Accessing Files in Deep Directory Structures

BACKUP can access a file in a directory structure that is a maximum of 32 levels deep. BACKUP can also select a file from within a BACKUP save-set file that was previously in a deep directory (one that is greater than 8 levels deep). On an ODS-2 disk, however, you can restore a file from a directory that is a maximum of 8 levels deep. The following example restores a deep directory structure that is 12 levels deep:


$ BACKUP MTA1:T.BCK/SAV/SELECT=[A.B.C.D.E.F.G.H.I.J.K.L]*.* DISK:[DIR]*.*;* 

11.15 Backing Up User Disks

This section explains performing incremental and image backups to disk and tape.

Note

Do not use the menu system (which displays when you boot the OpenVMS VAX operating system CD-ROM) to back up user disks. Use the menu system to back up system disks only.

In addition, if you back up large user disks on VAX systems, BACKUP might need to page and thereby cause the operation to fail. If this occurs, use online BACKUP to back up those VAX user disks.

11.15.1 Preparing to Back Up User Disks

Compaq recommends that you back up your disks with no interactive users logged in and with no applications running. This is because if BACKUP encounters an open file during a save operation, it issues an error message and does not copy the file. Also, because of the way BACKUP scans directories, any activity in a directory (such as creating or deleting files) can cause files to be excluded from the backup.

Note

The first time you back up a disk, you must perform an image backup using the BACKUP/IMAGE/RECORD command before you perform regular incremental backups. The image backup saves a copy of the entire disk and marks each file as being saved. Subsequent incremental backups assume that an image backup has been performed; only new or modified files are saved.

If an image backup is not performed first, the incremental backups save more files than might be necessary to ensure that an incremental restore operation will be successful.

You can instruct BACKUP to save open files by using the /IGNORE=INTERLOCK qualifier on the BACKUP command, as described in Section 11.18.3. However, open files saved by BACKUP might contain inconsistent data, depending on the applications that are writing to the open files. BACKUP reports a message if either:

However, if the file is accessed for writing from a remote node when BACKUP finishes reading the file, no message is displayed because BACKUP cannot detect the access.

If a file with the specified version already exists, BACKUP reports the following error message:


RMS-E-FEX, file already exists, not superseded 

How to Perform This Task

If several users are on your system, notify them that a disk backup is about to take place. If you have the OPER privilege, you can notify users with the REPLY/ALL command, as follows:


$ REPLY/ALL "System Backup About to Begin -- Open Files Will Not Be Backed Up"

When you enter this command, each interactive terminal on the system displays the following message:


Reply received on MYNODE from user SYSTEM at VTA28:   23:35:11 
System Backup About to Begin -- Open Files Will Not Be Backed Up 

11.15.2 Performing Image Backups to Tape

As described in Section 11.2, an image backup of a disk provides you with an exact logical copy of all the files on the disk. You should perform image backups with no interactive users on the system because of open file considerations (described in Section 11.15.1). Also, system performance can be affected during the backup process, so it is best to schedule the backup during the least busy times for your system. You can optimize the speed of the backup procedure by ensuring that certain process and system parameters are set properly (as described in Section 11.7).

How to Perform This Task

To perform an image backup, use the BACKUP command in the following format:

BACKUP/IMAGE [/RECORD] input-device output-specifier [/LABEL=label] [/REWIND]

The /IMAGE qualifier identifies the backup operation as an image backup. The /RECORD qualifier is optional and records the current date and time in the file header record of each file that is backed up. You must use the /RECORD qualifier if you are planning to perform future incremental backups. Specify the name of the disk you are backing up as the input-device; do not specify individual files. The /REWIND qualifier is optional depending on whether you want to initialize the tape. The /LABEL qualifier identifies the label of the tape.

Examples

  1. The following example shows how to create an image backup of a disk on your workstation. If the disk is named DKA100:, and the tape cartridge drive is named MKB100:, you could perform the image backup by entering the following commands:


    $ INITIALIZE MKB100: WKLY(1)
    $ MOUNT DKA100: DISK$1(2)
    %MOUNT-I-MOUNTED, DISK$1 mounted on _DKA100:
    $ BACKUP/IMAGE/RECORD/VERIFY
    _From: DKA100:
    _To: MKB100:FULL02.SAV/LABEL=WKLY(3)
    %BACKUP-I-STARTVERIFY, starting verification pass
    

    In this example, the individual commands perform the following actions:

    1. Initialize the tape in MKB100: with the label WKLY.
    2. Mount the disk DKA100: (BACKUP will mount the tape drive).
    3. Back up the disk DKA100: to the save set FULL02.SAV on MKB100. The /IMAGE qualifier indicates that this is an image backup. The /RECORD qualifier records the current date and time of the backup in the file header record of each file that is backed up. The /VERIFY qualifier causes BACKUP to check the contents of the output specifier against the input specifier after the files are written to the volume. The /LABEL qualifier indicates the label of the tape.
  2. If you are backing up a large disk, you may want to use several tape drives for the backup. For example:


    $ ALLOCATE MUA0:,MUA1:,MUA2:(1)
    %DCL-I-ALLOC, MUA0: allocated
    %DCL-I-ALLOC, MUA1: allocated
    %DCL-I-ALLOC, MUA2: allocated
    $ BACKUP/IMAGE/RECORD/NOASSIST/RELEASE_TAPE
    _From: DKA100:
    _To: MUA0:FULL02.SAV,MUA1,MUA2/LABEL=MNTH(2)
    %MOUNT-I-MOUNTED, MNTH mounted on _MUA0:
    %BACKUP-I-RESUME, resuming operation on volume 2 
    %MOUNT-I-MOUNTED, MNTH02 mounted on _MUA1:
    %BACKUP-I-RESUME, resuming operation on volume 3
    %MOUNT-I-MOUNTED, MNTH03 mounted on _MUA2:
    $
    

    In this example, the individual commands perform the following actions:

    1. Allocate the tape drives that will be used in the backup.
    2. Back up DKA100: to a save set. The /IMAGE qualifier indicates this operation is an image backup. BACKUP begins writing data to a save set on the tape in MUA0. If the tape in MUA0: becomes full, BACKUP initializes the tape in MUA1: and continues writing the save set. The tape in MUA1: gets the label MNTH02. If necessary, BACKUP also uses the tape in MUA2.
      The /RELEASE_TAPE qualifier dismounts and unloads an output tape device after BACKUP writes the save set. The /RECORD qualifier records the current date and time in the file header record of each file that is backed up.

11.15.3 Performing Image Backups to Disk

As described in Section 11.2, an image backup of a disk provides you with an exact logical copy of all the files on the disk. You should perform image backups with no interactive users on the system because of open file considerations (described in Section 11.15.1). Also, system performance can be affected during the backup process, so it is best to schedule the backup during the least busy times for your system. You can optimize the speed of the backup procedure by ensuring that certain process and system parameters are set properly (as described in Section 11.7).

How to Perform This Task

To perform an image backup to a disk, use the BACKUP command in the following format:

BACKUP/IMAGE/RECORD input-device output-specifier/SAVE_SET

The /IMAGE qualifier identifies the backup operation as an image backup. The /RECORD qualifier records the current date and time in the file header record of each file that is backed up. This information is essential for future incremental backups. The /SAVE_SET qualifier indicates that you are creating a save set on a disk.

Examples

  1. For example, if you want to create an image backup save set of the disk named DUA1: on a disk named DUA2:, you could enter the following commands:


    $ MOUNT DUA1: USER1
    %MOUNT-I-MOUNTED, USER1 mounted on _DUA1:
    $ MOUNT DUA2: USER2
    %MOUNT-I-MOUNTED, USER2 mounted on _DUA2:
    $ BACKUP/IMAGE/RECORD
    _From: DUA1:
    _To: DUA2:[USER.BACKUPS]USER1.SAV/SAVE_SET
    

  2. You can also specify multiple disk drives as the output specifier in the BACKUP command line. For example:


    $ BACKUP/IMAGE/RECORD
    _From: DUA0:
    _To: DUB24:[USER.BACKUPS]USER1.SAV,DUB25/SAVE_SET
    

11.15.4 Performing Incremental Backups to Tape

As described in Section 11.2, an incremental backup of a disk provides you with an exact copy of only those files that have been created or modified since the last image or incremental backup in which the /RECORD qualifier was used.

How to Perform This Task

To perform an incremental backup to tape, perform the following steps:

  1. Perform an image backup using the /RECORD qualifier (see Section 11.15.2).
  2. To determine the date of the last backup that used the /RECORD qualifier, enter the DIRECTORY/FULL command and the file name. For example:


    $ DIRECTORY/FULL LOGIN.COM
    Directory WORK204:[HIGGINS] 
     
    LOGIN.COM;31                  File ID:  (23788,1,0)        
    Size:            7/9          Owner:    [ACC,HIGGINS] 
    Created:  30-APR-2000 14:37:33.98 
    Revised:  30-APR-2000 14:37:34.44 (1) 
    Expires:   <None specified> 
    Backup:   30-APR-2000 20:20:57.37 
    File organization:  Sequential 
    File attributes:    Allocation: 9, Extend: 0, Global buffer count: 0, No version limit 
    Record format:      Variable length, maximum 94 bytes 
    Record attributes:  Carriage return carriage control 
    RMS attributes:     None 
    Journaling enabled: None 
    File protection:    System:RWED, Owner:RWED, Group:RE, World: 
    Access Cntrl List:  None 
     
    Total of 1 file, 7/9 blocks.
    

    The date of the last /RECORD backup is indicated in the Backup field of the display. In this example, a /RECORD backup was performed on 30-APR-2000 20:20:57.37.

    Note

    If you used the /IGNORE=INTERLOCK qualifier to back up open files during your last image backup or incremental backup in which the /RECORD qualifier was used, see Section 11.18.3. If the files remain open, they will not be included in the incremental backup because their backup date fields are not as recent as the last image backup or incremental backup in which the /RECORD qualifier was used.
  3. Enter the BACKUP command in the following format:

    BACKUP/RECORD/SINCE=BACKUP input-specifier output-specifier[/LABEL=label] [/REWIND]


    The /RECORD qualifier records the current date and time in the file header record of each file that is backed up. This information is essential for future incremental backups. The /SINCE=BACKUP qualifier backs up files dated later than the last /RECORD backup. The /REWIND qualifier is optional depending on whether you want to initialize the tape. The /LABEL qualifier identifies the label of the tape.

Example

The following command is an example of an incremental backup in which BACKUP saves all files on DRA1: that were modified since the previous BACKUP/RECORD command and stores them in a save set named 20APR2000.SAV:


$ BACKUP/RECORD/SINCE=BACKUP/RELEASE_TAPE
From: DRA1:[000000...]
To: MIA0:20APR2000.SAV/LABEL=20JUNE

The /LABEL qualifier identifies the volume label of the tape. Also, because BACKUP is performing an incremental rather than an image backup, it is necessary to explicitly use the notation DRA1:[000000...] to specify all the files on DRA1. The /SINCE=BACKUP qualifier saves all files created or modified since the last /RECORD backup. The /RELEASE_TAPE qualifier dismounts and unloads an output tape device after BACKUP writes the save set and before it performs the action of the /RECORD command.

11.15.5 Performing Incremental Backups to Disk

As described in Section 11.2, an incremental backup of a disk provides you with an exact copy of only those files that have been created or modified since the last image or incremental backup in which the /RECORD qualifier was used.

How to Perform This Task

To make an incremental backup to disk, perform the following steps:

  1. To perform an incremental backup, you must first perform an image backup using the /RECORD qualifier (see Section 11.15.2).
  2. To determine the date of the last backup that used the /RECORD qualifier, enter the DIRECTORY/FULL command and the file name. For example:


    $ DIRECTORY/FULL LOGIN.COM
    Directory WORK204:[HIGGINS] 
     
    LOGIN.COM;31                  File ID:  (23788,1,0)        
    Size:            7/9          Owner:    [ACC,HIGGINS] 
    Created:  30-APR-2000 14:37:33.98 
    Revised:  30-APR-2000 14:37:34.44 (1) 
    Expires:   <None specified> 
    Backup:   30-APR-2000 20:20:57.37 
    File organization:  Sequential 
    File attributes:    Allocation: 9, Extend: 0, Global buffer count: 0, No version limit 
    Record format:      Variable length, maximum 94 bytes 
    Record attributes:  Carriage return carriage control 
    RMS attributes:     None 
    Journaling enabled: None 
    File protection:    System:RWED, Owner:RWED, Group:RE, World: 
    Access Cntrl List:  None 
     
    Total of 1 file, 7/9 blocks. 
     
    $
    

    The date of the last /RECORD backup is indicated in the Backup field of the display. In this example, a /RECORD backup was performed on 30-APR-2000 20:20:57.37.

    Note

    If you used the /IGNORE=INTERLOCK qualifier to back up open files during your last image backup or incremental backup in which the /RECORD qualifier was used, see Section 11.18.3. If the files remain open, they will not be included in the incremental backup because their backup date fields are not as recent as the last image backup or incremental backup in which the /RECORD qualifier was used.
  3. Enter the BACKUP command in the following format:

    BACKUP/RECORD/SINCE=BACKUP input-specifier output-specifier/SAVE_SET


    The /RECORD qualifier records the current date and time in the file header record of each file that is backed up. The first step in an incremental backup is an image backup (see Section 11.15.2). If you plan to perform incremental backups, you must use the /RECORD qualifier when you perform image backups. The /SINCE=BACKUP qualifier backs up files dated later than the last /RECORD backup. The /SAVE_SET qualifier indicates that you are creating a save set on a disk.

Examples

  1. To create an incremental backup of a disk named DUA55: on a sequential disk save set on a disk named DJC12:, you could enter the following commands:


    $ MOUNT DUA55: DISK1
    %MOUNT-I-MOUNTED, DISK1 mounted on _DUA55:
    $ MOUNT/FOREIGN DJC12:
    %MOUNT-I-MOUNTED, DISK2 mounted on _DJC12:
    $ BACKUP/RECORD/SINCE=BACKUP
    _From: DUA55:[000000...]
    _To: DJC12:USER1.SAV/SAVE_SET
    

  2. You can also specify multiple disk drives as the output device in the BACKUP command line. For example:


    $ MOUNT DUA0: USER1
    %MOUNT-I-MOUNTED, USER1 mounted on _DUA0:
    $ MOUNT/FOREIGN DUB24:
    %MOUNT-I-MOUNTED, DISK2 mounted on _DUB24:
    $ MOUNT/FOREIGN DUB25:
    %MOUNT-I-MOUNTED, DISK3 mounted on _DUB25:
    $ BACKUP/RECORD/SINCE=BACKUP
    _From: DUA0:[000000...]
    _To: DUB24:USER1.SAV,DUB25/SAVE_SET
    


Previous Next Contents Index

  [Go to the documentation home page] [How to order documentation] [Help on this site] [How to contact us]  
  privacy and legal statement  
6017PRO_049.HTML