db2 backup commands are very easy and can be sorted into different categories: ONLINE BACKUP: Online backups are a common scenario in any production environment. For online b ackups , you should enable archival logging. With online backups , your applicat ion will remain intact even when the backup is running. Examples: db2 backup db dbname online db2 backup db dbname online compress OFFLINE BACKUP: Offline backup means that the database will not be available for users during th e backup time. But the advantage with this type is that you need not worry about logs during restore You might have to force off the applications and/or deactivate the database befo re you kick off the offline backup. Sometimes quiesce is required Examples: db2 backup db dbname db2 backup db dbname compress BACKUP WITH BUFFERS AND PARALLELISM: This is to tweak with the performance of the backups. Buffers and parallelism ca n be adjusted to enhance the performance Example: db2 backup db dbname with 4 buffers parallelism 2 TABLESPACE BACKUP: Tablespace backups are handy for huge databases. You can manage tablespace backu ps instead of whole database backup Example: db2 backup db dbname tablespace(syscatspace,userspace1) tablespace(syscatspace,userspace1) ONLINE DELTA BACKUP: Deltas and incrementals are handy for big databases. Deltas capture only changes after previous delta. TRACKMOD needs be turned on for deltas Example: db2 backup db incremental delta INCREMENTAL BACKUP: Incrementals capture the changes from the last full backup time. TRACKMOD needs to be turned on for incrementals Example: db2 backup db incremental
BACKUP INCLUDE LOGS: When you want to rollforward you need logs and this backup command comes handy.. With recent versions of db2 logs are included in backup implicitly.Kindly note t hat you need to specify the LOGTARGET when you restore a backup that includes lo gs Example: db2 backup db $DBNAME online to $BACKUPDIR COMPRESS COMPRESS ing