Specifying Parameters for Command Line Backups
You can specify the media parameters in a file. For information on specifying the media parameter file, see Specifying the Media Parameters for DB2 Command Line Operations.
When the CommCell Console authenticates scripts, run the qlogin command with the token file option (-f) to obtain a token file.
Full Backups
Full backups provide the most comprehensive protection to your data. Backups for any client start with a full backup. The full backup becomes a baseline to which the subsequent backup types are applied. For example, a full backup must be performed before an incremental backup can be initiated.
You can perform a full backup of an online or offline database. The default is an online full backup.
Online Full Backup
For UNIX:
Run the following command from the DB2 command prompt to perform an online backup:
db2 backup database <Database_Name> online load ‘/<software_install_path>/Base/libDb2Sbt.so’
For a DB2 instance on 64-bit AIX/Solaris/HP PARISC or 64-bit Linux on System Z, replace the Base folder with Base64.
For Windows:
Run the following command from the DB2 command prompt to perform an online backup:
db2 backup database <database_name> online load '<software_install_path>\Base\Db2Sbt.dll'
where <database_name> is the name of the DB2 database and <software_install_path> is the install path for the agent software (e.g., level1/install).
Online backups with logs:
Run the following online backup command from the DB2 command prompt for online backups with logs:
db2 backup database <db_name> online load '<software install path>/Base/libDb2Sbt.so' include logs
where <db_name> is the name of the DB2 database and <software_install_path> is the install path for the agent software (for example, level1/install).
Delta or Incremental Backups
UNIX:
Run the following command from the DB2 command prompt to perform the delta/incremental backups:
db2 backup db <database_name> online incremental [delta] load '<software_install_path>/Base/libDb2Sbt.so'
Windows:
Run the following command from the DB2 command prompt to perform the delta/incremental backups:
db2 backup db <database_name> online incremental [delta] load '<software_install_path>\Base\Db2Sbt.dll'
The incremental setting is for incremental backup; the incremental delta setting is for delta backup.
Performing the Multi-Stream Backups
DB2 command line backups running on multiple streams will share a single Job ID in the Job Manager.
Use the following steps to run multi stream backups from the command line:
UNIX:
From the DB2 command prompt, type the following backup command:
db2 backup database <database_name> online load '<software_install_path>/Base/libDb2Sbt.so' open <n> sessions.
Windows:
From the DB2 command prompt, type the following backup command:
db2 backup database <database_name> online load '<software_install_path>\Base\Db2Sbt.dll' open <n> sessions.
Enabling Automatic Backup of Archive Logs
You can enable automatic backups of archive logs when using the Commvault VENDOR library parameters (SBT Interface). In this method, when the logs that are accumulated in the log archive path reach the default threshold value, the logs are automatically backed up.
Use the following steps to enable the automatic log backups:
-
Type the following command to set the LOGARCHMETH1 parameter.
db2 update db cfg for <database_name> using LOGARCHMETH1 "'VENDOR:/<software_install_path>/Base/libDb2Sbt.so'"
-
Type the following command to set the LOGARCHOPT1 parameter.
db2 update db cfg for <database_name> using LOGARCHOPT1 "'CvClientName=<CvClientName>,CvInstanceName=<CvInstanceName>'"
where
<database_name> is the name of the DB2 database
<CvClientName> identifies the name of the computer where the DB2 iDataAgent is installed and this name must be same as in CommCell Console
<CvInstanceName> identifies the name of DB2 iDataAgent instance associated with the appropriate CommServe
<software_install_path> is the install path for the agent software; for UNIX (except Linux), use base64 for 64-bit machines and base for 32-bit machines, for Linux use base for 32-bit and 64-bit machines.
Viewing the DB2 Backup History
You can view the DB2 data and log backup history using the qoperation script. You must be a DB2 instance user to run this script. The qoperation script is available in /opt/Commvault/Base in UNIX and C:\ProgramFiles\Commvault\Base in Windows.
Viewing the Log Backup History
Execute the following script to view the log backup history:
qoperation execscript -sn QS_querydb2backup -si <'Db2_Client_Name'> -si <'db2_Instance_name'> -si <'DB2_Database_Name'> -si 'LOGS'
Viewing the Data Backup History
Execute the following script to view the data backup history:
qoperation execscript -sn QS_querydb2backup -si <'Db2_Client_Name'> -si <'db2_Instance_name'> -si <'DB2_Database_Name'> -si 'Data'