Backing up data using the db_backup command

Note: This topic only applies to using db_backup in IAS. For using it in a standalone Db2® Warehouse, see Backing up by using the db_backup command.

Run the db_backup command to back up an entire database, or just a schema.

The backup methods used for BLUDB database in IBM® Integrated Analytics System are Single System View (SSV) and granular backup. These backups provide a single time-stamp for all database partitions, making the recovery simpler. The backup command can be invoked only from the Catalog node, but each MLN (Multiple Logical Node) participates in the backup operation.

Important:
  • Only the bluadmin user can perform the backup and restore commands.
  • The backup command can be invoked only from the Catalog node. When connected to the BLUDB database, type the command:
    db2 values current node
    If the output of the command shows a value of 0, you are logged onto the Catalog node.
  • If the db_backup command is issued from within an SSH command, the SSH command must be run outside the container, and the db_backup command must be issued as a sudo command. For example:
    ssh -p 50022 bluadmin@9.32.246.72 "sudo -E db_backup -path /scratch/ -type off"

Run the db_backup command as the bluadmin user.

Backup types supported

  • Full offline backups
  • Full online backups
  • Incremental online backups

db_backup command syntax

db_backup -path path -type off|onl|inc 
db_backup -tsm -type off|onl|inc [-sessions 1-6] 
db_backup -emc -type off|onl|inc [-sessions >=1]
db_backup -schema schema_name -path path -type onl [-compress gzip]
db_backup -history
-path
A target directory or device. The full path on which the directory resides must be specified. This target directory or device must be locally addressable on the database server.
Multiple paths are supported for database-level backups and can be specified during the backup to improve the performance.
Remember: In IBM Integrated Analytics System, the target directory or device must exist on all database partitions.
-tsm
Specifies to run the backup directly to IBM Spectrum Protect.
-emc
Specifies to run the backup directly to EMC NetWorker.
-type
Specifies the type of backup to run.
  • off - Offline - Specifies full offline backup.
  • onl - Online - Specifies full online backup. Online backups are only available for databases configured with logarchmeth1 (Database Configuration) enabled. The default is set to the /scratch/db2archive/archive_log/ directory.
  • inc - Incremental online - An incremental backup image is a copy of all database data that has changed since the most recent, successful, full online backup operation. This is also known as a cumulative backup image, because a series of incremental backups taken over time will each have the contents of the previous incremental backup image. The predecessor of an incremental backup image is always the most recent successful full online backup of the same object.
Schema-level backup is available only as a full online backup. off and inc are not supported.
-compress
Optional parameter, used only with -schema option. If specified, the data files in the backup are compressed. gzip format is supported only.
-sessions
Specifies the number of I/O sessions between IBM Integrated Analytics System and IBM Spectrum Protect or EMC NetWorker. This parameter has no effect when you back up to tape, disk, or another local device. For IBM Spectrum Protect, the recommended number of sessions is 4; the default number is 1. For EMC NetWorker, the number of sessions can be more than 1 based on EMC NetWorker configurations; the default number is 1.
Note: For IBM Spectrum Protect, the -sessions option refers to the number of sessions per database partition (MLN).
-schema
Schema to be backed up. When not specified, the whole database is backed up. Use '"schema_name"' for delimited schemas.
-history
Displays up to 10 backup images.
If more than 10 backups are done, information about the latest 10 backups is displayed. The rest of the information is redirected to the /scratch/bluadmin_BNR/backup_history.txt file.
For incremental backups, history does not list backups that are not part of the current backup chain.
Note:

/scratch/bluadmin_BNR/backup_history.txt is not updated after every backup. It is only updated on db_backup -history command invocation.

If db_backup -history command fails, the work around is:

  1. Check /scratch/bluadmin_BNR/backup_history.txt
  2. If the file does not exist or is not updated, use db2 list history command as described in https://www.ibm.com/support/knowledgecenter/en/SSEPGG_11.1.0/com.ibm.db2.luw.admin.cmd.doc/doc/r0001991.html

Supported backup destinations

The following backup destinations are supported:
  • SAN storage
  • NAS storage
  • IBM Spectrum Protect server - LAN Based (since v1.0.7.0)
  • IBM Spectrum Protect server - LAN Free (since v1.0.9.0)
  • EMC NetWorker (since v1.0.9.0)

Backup examples

Full offline backup:
db_backup -path /backup/Backup-Demo/Off-bkp -type off
Full offline backup to IBM Spectrum Protect:
db_backup -type off -tsm
db_backup -type off -tsm -sessions 2
Full online backup:
db_backup -path /backup/Backup-Demo/Onl-bkp -type onl
Online backup to IBM Spectrum Protect (takes default session 1):
db_backup -type onl -tsm
db_backup -type onl -tsm -sessions 2
Incremental online backup:
db_backup -path /backup/Backup-Demo/online-inc -type inc
Incremental backup to IBM Spectrum Protect:
db_backup -type inc -tsm
db_backup -type inc -tsm -sessions 2
Backup with multiple destination paths (comma-separated):
db_backup -path /backup/Backup-Demo/Off-bkp/path1, /backup/Backup-Demo/Off-pkp/path2 - type off
db_backup -path /backup/Backup-Demo/Off-bkp/path1,/backup/Backup-Demo/Off-pkp/path2 - type off
Check backup history:
db_backup -history
Full offline backup to EMC NetWorker:
db_backup -type off -emc
db_backup -type off -emc -sessions 2
Online backup to EMC NetWorker:
db_backup -type onl -emc
db_backup -type onl -emc -sessions 5
Incremental backup to EMC NetWorker:
db_backup -type inc -emc
db_backup -type inc -emc -sessions 10
Backup schema:
db_backup -schema gbnr_schema -path /backup/Backup-Demo/Onl-bkp/ -type onl
Backup a schema with delimited name:
db_backup -schema '"Gbnr sChEmA"' -path /backup/Backup-Demo/Onl-bkp/ -type onl
Backup schema with compress gzip option:
db_backup -schema gbnr_schema -compress gzip -path /backup/Backup-Demo/Onl-bkp/ -type onl