4 4 3:DB2 Backup
- 1 Overview
- 2 Requirements
- 3 Adding the DB2 client to SEP sesam environment
- 4 Deploying shared library db2xbsa
- 5 Configuring DB2 backup
- 6 Starting database backup
- 7 Troubleshooting
- 8 See also
The procedures and features explained herein provide only information about the SEP sesam-specific parts of DB2 backup. For detailed information on DB2-specific backup and recovery, refer to 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 DB2 API decides which data have to be backed up or recovered.
SEP sesam DB2 module (db2xbsa.so/db2xbsa.dll) is a part of 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 . For details, see section Installing SEP sesam DB2 module on IBM AIX.
To ensure error-free operation of SEP sesam and improve performance, make sure that the following conditions are met:
- Check the support matrix for the list of supported IBM DB2 versions.
- SEP sesam Server v. 4.4.3 or higher. Check Hardware requirements for SEP sesam Client and SEP sesam Server.
- Install the SEP sesam Client package on the DB2 server (DB2 backup module is already included in the client package). You can download it from . For details, see SEP sesam Quick Install Guide.
- A user account, such as DB2 administrator account, with sufficient privileges to perform backup and restore operations and to stop and start DB2 services on Windows and Linux/UNIX clients.
- SEP sesam IBM DB2 backup module requires a license. For details, see List of Licenses.
Adding the DB2 client to 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 -> Topology -> New Client -> add your DB2 client. For details, see Configuring Clients.
|Before proceeding, you should validate 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 SEP sesam environment, and make sure that the Path backup is successful, as described in previous section.
- Login as root user to your IBM AIX computer.
- Download the DB2 module from to a temporary directory.
- Unzip the sesam-db2-aix_64-bit.tar.gz.
- Unpack tar file sesam-db2-aix_64-bit.tar.
- 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 #
The SEP sesam DB2 package includes a shared library which DB2 server loads dynamically during backup or restore.
There are two ways in which you can use the db2xbsa.so/db2xbsa.dll library. You can either use the file located in
<SESAM_ROOT>/bin/sesam directory or copy it to 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.
Instead of using the shared library from the
<SESAM_ROOT>/bin/sesam directory and specifying the path by the LOAD command, you can put it into the DB2 library directory on the DB2 server.
/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
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 DB2 UDB 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.
- From Main Selection -> Tasks -> By Clients, select DB2 client and click New Backup Task. The New Backup Task window opens.
- Enter the Task name, e.g., DB2_SAMPLE.
- As Task type, select DB2_UDB.
- 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.
- Click OK to create the task.
- 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 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, the policy and schedule which will be used.
- The name of SEP sesam Server
- The name of the previously configured DB2 backup task (with task type DB2 UDB), e.g., DB2_SAMPLE
- The name of already 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.
In order 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 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 the DB2 database log files. Values are OFF, RETAIN, USEREXIT, DISK, TSM, and VENDOR. The latter must be set to specify that a vendor library – in 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>"
|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 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>"
db2 update db cfg for test_db using using vendoropt "SESAM_SERVER=qsfix;SESAM_JOBS=db2_test_db;SESAM_POOL=Disk_Pool"
|You can also add optional parameters to the to the VENDOROPT parameter, such as SESAM_TAPE_SERVER, SESAM_DRIVE, XBSA_TRACE and XBSA_LOGFILE.|
For more information on VENDOROPT parameter, see IBM vendoropt documentation.
The update to set parameters takes effect during the next log file archive.
Once you set the above parameters, you have to perform one offline backup before any 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 the 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 the database pages must be examined by an incremental backup. For more information on TRACKMOD parameter, see IBM trackmod documentation.
To enable incremental backups, enter the following from the DB2 console:
db2 update db cfg for <database name> using TRACKMOD on
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 database backup
The command for starting a DB2 backup depends on the method you used for deploying shared library.
|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 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 the db2xbsa is located in the DB2 default library directory on 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;
|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;
For troubleshooting IBM DB2 issues, see Troubleshooting IBM DB2.