5 0 0:DB2 Backup

From SEPsesam


This is documentation for SEP sesam version 5.0.0 Jaglion.
This is not the latest version of SEP sesam documentation and, as such, does not provide information on features introduced in the latest release. For more information on SEP sesam releases, see SEP sesam Release Versions. For the latest documentation, check SEP sesam documentation.


Overview


The procedures and features described here contain only information about the SEP sesam-specific parts of DB2 backup. For detailed information on DB2-specific backup and recovery, refer to the DB2 administration guide.

SEP sesam online backup for IBM DB2 Universal Database (UDB) integrates with the XBSA interface of DB2 and backs up data of DB2 databases to SEP sesam Server. The XBSA API manages the access from DB2 backup utility to SEP sesam to coordinate a backup of the database. SEP sesam provides a shared library db2xbsa, which is loaded by DB2 to access SEP sesam backup and restore APIs.

The backup and restore processes, including managing storage media, are managed by SEP sesam, while the DB2 API decides which data have to be backed up or recovered.

The SEP sesam DB2 module (db2xbsa.so/db2xbsa.dll) is part of the SEP sesam Client, except for the DB2 module (db2xbsa.so) for the IBM AIX operating system. In the latter case, you have to download the module from SEP Download Center. For details, see the section Installing SEP sesam DB2 module on IBM AIX.

Requirements

To ensure error-free operation of SEP sesam and improve performance, make sure that the following conditions are met:

Adding the DB2 client to the SEP sesam environment

Once you have downloaded the SEP sesam package, proceed as follows: You configure a new client by adding it to the SEP sesam environment: Main selection -> Components -> Clients -> New Client -> add your DB2 client. For details, see Configuring Clients.

Note
Before proceeding, verify that you can backup to SEP sesam. Run a test Path backup manually to ensure that the backups work. For details on typical backup configuration, see Standard Backup Procedure.

Installing SEP sesam DB2 module on IBM AIX

Before downloading the DB2 module for IBM AIX, verify that SEP sesam Client is installed and added to the SEP sesam environment, and make sure that the Path backup is successful as described in the previous section.

  1. Log in as the root user to your IBM AIX computer.
  2. Download the DB2 module from SEP Download Center to a temporary directory.
  3. Unzip sesam-db2-aix_64-bit.tar.gz.
  4. Unpack the tar file sesam-db2-aix_64-bit.tar.
  5. Deploy db2xbsa.so as described in the following section.

Example ( the file sesam-db2-aix_64-bit.tar.gz is downloaded to /tmp) :

# cd /tmp
# gunzip sesam-db2-aix_64-bit.tar.gz
# tar xf sesam-db2-aix_64-bit.tar
# cp db2xbsa.so /opt/sesam/bin/sesam
#

Deploying shared library db2xbsa

The SEP sesam DB2 package contains a shared library that the DB2 server dynamically loads during backup or restore.

You have two options to use the db2xbsa.so/db2xbsa.dll library. You can either use the file located in the <SESAM_ROOT>/bin/sesam directory or copy it to the DB2 default library directory on the DB2 server. Note that the db2 backup command will be different depending on which method you use for shared library deployment.

Copying shared library db2xbsa into DB2 default library directory

Instead of using the shared library from the <SESAM_ROOT>/bin/sesam directory and specifying the path with the LOAD command, you can put it into the DB2 library directory on the DB2 server.

  • DB2DIR=/opt/IBM/db2/V8.1 (the DB2 product directory)
root@linux:~# cd /tmp/
root@linux:/tmp # cp db2xbsa.so /opt/IBM/db2/V8.1/lib
  • The used db2 backup command is then different; instead of LOAD, the USE XBSA command is used. For details, see the section Starting DB2 database backup.

Configuring DB2 backup

For DB2 backups, SEP sesam Server acts as a media manager. It handles media and provides scheduling, media management, and monitoring for DB2 backups and restores. DB2 is responsible for the source – what is going to be backed up.

Creating a backup task with task type IBM Db2 on SEP sesam Server

Use the SEP sesam GUI to configure the DB2 backup tasks. You have to create a separate backup task for each DB2 database you want to back up.

  1. From Main Selection -> Tasks -> By Clients, select the DB2 client and click New Backup Task. The New Backup Task window opens.
  2. Enter the Task name, e.g., DB2_SAMPLE.
  3. As Task type, select IBM Db2 (formerly DB2 UDB).
  4. Specify the Source; since you have to create a separate backup task for each DB2 database you want to back up, the source must be specified accordingly, e.g., specify a database SAMPLE for the backup task DB2_SAMPLE, and database PROD for a task DB2_PROD, etc.

  5. Click OK to create the task.
  6. Create a new command event for scheduling the DB2 backup (and, if necessary, set permission to execute commands). You can insert the backup start command into a script on the DB2 server and then trigger the script by SEP sesam command event. For details, see Creating a Command Event.

Configuration on the DB2 server

DB2 provides the ability to perform online backups, allowing applications to use the database while backups are being taken. To enable this, you need to provide SEP sesam information to DB2 and configure specific DB2 database configuration parameters.

SEP sesam parameters for DB2

First, you have to provide DB2 the following relevant parameters to connect to SEP sesam Server. Edit the db2.conf file to provide information about the database, policy, and schedule to be used.

SESAM_SERVER
The name of the SEP sesam Server
SESAM_JOB
The name of the previously configured DB2 backup task (with the task type DB2 UDB), e.g., DB2_SAMPLE
SESAM_POOL
The name of the previously configured media pool on SEP sesam Server
SESAM_TAPE_SERVER (optional)
Name of Remote Device Server to use
SESAM_DRIVE (optional)
Number of the SEP sesam drive that you want to use for backup
XBSA_TRACE (optional)
<Trace level> (0|1|2|3) (if set with +128, then log XBSA trace output to STDERR, e.g. 2+128 -> 'set XBSA_TRACE=130')
XBSA_LOGFILE (optional)
<Full pathname of trace file sdb2.log>

Some of the parameters are optional, but even though the XBSA_TRACE and XBSA_LOGFILE are not mandatory, they should be set to provide information in case of problems during backup or restore.

DB2 configuration parameters

Before you modify the DB2 database configuration parameters, make sure that no applications are currently using the DB2 database.

To enable online backups, you have to enable archive logging for DB2. By default, circular logging is enabled after creating a database; it only allows to take offline backups. To enable archive logging, you need to modify the LOGARCHMETH1 database configuration parameter. Archive logging also allows you to restore a database from a backup image and roll forward to a particular point using logs thus getting it to a consistent state.

LOGARCHMETH1 and LOGARCHOPT1 – automatic archive log backup to SEP sesam
LOGARCHMETH1 parameter is used to archive and handle DB2 database log files. The values are OFF, RETAIN, USEREXIT, DISK, TSM, and VENDOR. The latter must be set to specify that a vendor library – in the case of SEP sesam db2xbsa.so or db2xbsa.dll – is used to archive the log files. The value must be followed by a colon(:) and the shared library name db2xbsa.so/db2xbsa.dll.
LOGARCHOPT1 parameter is used to define the sesam parameters for the archive log backup. See above section SEP sesam parameters for DB2.

To enable archive logging and interactively update LOGARCHMETH1 and LOGARCHOPT1 parameters, enter the following from the DB2 console:

db2 update db cfg for <database_name> using logarchmeth1 "VENDOR:<install path><shared library name>"
db2 update db cfg for <database_name> using logarchopt1 "SESAM_SERVER=<name>;SESAM_JOB=<your_task>;SESAM_POOL=<your_pool>"
Tip
You can also add optional parameters to the LOGARCHOPT1 parameter, such as SESAM_TAPE_SERVER, SESAM_DRIVE, XBSA_TRACE, and XBSA_LOGFILE.

For example, on Linux:

db2 update db cfg for test_db using logarchmeth1 "VENDOR:/opt/sesam/bin/sesam/db2xbsa.so"
db2 update db cfg for test_db using logarchopt1 "SESAM_SERVER=qsfix;SESAM_JOBS=db2_test_db;SESAM_POOL=Disk_Pool"

On Windows operating systems, specify the path name using UNC addressing (such as \\Program Files\SEPsesam\bin\sesam\) or drive letters (such as c:\Program Files\SEPsesam\bin\sesam\). For example:

db2 update db cfg for test_db using logarchmeth1 "VENDOR:\\Program Files\SEPsesam\bin\sesam\db2xbsa.dll"

For more information on the LOGARCHMETH1 parameter, see the IBM logarchmeth1 documentation.

VENDOROPT – default values for DB backup
VENDOROPT parameter is used to specify default values for backing up the database. Enter the following from the DB2 console:
db2 update db cfg for <database_name> using vendoropt "SESAM_SERVER=<name>;SESAM_JOB=<your_task>;SESAM_POOL=<your_pool>"

For example:

db2 update db cfg for test_db using vendoropt "SESAM_SERVER=qsfix;SESAM_JOBS=db2_test_db;SESAM_POOL=Disk_Pool"
Tip
You can also add optional parameters to the VENDOROPT parameter, such as SESAM_TAPE_SERVER, SESAM_DRIVE, XBSA_TRACE and XBSA_LOGFILE.

For more information on the VENDOROPT parameter, see the IBM vendoropt documentation.

The update of the set parameters will take effect at the next archiving of the log file.

Once you have set the above parameters, you have to perform an offline backup before connections can be made to the DB2 database (DB2 goes into a backup pending state when this parameter is enabled); therefore no users can be connected. After that, you can run scheduled online backups.

TRACKMOD – incremental backup
Additionally, you can set TRACKMOD to enable incremental backups. When set to ON, the DB2 database manager will track database modifications and enable SEP sesam to detect which subsets of database pages must be examined by an incremental backup. For more information on the TRACKMOD parameter, see the IBM trackmod documentation.

To enable incremental backups, enter the following from the DB2 console:

db2 update db cfg for <database name> using TRACKMOD on

For example:

db2 update db cfg for <database name> using TRACKMOD on

After you set the TRACKMOD, you must run a full offline database backup to update the parameter and enable incremental backups. Without a full offline backup the TRACKMOD parameter will not take effect.

Starting the database backup

The command for starting a DB2 backup depends on the method you used for deploying the shared library.

Tip
You can use a command event for scheduling the DB2 backup. Create a script with the backup start command on the DB2 server and then trigger the script by SEP sesam command event. For details, see Creating a Command Event.

If the db2xbsa library is located in the <SESAM_ROOT>/bin/sesam directory, use the LOAD command together with the specified library path:

 db2inst@linux:~>db2 BACKUP DATABASE sample_db ONLINE \
                     LOAD /opt/sesam/bin/sesam/db2xbsa.so \
                     OPTIONS 'SESAM_SERVER=midrangix;SESAM_JOB=db2_sample_db; \
                     SESAM_POOL=DISK;XBSA_LOGFILE=/home/db2inst1/sdb2.log; \
                     XBSA_TRACE=1' INCLUDE LOGS WITHOUT PROMPTING;

If db2xbsa is located in the DB2 default library directory on the DB2 server, use the USE XBSA command:

db2inst@linux:~>db2 BACKUP DATABASE sample_db ONLINE USE XBSA \
                     OPTIONS 'SESAM_SERVER=midrangix;SESAM_JOB=db2_sample_db; 
                     SESAM_POOL=DISK;XBSA_LOGFILE=/home/db2inst1/sdb2.log; \
                     XBSA_TRACE=1' INCLUDE LOGS WITHOUT PROMPTING;
Tip
The OPEN num-sessions SESSIONS command parameter allows to specify the number of I/O sessions to be created between the DB2 product and the SEP sesam backup device.
db2inst@linux:~>db2 BACKUP DATABASE sample_db ONLINE USE XBSA \
                     OPEN 4 SESSIONS \
                     OPTIONS 'SESAM_SERVER=midrangix;SESAM_JOB=db2_sample_db; 
                     SESAM_POOL=DISK;XBSA_LOGFILE=/home/db2inst1/sdb2.log; \
                     XBSA_TRACE=1' INCLUDE LOGS WITHOUT PROMPTING;
Tip
If the VENDOROPT parameter is set, it is not required to use the OPTIONS parameter. The db2 backup will use the values defined by VENDOROPT.
db2inst@linux:~>db2 BACKUP DATABASE sample_db ONLINE \
                LOAD /opt/sesam/bin/sesam/db2xbsa.so \
                INCLUDE LOGS WITHOUT PROMPTING;


Troubleshooting

For troubleshooting IBM DB2 issues, see Troubleshooting IBM DB2.

See also

DB2 Restore

Copyright © SEP AG 1999-2024. All rights reserved.
Any form of reproduction of the contents or parts of this manual is allowed only with the express written permission from SEP AG. When compiling and designing user documentation SEP AG uses great diligence and attempts to deliver accurate and correct information. However, SEP AG cannot issue a guarantee for the contents of this manual.