Backing up data 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 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.
- The backup command can be invoked only from the Catalog node. When connected to the BLUDB
database, type the command:
If the output of the command shows a value of 0, you are logged on to the Catalog node.db2 values current 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 or database
admin user.
For a schema backup to process tables that are enabled for Row and Column Access Control (RCAC),
a user must be granted the LOGICAL BACKUP AND RESTORE OF RCAC PROTECTED DATA
privilege. This is not required for the bluadmin user.
Supported database backup types
- Full offline backups
- Full online backups
- Incremental online backups
Supported schema backup types
- Full online backups
- Incremental online backups
- Delta incremental online backups
Supported backup destinations
The following backup destinations are supported:- SAN storage
- NAS storage
- IBM Spectrum Protect server - LAN Based (since v1.0.7.0) - database only
- IBM Spectrum Protect server - LAN Free (since v1.0.9.0) - database only
- EMC NetWorker (since v1.0.9.0) - database only
db_backup command syntax
db_backup -type {off|onl|inc} -path path [-partitioned-backup]
db_backup -type {off|onl|inc} -tsm [-sessions {1-8}]
db_backup -type {off|onl|inc} -emc [-sessions >=1]db_backup -type {onl|inc|del} -path path -schema schema_name [-schemafile filepath]
[-compress {gzip | lz4 | no}] [-format {binary | text}] [-sessions N] [-image-check [hash | size | rowcount]]db_backup -history
db_backup -version
db_backup -status
db_backup {-h|--help}- -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.
- -partitioned-backup
- Directs backup to create a separate subfolder under the provided path for each MLN using format 'MLN $4N'.
- -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 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. Incremental schema backups can only be performed on schemas enabled for row modification tracking.
- del - Delta incremental - A delta incremental online backup, also known as a differential backup. A delta backup image is a copy of all data that has changed since the last successful backup. This could be a full, cumulative or a differential backup. Delta incremental schema backups can only be performed on schemas enabled for row modification tracking.
- -compress
- Optional parameter, used only with -schema option. By default,
-compress is set to
lz4. If specified, the data files in the backup are compressed. The gzip and lz4 formats are supported. - -sessions
- Specifies the number of I/O sessions between Integrated Analytics System
and IBM Spectrum Protect
(-tsm) or EMC Net Worker (-emc). 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
- The schema to be backed up. When not specified, the whole database is backed up. Multiple schema names can be specified and the schema names must be separated by a space. However, schemas enabled for row modification tracking (RMT), can only have a single schema specified. For more information, refer to Schema enabled for row modification tracking.
- -format
- Optional. Used only with the -schema parameter. By default, the table data files are generated in a binary format. If specified, the data files in the backup will be generated in a text format.
- -schemafile
- Specifies a full path with the file name. Each schema name in the file is case sensitive and must be provided in a separate line.
- -history
- Displays up to 10 backup images.
- -status
- Displays if another db_backup or db_restore is in progress.
- -abort PID
- Aborts backup jobs that run under PID. To list currently active jobs and corresponding PIDs, run the db_backup -list command.
- -version
- Displays information about the installed version of db_backup.
- -sessions N
- Optional. Spawns N threads to back up individual tables concurrently. The default value is 4. For multi-schema backups, N threads are spawned for each schema.
- -image-check [hash|size|rowcount]
-
Optional. Post-process schema backup files to enable image integrity verification prior to schema-level restore. All values can be selected. No value is set by default. However, a list of names of all files in backup image is always recorded and verified before restore.
- hash
- Computes and records hash values for all files in a backup image.
- size
- Records sizes of all files in a backup image.
- rowcount
- Processes data files and records the number of rows.
Backup examples
Multiple schemas backup:db_backup -schema schema1 schema2 -path /backup/Backup-Demo/Onl-bkp/ -type onlMultiple
schemas backup using a file:
db_backup -schemafile /backup/Backup-Demo/Schema-File -path /backup/Backup-Demo/Onl-bkp/ -type onlFull
offline backup:db_backup -path /backup/Backup-Demo/Off-bkp -type offFull
offline backup to IBM Spectrum
Protect:db_backup -type off -tsmdb_backup -type off -tsm -sessions 2Full
online backup:db_backup -path /backup/Backup-Demo/Onl-bkp -type onlOnline
backup to IBM Spectrum Protect (takes default
session
1):db_backup -type onl -tsmdb_backup -type onl -tsm -sessions 4Incremental
online
backup:db_backup -path /backup/Backup-Demo/online-inc -type incIncremental
backup to IBM Spectrum
Protect:db_backup -type inc -tsmdb_backup -type inc -tsm -sessions 6Backup
with multiple destination paths
(comma-separated):db_backup -path /backup/Backup-Demo/Onl-bkp/path1, /backup/Backup-Demo/Onl-bkp/path2 -type onldb_backup -path /backup/Backup-Demo/Onl-bkp/path1,/backup/Backup-Demo/Onl-bkp/path2 -type onlCheck
backup history:db_backup -historyCheck backup
version:db_backup -versionCheck backup
status:bd_backup -statusFull offline backup to EMC
NetWorker:db_backup -type off -emcdb_backup -type off -emc -sessions 2Online
backup to EMC
NetWorker:db_backup -type onl -emcdb_backup -type onl -emc -sessions 5Incremental
backup to EMC
NetWorker:db_backup -type inc -emcdb_backup -type inc -emc -sessions 10Backup
schema:db_backup -schema gbnr_schema -path /backup/Backup-Demo/Onl-bkp/ -type onlBackup
schema with delimited
name:db_backup -schema '"Gbnr sChEmA"' -path /backup/Backup-Demo/Inc-bkp/ -type incBackup
schema with the compress gzip
option:db_backup -schema gbnr_schema -compress gzip -path /backup/Backup-Demo/Del-bkp/ -type delBackup
schema with the compress lz4
option:db_backup -schema gbnr_schema -compress lz4 -path /backup/Backup-Demo/Onl-bkp/ -type onl
Backup schema with the format binary option:
db_backup -schema gbnr_schema -format binary -path /backup/Backup-Demo/Inc-bkp/ -type incBackup
schema with the format text
option:db_backup -schema gbnr_schema -format text -path /backup/Backup-Demo/Del-bkp/ -type delBackup
schema with multiple destination paths:
db_backup -schema gbnr_schema -path /backup/Backup-Demo/Onl-bkp/path1, /backup/Backup-Demo/Onl-bkp/path2 -type onldb_backup -schema gbnr_schema -path /backup/Backup-Demo/Onl-bkp/path1,/backup/Backup-Demo/Onl-bkp/path2 -type onl