In addition to using the CommCell Console, you can also perform backups from the command line interface.
Optional: To have the CommCell Console authenticate the job, configure the parameters for CommCell Console third-party job authentication.
We support all DB2 commands in which the –lo (load option) is used. Refer to the to the IBM DB2 manuals for the complete list of DB2 commands that can include the optional –lo parameter.
Note: Your deduplication results may be enhanced by using the DB2 DEDUP_DEVICE option. The following shows an example of how to use the option.
db2 backup db TESTDB load 'path/libDb2Sbt.so' 'dedup_device'
Example
db2 backup db TESTDB load '/opt/commvault/commvault/Base64/libDb2Sbt.so' 'dedup_device'
For additional information about the DB2 DEDUP_DEVICE parameter, go to Backup Database Command in the IBM DB2 documentation website.
Running Backups Using Third Party Command Line
Online Backups
If a backup is run with the database online, other applications can access the database while the backup is in progress. Online backups are available only for databases configured with the LOGARCHMETH1 and USEREXIT parameters enabled.
In order to perform an online backup, the subclient should have been configured for online backups. For more information, see Creating A Subclient for Online Backups.
DB2 DPF
Run the command for online backup with logs from the DB2 command prompt on all the nodes.
Example: Online Full Backup:
db2 backup db database_name on all nodes online load '<software_install_path>/Base/libDb2Sbt.so'
Example: Online Incremental Backup:
db2 backup db database_name on all nodes online incremental load '<software_install_path>/Base/libDb2Sbt.so'
Example: Online Delta Backup:
db2 backup db database_name on all nodes online incremental delta load '<software_install_path>/Base/libDb2Sbt.so'
To perform a backup on all the nodes except node 0 where DB2 DPF has 4 nodes, type the backup command.
db2 backup db database_name on dbpartitionnum (1,2,3) load '<software_install_path>/Base/libDb2Sbt.so'
DB2 PureScale
Example: Online Full Backup:
db2 backup db database_name online load '<software_install_path>/Base/libDb2Sbt.so'
Offline Backup
If a backup is run with the database offline, this job has an exclusive connection to the database; therefore, any other access to the database is not allowed while the backup is in progress. An offline backup cannot run if any other applications are already running on the database.
In order to perform an offline backup, the subclient should have been configured for offline backups. See Creating A Subclient for Offline Backups for step-by-step instructions to create a separate subclient for offline backups.
Use the following steps to run offline backups from the third-party command line:
-
At the DB2 command prompt, type the appropriate offline backup command for the specific platform on all the nodes.
Note: for Offline Command line backups, disconnect all connected applications to the database before running an offline backup otherwise the offline backup will fail.
DB2 DPF
Example: Offline Full Backup:
db2 backup db database_name on all nodes load '<software_install_path>/Base/libDb2Sbt.so'
Example: Offline Incremental Backup:
db2 backup db database_name on all nodes incremental load '<software_install_path>/Base/libDb2Sbt.so'
Example: Offline Delta Backup:
db2 backup db database_name on all nodes incremental delta load '<software_install_path>/Base/libDb2Sbt.so'
DB2 pureScale
Example: Offline Full Backup:
db2 backup db database_name load '<software_install_path>/Base/libDb2Sbt.so
Example: Offline Incremental Backup:
db2 backup db database_name incremental load '<software_install_path>/Base/libDb2Sbt.so'
Example: Offline Delta Backup:
db2 backup db <database_name> incremental delta load '<software_install_path>/Base/libDb2Sbt.so'
Where
For a DB2 instance on a 32-bit AIX/Solaris or HP-UX or 32-bit/64-bit Linux or 31-bit Linux on System Z:
Use '<software_install_path>/Base/libDb2Sbt.so'
For a DB2 instance on 64-bit AIX/Solaris/HP PARISC or 64-bit Linux on System Z:
Use <software_install_path>/Base64/libDb2Sbt.so
Running Multi-Stream Backups
The DB2 MultiNode Data Agent allows you to perform parallel backups across multiple DB2 MultiNode nodes. As such, you can load-balance your backups across all or selected nodes of your DB2 MultiNode database and thereby take advantage of the strengths of each node.
DB2 third party command line backups running on multiple streams will share the same Job ID in the Job Manager. Make sure that the default stream threshold should be equal to the total number of database partitions for the subclient.
Unix
Method 1:
Use the following steps to run multi stream backups from the third party command line:
At the DB2 command prompt, type the backup command on all the nodes.
DP2 DPF Example:
db2 backup db database_name on all nodes load '<software_install_path>/Base/libDb2Sbt.so' open 3 sessions
DB2 pureScale Example
db2 backup db database_name online load '<software_install_path>/Base/libDb2Sbt.so' open 3 sessions
Where :
-
<database_name> is the name of the DB2 database
-
<software_install_path> is the install path for the agent software (e.g., level1/install)
For a DB2 instance on 64-bit AIX/Solaris/HP PARISC or 64-bit Linux on System Z, replace Base with Base64.
Method 2:
Use the db2util.sh script for multi-stream backups.
su – db2instance_name
cd software_install_path/iDataAgent
./db2util.sh -b FULL|INCR|DIFF -d <dbname> [-m <ONLINE/OFFLINE>] [-e] [-n DPF] [-w <buffers>] [-x <buffer_size>] [-y <sessions>] [-z <parallelism>]
DB2 Utility Script Parameters
The following are the parameters that you can use in the DB2 utility script.
Parameter |
Description |
Default Value |
Required |
---|---|---|---|
–b |
The backup type to run. Possible values are:
|
Yes |
|
–d |
The name of the database that you want to back up. |
Yes |
|
–m |
The backup mode. |
Online |
No |
–e |
Specify whether you want to force applications for offline backup. |
False |
No |
–n |
Run backups across multiple nodes. |
No |
|
–w |
The number of buffers. |
8 |
No |
–x |
The buffer size. |
16384 |
No |
–y |
The number of I/O sessions. |
4 |
No |
–z |
The number of tablespaces to read in parallel. |
8 |
No |