# DB2 Application Command Line Backups

You can specify the media parameters in a file. For information about specifying the media parameter file, see Specifying the Media Parameters for DB2 Command Line Operations.

Optional: To have the CommCell Console authenticate the job, configure the parameters for CommCell Console third-party job authentication.

## Retention Rules for Command Line Full Backups

DB2 command line full backup and its associated backups (incremental, differential and log) are pruned based on the cycles.

Incremental backups performed through the CommCell Console after the command line full backup are kept, but will be orphaned when the command line full backup is aged. The DB2 history file has a record for the incremental backups performed through the CommCell Console which depend on the command line full but the database is not recoverable from the incremental.

Command line jobs and incremental backups performed through the CommCell Console must not be combined on the same database because they will not be recoverable.

## Online Backups

### Windows

Run the online backup command from the DB2 command prompt:

     db2 backup db $[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).

### UNIX

Run the online backup command from the DB2 command prompt for a DB2 instance on a 32-bit AIX/Solaris or HP-UX or 32bit/64bit Linux or 31bit Linux on System Z:

    db2 backup db $[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 Base with Base64.

### Online 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 (e.g., level1/install).

## Offline

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 a third-party command line offline backup, the backup set must be configured.

Use the following steps to run offline backups from the third-party command line:

From the DB2 command prompt, type the appropriate offline backup command for the specific platform.

- For a DB2 instance on 64-bit AIX/Solaris/HP PARISC or 64-bit Linux on System Z:

       db2 backup db $[database_name] load '$[software_install_path]/Base64/libDb2Sbt.so'

- For a DB2 instance on a 32-bit/64-bit Windows platform:

       db2 backup db $[database_name] 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).

## Delta or Incremental

Use the following steps to run delta/incremental backups from the third-party command line:

    db2 backup db $[database_name] incremental [delta] load '$[software_install_path]\Base\Db2Sbt.dll'

The incremental is for incremental backup; the incremental delta is for delta backup.

## Multi-Stream

### Windows

Method 1:

     db2 backup database $[database_name] online load '$[software_install_path]\Base\Db2Sbt.dll' open $[num_backup_sessions] sessions

where:

- <database_name> is the name of the DB2 database

- <software_install_path> is the install path for the agent software (for example, level1/install)

- <num_backup_sessions> is the number of open sessions to use for the backup

For a DB2 instance on 64-bit AIX/Solaris/HP PARISC or 64-bit Linux on System Z, replace Base with Base64.

The following is the example command for multi-stream backup on a Windows computer:

    db2 backup db $[pmidb] online load '$[C:\Program Files\Commvault\ContentStore\Base\Db2Sbt.dll]' open $[4] sessions with $[8] BUFFERS BUFFER $[16384] PARALLELISM $[8] include logs without prompting

Method 2:

Use the db2util.ps1 script for multi-stream backups.

    cd $[software_install_path/Base]
    set db2instance=$[db2_instance_name]
    powershell Set-ExecutionPolicy $[Unrestricted]
    .\db2util.ps1 -b $[FULL | INCR| DIFF] -d $[dbname] [-m $[ONLINE/OFFLINE]] [-e] [-w $[buffers]] [-x $[buffer_size]] [-y $[sessions]] [-z $[parallelism]]

### UNIX

Method 1:

     db2 backup database $[database_name] online load '$[software_install_path/Base/libDb2Sbt.so]' open $[num_backup_sessions] sessions

The following is the example command for multi-stream backup on a Unix computer:

    db2 backup db $[pmidb] online load '$[/opt/commvault/Base/libDb2Sbt.so]' open $[4] sessions with $[8] BUFFERS BUFFER $[16384] PARALLELISM $[8] include logs without prompting

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: Full Incr Diff |  | 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

×

Loading...