DB2 Server for VM: System Administration


Archiving Procedures

This section describes how to create archives to protect your database against system failure. If a system failure occurs while you are taking an archive, see Restarting from a System Failure While Archiving.

Performing Database Archives With Database Manager Facilities

Database archives are tape copies of the directory and dbextents that are carried out using the database manager archiving facilities:

Contention During an Archive

When a database archive is taken online, using database manager facilities only, other work usually continues. If, however, a condition arises during the archive that requires a checkpoint to be taken, other work must wait until the archive process completes. Such conditions include:

Note:You can use the SHOW LOG operator command to monitor available log space to assist you in scheduling database archives. See the DB2 Server for VSE & VM Operation manual for description of operator commands.

Example of an SQLEND ARCHIVE

If you intend to create database archives, specify a value for the LOGMODE parameter of A or L when you start the application server.

SQLEND ARCHIVE with LOGMODE=A

To use the SQLEND ARCHIVE command when LOGMODE=A:

  1. Log on using the user ID and password for the database machine.
  2. Attach and mount a labeled tape at virtual device address 181. Indicate that you are writing to the tape. See the VM system administrator for the procedures used at your installation to label, attach, and mount tapes.
  3. To identify who is connected to the application server, type the following command and press ENTER:
    SHOW USERS
    

    You see a list of the users connected to the application server. Some of these users could be accessing data in the database.

  4. Notify the current users that you want to stop the application server. Ask them to complete their work and sign off. If any user does not stop voluntarily, consider using the FORCE command to disconnect that user. Use this command with caution, however, as the uncommitted work of the users you disconnect is rolled back.
  5. To start the archive process and stop the application server, type the following command and press ENTER:
    SQLEND ARCHIVE DVERIFY
    

    You should verify the directory whenever you create a database archive by specifying the DVERIFY parameter for the SQLEND ARCHIVE command. If you do not verify the directory, inconsistencies in the control information are recorded in the database archive. A subsequent restoration using that archive would fail. When you verify the directory, the system displays a message if it finds an error, and does not create the database archive.

  6. While the database manager is creating the database archive, a number of messages are displayed at your display terminal. Among them is ARI0239I.

    Write the information that this message provides on the external label of each tape reel or cartridge. Include the date, time, and type of archive (database). See Labeling Your Archive Tapes for further instructions on how to use this information. During a restoration, the same information is provided, so you can easily verify that you are using the proper tape volumes.

  7. The database manager prompts you for the virtual device address of your tape:
    ARI0299A Ready archive output volume. Enter the CUU.
    

    Type the following and press ENTER:

    181
    
  8. When the tape is full, the system prompts you to mount a second tape. After you mount the second tape, type the following and press ENTER:
    READY
    

    A delay can occur as the database is copied to tape. The system continues to request that you mount new tapes until the database archive is completed. The number of tapes you are required to mount depends on the size of your database.

    When the archive is completed and the database is copied, you see the following message:

    ARI0292I ARCHIVE is completed.
    
    Note:While the archive is being created you can still enter operator commands.

    When the application server stops, you see the messages:

    ARI0032I The database manager has terminated.
    ARI0043I Database manager return code is 0.
    

    You have finished creating the database archive.

SQLEND ARCHIVE with LOGMODE=L

If you run the application server with LOGMODE=L, the SQLEND ARCHIVE command ensures that you have an unbroken sequence of log archives by creating the log archive (if there is information in the log) before the database archive. You use the SQLEND ARCHIVE command when LOGMODE=L in the same way you do when LOGMODE=A, except that two tapes are needed for the procedure shown here -- one for the database archive and one for the log archive, if a log archive is to be taken. It is possible to use a single tape by creating the log archive on disk. For more detail, see Log Archiving to Disk.

Using the SQLEND ARCHIVE DVERIFY with LOGMODE=L allows you to create a valid log archive, if there is information in the log, even if the system finds an error in the directory. However, in this situation, a database archive is not created.

To use the SQLEND ARCHIVE command when LOGMODE=L, do the following:

  1. Follow the first six steps for using the SQLEND ARCHIVE command when LOGMODE=A, beginning on page ***. The database manager first creates a log archive if there is information in the log. You see the message:
    ARI0254I The database manager is initiating a log archive.
             When the log archive is complete, the database
             manager will process the database archive request.
    
  2. Instruct the system to create the log archive on tape if a log archive is to be taken. Tape is the default medium for a log archive.

    The following messages prompt you for the output medium:

    ARI0252I     Medium:    tape  183
    ARI0246D The above information describes the log archive
    about to be done.  Enter either:
               CONTINUE   to proceed using the output medium
                            indicated, or
               CHANGE     to change this medium.
    
  3. To use the default medium, type the following and press ENTER:
    CONTINUE
    

    If you reply CHANGE, you can direct the log archive to disk. For more details on the CHANGE option, see Log Archiving to Disk.

  4. When the tape is full, the system prompts you to mount another tape. After you mount a new tape, type the following and press ENTER:
    READY
    

    A delay may occur while the database manager archives the log to tape. When the log is archived, you see the following message:

    ARI0292I ARCHIVE is completed.
    

    Note:While the log archive is being created, you can still enter operator commands.

  5. The system now continues with the database archive. Attach and mount a second labeled tape at virtual device address 181. Indicate that you are writing to the tape. Use the procedures set up at your installation to label, attach, and mount tapes. This tape is used for the database archive.
  6. Repeat steps 6, 7, and 8 from the LOGMODE=A example that begins on page *** to complete the database archive.

Performing Database Archives With User Facilities

User archives are database archives (LOGMODE=A or L) done with user facilities such as the VMBACKUP Management System (VMBACKUP-MS) or the BACKUP command of the Data Restore Feature. User archives include the database directory and all minidisks, but not the logs.

Because database manager archiving facilities are DASD-independent, they do not take advantage of particular DASD characteristics to improve performance. Some user facilities exploit these characteristics, and can archive and restore your database more quickly in some situations.
Note:If you use VMBACKUP-MS to create user archives, you must specify that the database directory and dbextent minidisks are non-CMS minidisks.

To begin archiving your database with user facilities, stop the application server and issue:

   SQLEND UARCHIVE

After all logical units of work have been finished, the database manager indicates in the log history that a user archive will be taken, then prompts the operator to take the archive, and ends. (If LOGMODE=L and the log contains information, it takes a log archive before ending.) When the application server ends, the operator should take the user archive. The next time the application server is started, it displays a message to confirm that the user archive was done.
Note:Confirmation of a successful user archive is required at the next startup. If the operator specifies a restore (STARTUP=R or U) the next time the application server is started, the system assumes that the user archive was not taken. If the system does not prompt the operator to confirm that a user archive was created, this means that the archive was not recognized (whether or not it was successful), and it must be repeated.
Note:Do not stop the server with SQLEND QUICK and then take a user archive because the user archive will not contain consistent data.

Freeing Log Space during a User Archive

Log space is freed after a successful user archive has been confirmed at the next startup. If you take user archives and it becomes necessary to free log space when the database manager is running, you must use either the log or database archiving facilities supplied with this product to free the log space.

For log archives, set LOGMODE=L when starting the application server, and for database archives, set LOGMODE=A. In both cases, this will ensure that database archives are automatically taken if the log fills to the ARCHPCT value. Or, if you prefer to schedule your online archives yourself, periodically issue the LARCHIVE command for log archives, or the ARCHIVE command for database archives.

Note:You can use the SHOW LOG operator command to monitor available log space to assist you in scheduling user archives.

Performing Log Archives

A log archive is a copy on tape or disk of all the active pages of the database log except for the last one, the log history area. To use log archiving, set LOGMODE to L. A log archive can only be performed with database manager facilities supplied with this product.

Log archives can be used with database archives taken with either database manager facilities or user facilities. Each sequence of log archives must be preceded by at least one database archive.

The log archive process can be started in the following ways:

Contention During an Archive

When an online log archive is requested, the database manager allows any LUWs that are active to finish, but prevents any new ones from starting. A message is displayed that tells how many LUWs are active. When they are complete, the database manager takes a checkpoint and creates the log archive. During the checkpoint, access to the database is disabled and any users or applications that try to start a new LUW will be in a lock wait.

You can monitor the locking contention caused by the online log archive by using the SHOW operator commands from the database machine console. However, you cannot issue SHOW commands from ISQL to monitor the lock contention.

In most situations, only a slight delay occurs before the checkpoint is taken, but if there are long-running LUWs, it can be longer. In a worst-case scenario, a long-running LUW can delay the log archive checkpoint long enough so that the SLOGCUSH value is reached, and the database manager must roll back the longest-running LUW to free log space.

If you find that users are experiencing long delays because the database manager is trying to take a checkpoint, you can issue the SHOW operator commands to determine which user is delaying the start of the checkpoint, and then issue the FORCE command to end that user's LUW.

During the creation of the log archive, normal access to the database is usually resumed. If, however, a condition arises during the archive that requires a checkpoint to be taken, other work must wait until the archive process completes. Such conditions include:

Note:You can use the SHOW LOG operator command to monitor available log space to assist you in scheduling log archives.

Example of an SQLEND LARCHIVE

If you intend to create log archives, specify LOGMODE=L when you start your application server. You can create your archive on tape, disk, or on a combination of these media. There are different ways to start the process. The preferred method is to issue an SQLEND LARCHIVE operator command, which instructs the application server to copy the log to tape or disk as it shuts down.

Log Archiving to Tape

To use the SQLEND LARCHIVE command to create a log archive on tape:

  1. Log on to the database machine.
  2. Attach and mount a labeled tape at virtual device address 183. Indicate that you are writing to the tape. Use the procedures set up at your installation to label, attach, and mount tapes.
  3. Start the application server with LOGMODE=L.
  4. Notify the current users that you want to stop the application server. Ask them to complete their work and sign off. If a user does not stop voluntarily, consider using the FORCE command to disconnect that user. Use this command with caution, however, as the uncommitted work of the users you disconnect is rolled back.

    To display a list of the users currently connected to the application server, type the operator command:

      SHOW USERS
    
  5. Archive the log and stop the application server by typing the following operator command:
       SQLEND LARCHIVE
    
  6. You will see the following message:
    ARI0239I External labeling of this archive is:
                 Type:      log  archive
                 Timestamp: 12-09-92  14:41:00
    ARI0252I     Medium:    tape  183
    

    Write the information that this message provides on the external label of each tape reel or cartridge. Include the date, time, and type of archive (log). See Labeling Your Archive Tapes for further instructions on how to use this information. During a restoration, the same information is provided, so you can easily verify that you are using the proper tape volumes.

  7. The following message prompts you to accept or change the default storage medium (tape is the default medium for a log archive):
    ARI0239I External labeling of this archive is:
                 Type:      log  archive
                 Timestamp: 12-09-92  14:41:00
    ARI0252I     Medium:    tape  183
    ARI0246D The above information describes the log archive
    about to be done.  Enter either:
               CONTINUE   to proceed using the output medium
                            indicated, or
               CHANGE     to change this medium.
    

    Type CONTINUE and press ENTER. (If you reply CHANGE, you can direct the log archive to disk. For more details, see Log Archiving to Disk.)

    If the tape becomes full, you will be told to mount another. After you mount the new tape, type READY and press ENTER. You will be asked for more tapes until the log archive is completed. The number of tapes required depends on the size of your log.

    When the log is completely archived, the following message is displayed:

    ARI0292I Archive is completed.
    

    Note:You can still enter operator commands while the archive is being created.

Log Archiving to Disk

Caution

Before you create log archives on disk, be aware that disks are exposed to user errors (erasing a file containing an archive), and the remote possibility of hardware problems such as head crashes.

To minimize the impact of hardware problems, ensure that all log archive disk files are physically located on disk volumes that are not used for the various database extents. You can back up the log archives yourself to achieve a higher level of recoverability.

The output disk can be either a standard CMS minidisk or a shared file system (SFS) directory. If it is a CMS minidisk, the database machine must access it in read or write mode before you start the application server. If it is an SFS directory, the database machine must access it before you start the application server.

You might experience delays if you use a remote shared file system (SFS) directory. If these delays are causing problems with archiving the log, use a lower ARCHPCT value when starting the application server.

The disk must contain enough space to hold the archived log. You must monitor the space and erase old log archives to free space if need be, as the database manager does not check that enough space exists. To calculate the size of the CMS minidisk or shared file system directory needed to contain the log archives, use this formula:

(log disk size) x (SLOGCUSH %) x (maximum number of log archives on this disk)

Where:

log disk size
is the size of the log disk used in the units you are using (for example, 4-kilobyte blocks)

SLOGCUSH %
is the value used for the SLOGCUSH parameter of the SQLSTART EXEC. The default for SLOGCUSH is 90%, so you would use the value .9 if you did not specify SLOGCUSH when you started the application server.

maximum number of log archives on this disk
is the maximum number of log archives you will store on this CMS minidisk or shared file system (SFS) directory.

To use the SQLEND LARCHIVE command to create a log archive on disk:

  1. Log on to the database machine.
  2. Start the application server with LOGMODE=L.
  3. Notify the current users that you want to stop the application server (refer to Log Archiving to Tape).
  4. Archive the log and stop the application server by typing the operator command:
       SQLEND LARCHIVE
    
  5. You will see the following message:

    ARI0239I External labeling of this archive is:
                 Type:      log  archive
                 Timestamp: 12-09-92  14:41:00
    ARI0252I     Medium:    tape  183
    ARI0246D The above information describes the log archive
    about to be done.  Enter either:
               CONTINUE   to proceed using the output medium
                            indicated, or
               CHANGE     to change this medium.
    

    Type CHANGE and press ENTER, or type CONTINUE if you want to direct the log archive to tape. You will see the following message:

    ARI0263D To direct the log archive to tape, enter TAPE followed
             by the tape address (CUU) to be used.
             To direct the log archive to disk, enter DISK followed
             by the disk file's file name,  file type, and  file mode.
             If you chose DISK, the default file is:
             SQLMACH3 12099201 ??
    
  6. Type the following and press ENTER:
       DISK = = fm
    

    where fm is the file mode of the disk to which you want to write the log archive and the two equal signs give you the default file name and file type chosen by the system. In this example, the default file name is SQLMACH3, and the default file type is 12099201. You can change these by supplying your own values.

  7. Type CONTINUE and press ENTER. When the log is completely archived, the following message is displayed:
    ARI0292I Archive is completed.
    

    Note:You can still enter operator commands while the archive is being created.

Changing the Default Medium

You can avoid having to define your disk each time you issue an SQLEND LARCHIVE, by using a file definition. To change the default medium to disk and to archive your log:

  1. Log on to the database machine.
  2. Issue a FILEDEF command for your log archive file, ARILARC, before you start the application server. For example:

       FILEDEF ARILARC DISK fn ft fm (PERM BLKSIZE 28672
    

    where fn, ft, and fm are the file name, file type, and file mode of your choice. The file name and file type you specify will not be used by the system, since it uses defaults of its own. You must only specify them so that the command will have valid syntax. The file mode you specify will be used by the system to determine on which disk to write the archive.
    Note:After a restore operation, the FILEDEF for ARILARC is inoperative. You must specify it again by either:
    • Issuing the FILEDEF command
    • Providing a new file mode. When message ARI0246D appears, type CHANGE to change the defined medium.

    The LRECL and RECFM are automatically set by the log archive utility, and should not be specified on the FILEDEF. You must specify a BLKSIZE in the FILEDEF command. The BLKSIZE must be a multiple of 4 kilobytes, up to a maximum of 28. For optimum performance, follow these guidelines:

    For more information on the FILEDEF command, see the VM/ESA: CMS Command Reference manual for your VM system.

  3. Start the application server with LOGMODE=L.
  4. Notify the current users that you want to stop the application server (refer to Log Archiving to Tape).
  5. Archive the log and stop the application server by typing the operator command:
       SQLEND LARCHIVE
    
  6. You will see the following message:
    ARI0239I External labeling of this archive is:
                 Type:      log  archive
                 Timestamp: 12-09-92  15:02:23
    ARI0252I     Medium:    disk  SQLMACH3 12099202 A1
    ARI0246D The above information describes the log archive
             about to be done.  Enter either:
               CONTINUE   to proceed using the output medium
                            indicated, or
               CHANGE     to change this medium.
    

    Notice that "Medium" has changed to disk SQLMACH3 12099202 A1.

  7. Type CONTINUE and press ENTER. When the log is completely archived, the following message is displayed:
    ARI0292I Archive is completed.
    

File Names and File Types Used for Log Archives on Disk

When you direct a log archive to disk, the name of the application server is used as the file name, and the date of the log archive as the file type. The date has the format mmddyynn, where the value nn is the number of the log archive taken on that day: for example, 01 is the first log archive of the day. (Your system may use a different format.)

You can change the file name and file type of a log archive file when you enter the file mode. If you do, you should choose a new file name and/or file type to help you restore the log archive in the right sequence.

Maintaining Log Archive Disk without Stopping the Application Server

When you direct log archiving to disk, a new file is created for each log archive. If you have a continuous operation environment and the log archive files are not removed to other storage facilities, the disk eventually gets full. If a "disk full" error occurs, you will not be able to use another user ID to perform maintenance on that disk. You must shut down the application server, and do the maintenance from the machine side. Thus you should periodically transfer the log archive files to other disks to ensure that the disk always has enough space to store another log archive.

You can perform this maintenance through another user ID when the database manager is running, in one of three ways:

  1. Use the shared file system.
  2. Transfer files from the disk as follows:
    1. Record the disk address of the disk for log archiving before startup, and wait until you see the messages indicating that the log archive is completed.
    2. Issue the CP DETACH command from the DB2 Server for VM operator console as follows:
      #CP DETACH daddr
      

      where daddr is the address of the disk used for log archiving. This disk is now available for maintenance. Link to the disk and transfer the log archive files to other disks.

    3. When maintenance is complete, release and detach the disk used for log archiving.
    4. Issue the following command from the operator console to link the disk used for log archiving to its original address with write access mode:
      #CP LINK id vdev1 vdev2 W
      

      where id is the user ID to which the disk belongs, vdev1 is the disk address specified in the system directory, and vdev2 is the original disk address recorded in step 2a.

      If the operator forgets to relink the disk and uses the same file mode for the next log archive, a message is displayed to indicate that the device used for log archiving does not exist. The operator should then issue the CP LINK command.

      Do not detach and make any changes to the work disk (A-disk), service disk (V-disk), production disk (Q-disk), or other database disks. These disks are crucial for running the database manager. Use a separate disk to store the files created by the log archive.

  3. This method does not require that the disk used for log archiving be detached from and relinked to the database machine. The link is kept intact, but the user doing maintenance on the disk between log archives must link to the disk using multiple write mode, because the database manager has a write link to the disk. When you complete the maintenance, release and detach the disk.

In methods 2 and 3 above, the database manager ensures that it is the sole writer of the disk for log archiving at archive time. If this is not the case, it sends a message to the operator, and suspends the archive until the situation is corrected. In method 1, the checking is done by the shared file system.

When a medium for log archiving is decided, the database manager establishes the links, checking that the medium is a disk. If it detects that other machines have the disk linked in write mode, it displays a list of user IDs with the write link, and the address to which they are linked. The operator is prompted to detach all the write links before proceeding to the log archive, or to quit the link checking and change the medium for the archive. If too many links to the disk exist, including read-only and read/write links, some of the read-only links may have to be detached.

Labeling Your Archive Tapes

Because there are different types of archives, and each may require multiple tape volumes, it is a good idea to label the tapes externally in case you have to restore the database.

When the database manager prompts the operator to mount the tape to record the archive, it also displays a message that includes the date, time, and type of archive (database or log). For example:

     ARI0239I External labeling of this archive is:
                  Type:      log  archive
                  Timestamp: 12-09-92  14:41:00
     ARI0252I     Medium:    tape  183

The timestamp and type of archive provide identifying information about this archive, and should be written on the external label of each tape reel or cartridge. The label information is provided by the database manager for the first volume of the archive. If your archive requires more than one tape volume, add your own sequential identification to each label (for example, Tape1 of 2, Tape2 of 2).

When the database is restored, the database manager checks if there are any log archives associated with the database archive. If log archives exist, a list of them is displayed, and the time and date of each is provided. The information on the external label can be matched against this list to find the correct tapes to use for the restore.


[ Top of Page | Previous Page | Next Page | Table of Contents | Index ]