DB2 Server for VSE & VM: Data Restore Guide


Backup Procedures

This section describes how to create an archive to protect your database against system failure using the BACKUP function.

Using Data Restore for Database Backups

Database backup files must be referenced in the DB2 Server for VSE & VM history area, so that if you use Data Restore to restore the database, all changes in successive log files are automatically reapplied when the STARTUP=U parameter is specified.

Step 1. Stop the DB2 Server for VSE & VM Server Before Backing Up Your Database

Before you start to backup your database, you must stop your application server.

You must stop your server by issuing an SQLEND UARCHIVE operator command to have the backup referenced in the history area as shown in Figure 62. After all logical units of work are completed, the database manager indicates that you must save the directory and all dbextents. If the database is running in LOGMODE=L and the log is not empty, a log archive is taken before terminating the database.

When the server is stopped, take the user archive using Data Restore.

Figure 62. Stopping the Server with SQLEND UARCHIVE

ARI0062A ENTER A DB2 FOR VSE OPERATOR COMMAND.
SQLEND UARCHIVE
ARI0028I THE DATABASE MANAGER IS TERMINATING.
ARI0065I OPERATOR COMMAND PROCESSING IS COMPLETE.
ARI0239I EXTERNAL LABELING OF THIS ARCHIVE IS
         TYPE    DATABASE ARCHIVE
         TIMESTAMP  09-09-95   14:30:15
ARI0205I YOU MUST USER-ARCHIVE THE DIRECTORY AND 8
                 DBEXTENTS(S) BUT NOT THE LOG
ARI0032I THE DATABASE MANAGER HAS TERMINATED.

You can only recover from the archive. You cannot reapply the changes referenced in the log.

In this case, it is not necessary for the server to know when the database backup was done. You can use the SQLEND operator command to stop the server, as shown in Figure 63. If you want to ensure that the log history is updated, use the SQLEND UARCHIVE command.

Figure 63. Stopping the Server with SQLEND

ARI0062A ENTER A DB2 FOR VSE OPERATOR COMMAND.
SQLEND
ARI0028I THE DATABASE MANAGER IS TERMINATING.
ARI0065I OPERATOR COMMAND PROCESSING IS COMPLETED.
ARI0032I THE DATABASE MANAGER HAS TERMINATED.

Step 2. Processing a Data Restore Backup

To process a backup of a database, you must create a SYSIN file to identify the database you want to process and the name of the function to process. (Figure 64 contains an overview of the BACKUP process.)

Figure 64. Overview of Backing Up a Database


fig40

In Figure 64, the DB2 Server for VSE & VM DATABASE disk represents the directory and all the defined dbextents. You can create the backup file on tape or DASD. You can also take dual backups to tape, DASD, or a combination of tape and DASD. When the backup is complete, Data Restore produces a report specifying how many blocks have been saved from the directory, how many blocks have been saved from all the saved dbextents, and a list of all the tables that can be reloaded from the file.

To back up your database, use the BACKUP command. For a incremental backup of your database, use the INCREMENTAL BACKUP command. See BACKUP for more information on this command.

Step 2.1 explains how to back up your database in a VM environment. To process the BACKUP function in a VSE environment, go to Step 2.2 Backing Up Your Database (VSE).

Step 2.1 Backing Up Your Database (VM)

  1. Log on to the CMS machine where Data Restore is installed.
  2. Verify that the SYSIN file contains a CONTROL statement with the correct DBNAME parameter and a BACKUP statement. (The DBNAME parameter must be specified to access the associated dbname SQLFDEF files to link the CMS minidisks to BACKUP.)

    Figure 65. Contents of SYSIN File (BACKUP SYSIN A)

    OPTIONS CONFIRM=NO
    CONTROL DBNAME=dbname
    BACKUP
    

  3. Verify that the FILEDEFs are specified in the BACKUP EXEC and that they assign the output file to tape or DASD or both.
  4. Run an EXEC to execute the XTS91001 program as shown in the example in Figure 66. To take a dual back up, see Figure 67.

    Figure 66. Executing a BACKUP to Tape in a VM Environment.

             /**/
    (1) ---> 'FILEDEF ARCHIV TAP1 SL 1 (RECFM VB BLOCK 32760'
    (2) ---> 'FILEDEF SYSPRINT DISK BACKUP SYSPRINT A'
    (3) ---> 'FILEDEF SYSIN DISK BACKUP SYSIN A'
    (4) ---> 'XTS91001'
    

    Statement 1
    Assigns the FILEDEF to a tape device. Attach the tape drive as address 181. ARCHIV is the name of the output file for the BACKUP function. The output file is variable blocked with 32760-byte blocks.

    Statement 2
    Creates the SYSPRINT report containing a list of all steps executed. Figure 69 shows a function report produced by the BACKUP function in more detail.

    Statement 3
    Identifies the SYSIN file which contains the statements shown in Figure 65:

    You must be able able to access the dbname SQLFDEF files that are on the database production disk when you are executing the Data Restore functions. Make sure you link and access the minidisk where Data Restore is installed before executing the BACKUP function.

    If the CONFIRM=YES parameter is specified, you must confirm that you want to continue with the backup before starting the BACKUP function.

    Statement 4
    Executes the BACKUP function specified in the SYSIN file.

    Note:In all the other Data Restore functions, you edit the SYSIN file and modify the parameters before execution. For the BACKUP function, the procedure avoids operator intervention and does not require you to edit the file.

  5. Verify the return code and list produced on SYSPRINT.

Executing a Dual Backup (VM)

If you want to take a dual backup, execute an EXEC like the one shown in Figure 67 instead of the one shown in Figure 66.

Figure 67. Executing a Dual Backup in a VM Environment

         /**/
(1) ---> 'FILEDEF ARCHIV TAP1 SL 1 (RECFM VB BLOCK 32760'
(2) ---> 'FILEDEF ARCHIV2 DISK SQLDBA BACKUP A (RECFM VB BLOCK 32760'
(3) ---> 'FILEDEF SYSPRINT DISK BACKUP SYSPRINT A'
(4) ---> 'FILEDEF SYSIN DISK BACKUP SYSIN A'
(5) ---> 'XTS91001'

Statement 1
Assigns the FILEDEF to a tape device. Attach the tape drive as address 181. ARCHIV is the name of the output file for the BACKUP function. The output file is variable blocked with 32760-byte blocks.

Statement 2
Assigns the FILEDEF to a disk. ARCHIV2 is the name of the output file for the BACKUP function. The output file is variable blocked with 32760-byte blocks.

Statement 3
Creates the SYSPRINT report containing a list of all processes executed. Figure 69. shows a function report produced by the BACKUP function in more detail.

Statement 4
Identifies the SYSIN file which must contain the statements shown in Figure 68.

Figure 68. Control Statement to Execute a Backup in a VM Environment

OPTIONS DEVICE2=DASD CONFIRM=NO
CONTROL DBNAME=dbname
BACKUP

You must be able able to access the dbname SQLFDEF files that are on the database production disk when you are executing the Data Restore functions. Make sure you link and access the minidisk where Data Restore is installed before executing the BACKUP function.

To take a dual backup, assign a second device as DEVICE2=DASD. Figure 67 is an example of writing one backup to tape and the other to DASD.
Note: To write dual backups to tape, assign both devices to tape. To write dual backups to DASD, assign both devices to DASD.

If the CONFIRM=YES parameter is specified, you must confirm that you want to continue with the backup before executing the backup process.

Statement 5
Executes the BACKUP function specified in the SYSIN file.

Executing a FULL or INCREMENTAL BACKUP

To process FULL backup, modify the SYSIN in Figure 66 specifying BACKUP FULL instead of BACKUP on the last statement.

To process incremental backup, modify the SYSIN in Figure 66 specifying BACKUP INCREMENTAL instead of BACKUP on the last statement.

Figure 69. SYSPRINT File After Executing A BACKUP

(1)  ---> XTS9-143 OPTIONS DEVICE2=DASD CONFIRM=NO
(1)  ---> XTS9-143 CONTROL DBNAME=dbname
(1)  ---> XTS9-143 BACKUP
          XTS9-100 Data Restore feature VERSION 7.1.0
          XTS9-309 Processing DB2 Version 7 Release 1
(2)  ---> XTS9-172 DB2 was ended with LOGMODE L
(3)  ---> XTS9-141 External labeling of this archive is
          XTS9-142 Base dbname    date 17/10/95 - time 12:12:49
          XTS9-001 Processing directory
          XTS9-002           20010 Directory blocks saved
(4)  ---> XTS9-013 Table SQLDBA.COST_TABLE may be reloaded
          XTS9-013 Table SQLDBA.DEPARTMENT may be reloaded
          XTS9-013 Table SQLDBA.EMPLOYEE may be reloaded
          XTS9-013 Table SQLDBA.EMPLOYEE_ACTIVITY may be reloaded
          XTS9-013 Table SQLDBA.FOREIG may be reloaded
          XTS9-013 Table SQLDBA.INVENTORY may be reloaded
          XTS9-013 Table SQLDBA.OPERATIONS may be reloaded
          XTS9-013 Table SQLDBA.ORDERS may be reloaded
          XTS9-013 Table SQLDBA.PLAN_TABLE may be reloaded
          XTS9-013 Table SQLDBA.ROUTINE may be reloaded
          XTS9-145 Table SQLDBA.STORED QUERIES may be reloaded
          XTS9-013 Table SQLDBA.STRUCTURE_TABLE may be reloaded
          XTS9-013 Table SQLDBA.SUPPLIERS may be reloaded
          XTS9-013 Table SQLDBA.SYSLANGUAGE may be reloaded
          XTS9-013 Table SQLDBA.SYSTEXT1 may be reloaded
          XTS9-013 Table SQLDBA.SYSTEXT2 may be reloaded
          XTS9-013 Table SQLDBA.SYSUSERLIST may be reloaded
(5)  ---> XTS9-006 processing DDSK1
(5)  ---> XTS9-005              2 blocks saved
(5)  ---> XTS9-006 processing DDSK4
(5)  ---> XTS9-005              1 blocks saved
(6)  ---> XTS9-006 processing DDSK1
(7)  ---> XTS9-005           2870 blocks saved
          XTS9-006 processing DDSK2
          XTS9-005            383 blocks saved
          XTS9-006 processing DDSK3
          XTS9-005              7 blocks saved
          XTS9-006 processing DDSK4
          XTS9-005              1 blocks saved
          XTS9-006 processing DDSK5
          XTS9-005              1 blocks saved
          XTS9-006 processing DDSK6
          XTS9-005              1 blocks saved
          XTS9-006 processing DDSK7
          XTS9-005              1 blocks saved
          XTS9-006 processing DDSK8
          XTS9-005              1 blocks saved
          XTS9-007 processing successfully completed

Statement 1
Displays the contents of the SYSIN file on SYSPRINT.

Statement 2
Displays the Logmode type when the server was ended.

Statement 3
Displays the external labeling of the BACKUP.

Statement 4
Displays the list of reloadable tables from the BACKUP file.

Statement 5
For some dbextents, header pages may be saved before other pages.

Statement 6
Displays each saved dbextent when processed

Statement 7
Displays the number of dbextent blocks saved is displayed.

Step 2.2 Backing Up Your Database (VSE)

  1. Verify that the library where Data Restore was installed is specified on the LIBDEF statement in your backup job.
  2. Verify that the SYSIN file in the JCL contains a CONTROL statement with the correct dbname parameter and the BACKUP statement as shown in the example in Figure 70. If you want to take a dual backup, use the example shown in Figure 71.
  3. Verify that the TLBL or DLBL statement in the JCL is correct to assign the output file to tape or DASD.
  4. Run the BACKUP JCL to run the backup procedure.
  5. Verify the return code and list produced on SYSLST.

Figure 70. JCL to Execute a BACKUP to Tape in a VSE Environment

         // JOB BACKUP
(1) ---> // LIBDEF *,SEARCH=(PRD2.DB2vrm,PRD2.RCVvrm)
(2) ---> // EXEC PROC=ARIS71DB
(3) ---> // TLBL ARCHIV,'ARCHIVE.DB2'
(4) ---> // ASSGN SYS006,180
(5) ---> // MTC REW,SYS006
(6) ---> // EXEC XTS91001,SIZE=AUTO
(7) ---> OPTIONS DEVICE=TAPE
(8) ---> CONTROL DBNAME=dbname
(9) ---> BACKUP
/*

Statement 1
Specifies the DB2 and Data Restore libraries.

Statement 2
Executes the procedure containing all the DB2 DLBLs.

Statement 3
Specifies the ddname of the output file. In this example ARCHIV is the ddname of the output file for the BACKUP function.

Statement 4
Assigns the file to a tape device. The output file is variable blocked with 32760 bytes' blocks.

Statement 5
Positions the tape at the beginning.

Statement 6
Runs the program to execute the BACKUP function.

Statement 7
Specifies the device.

Statement 8
Uses the control statement to specify the name of the database. This dbname is only used to name the output file.

Statement 9
Processes the BACKUP function.

The SYSLST report contains a list of all the executed processes. A function report produced by the BACKUP function is described in Figure 72.

Executing a Dual Backup in the VSE Environment

If you want to take a dual backup, execute a BACKUP job using JCL similar to that shown in Figure 71 instead of that shown in Figure 70.

Figure 71. Executing a Dual Backup in a VSE Environment

          // JOB BACKUP
(1)  ---> // LIBDEF *,SEARCH=(PRD2.DB2vrm,PRD2.RCVvrm)
(2)  ---> // EXEC PROC=ARIS71DB
(3)  ---> // TLBL ARCHIV,'ARCHIVE.DB2'
(4)  ---> // ASSGN SYS006,180
(5)  ---> // MTC REW,SYS006
(6)  ---> // DLBL ARCHIV2,'ARCHIVE.DB2',,VSAM,RECSIZE=32750,RECORDS=(xxx,yyy)
(7)  ---> // EXEC XTS91001,SIZE=AUTO
(8)  ---> OPTIONS DEVICE2=DASD DEVICE=TAPE
(9)  ---> CONTROL  DBNAME=dbname
(10) ---> BACKUP
          /*

Statement 1
Specifies the DB2 and Data Restore feature libraries

Statement 2
Executes the procedure containing all the DB2 DLBLs.

Statement 3
Specifies ARCHIV as the ddname for the output file for the BACKUP function.

Statement 4
Assigns the file to a tape device. The output file is variable blocked with 32760-byte blocks.

Statement 5
Positions the tape at the beginning.

Statement 6
Specifies ARCHIV2 as the ddname of the second output file for the BACKUP function. Also note, xxx and yyy represent numerical values which should be large enough to hold the archive data.

Statement 7
Runs the program to execute the function.

Statement 8
Uses the OPTIONS statement to specify to take the second archive to DASD.

Statement 9
Specifies the name of the database in the control statement. This dbname is only used to name the output file.

Statement 10
Processes the BACKUP function.

The SYSLST report contains a list of all the processes executed. A function report produced by the BACKUP function is described in Figure 72.

Figure 72. Report after a Backup is Completed

(1)  ---> XTS9-143 OPTIONS  DEVICE=TAPE  CONFIRM=NO
(1)  ---> XTS9-143 CONTROL DBNAME=dbname
(1)  ---> XTS9-143 BACKUP
          XTS9-143 /*
          XTS9-100 Data Restore feature VERSION 7.1.0
          XTS9-309 Processing DB2 Version 7 Release 1
(2)  ---> XTS9-172 DB2 was ended with LOGMODE L
(3)  ---> XTS9-141 External labeling of this archive is
          XTS9-142 Base SQL/VSE    date 17/10/95 - time 12:12:49
          XTS9-001 Processing directory
          XTS9-002           20010 Directory blocks saved
(4)  ---> XTS9-013 Table SQLDBA.COST_TABLE may be reloaded
          XTS9-013 Table SQLDBA.DEPARTMENT may be reloaded
          XTS9-013 Table SQLDBA.EMPLOYEE may be reloaded
          XTS9-013 Table SQLDBA.EMPLOYEE_ACTIVITY may be reloaded
          XTS9-013 Table SQLDBA.FOREIG may be reloaded
          XTS9-013 Table SQLDBA.INVENTORY may be reloaded
          XTS9-013 Table SQLDBA.OPERATIONS may be reloaded
          XTS9-013 Table SQLDBA.ORDERS may be reloaded
          XTS9-013 Table SQLDBA.PLAN_TABLE may be reloaded
          XTS9-013 Table SQLDBA.ROUTINE may be reloaded
          XTS9-145 Table SQLDBA.STORED QUERIES may be reloaded
          XTS9-013 Table SQLDBA.STRUCTURE_TABLE may be reloaded
          XTS9-013 Table SQLDBA.SUPPLIERS may be reloaded
          XTS9-013 Table SQLDBA.SYSLANGUAGE may be reloaded
          XTS9-013 Table SQLDBA.SYSTEXT1 may be reloaded
          XTS9-013 Table SQLDBA.SYSTEXT2 may be reloaded
          XTS9-013 Table SQLDBA.SYSUSERLIST may be reloaded
(5)  ---> XTS9-006 processing DDSK1
(5)  ---> XTS9-005              1 blocks saved
(5)  ---> XTS9-006 processing DDSK4
(5)  ---> XTS9-005              1 blocks saved
(6)  ---> XTS9-006 processing DDSK1
(7)  ---> XTS9-005           2870 blocks saved
          XTS9-006 processing DDSK2
          XTS9-005            383 blocks saved
          XTS9-006 processing DDSK3
          XTS9-005              7 blocks saved
          XTS9-006 processing DDSK4
          XTS9-005              1 blocks saved
          XTS9-006 processing DDSK5
          XTS9-005              1 blocks saved
          XTS9-006 processing DDSK6
          XTS9-005              1 blocks saved
          XTS9-006 processing DDSK7
          XTS9-005              1 blocks saved
          XTS9-006 processing DDSK8
          XTS9-005              1 blocks saved
          XTS9-007 processing successfully completed

Statement 1
Displays the contents of SYSIN on the SYSLST

Statement 2
Displays the log mode type when the server was ended.

Statement 3
Displays the external labeling for the BACKUP.

Statement 4
Displays the list of reloadable tables from the BACKUP file.

Statement 5
For some dbextents, header pages may be saved before other pages.

Statement 6
Displays each saved dbextent when processed.

Statement 7
Displays the number of dbextent blocks saved.

Step 3. Restarting the Database After Backing Up your Database

If you used the SQLEND UARCHIVE command to stop the application server, the next time you start the server, you are asked if the BACKUP process executed successfully as shown in Figure 73.

Figure 73. Restarting the Database After BACKUP When the Process Was Successful

ARI0025I THE PROGRAM ARISQLDS IS LOADED AT 7F2078.
ARI0025I THE PROGRAM ARICMOD IS LOADED AT 905D80.
ARI0025I THE PROGRAM ARIXRDS IS LOADED AT 9CA000.
ARI0025I THE PROGRAM ARIXSXR IS LOADED AT B4A000
ARI0206D DID THE USER-ARCHIVE OF THE DIRECTORY AND 8
               DBEXTENT(S) EXECUTE SUCCESSFULLY
               REPLY 0(N0) OR 1(YES)
1
ARI0283I LOG ANALYSIS COMPLETE
ARI0282I LUW UNDO COMPLETE
ARI0281I LUW REDO COMPLETE
ARI0060I DATABASE MANAGER INITIALIZATION COMPLETE.
ARI0045I READY FOR OPERATOR COMMUNICATIONS

When you answer 1 to indicate that the previous backup executed successfully, the history area is updated to specify that the BACKUP process completed without an error.

If an error occurred during the BACKUP function, answer 0 and the database server will restart without the BACKUP process completing successfully.

Figure 74. Restarting the Database After BACKUP When the Process Was Not Successful

ARI0025I THE PROGRAM ARISQLDS IS LOADED AT 7F2078.
ARI0025I THE PROGRAM ARICMOD IS LOADED AT 905D80.
ARI0025I THE PROGRAM ARIXRDS IS LOADED AT 9CA000.
ARI0025I THE PROGRAM ARIXSXR IS LOADED AT B4A000
ARI0206D DID THE USER-ARCHIVE OF THE DIRECTORY AND 8
               DBEXTENT(S) EXECUTE SUCCESSFULLY
               REPLY 0(N0) OR 1(YES)
0
ARI0207D DO YOU WISH TO CONTINUE (WITHOUT USER-ARCHIVE) OR CANCEL
 (REDO THE USER-ARCHIVE)?
REPLY 'CONTINUE' OR 'CANCEL'
CONTINUE
ARI0283I LOG ANALYSIS COMPLETE
ARI0282I LUW UNDO COMPLETE
ARI0281I LUW REDO COMPLETE
ARI0060I DATABASE MANAGER INITIALIZATION COMPLETE.
ARI0045I READY FOR OPERATOR COMMUNICATIONS

If you answered 0 to indicate that the BACKUP function did not complete successfully, you can choose to continue without the user archive or to redo the user archive. If you choose to continue without the user archive, the unsuccessful user archive is ignored. If you choose to redo the user archive, the CANCEL command stops the server and you must execute the BACKUP after the correcting the problem.

If you stop the application server using SQLEND when LOGMODE=Y, normal start up messages are displayed the next time the server is started as there is no record that you took a user archive.


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