DB2 – Specify Default Backup Location for Non-Automatic Backups

backupdb2

I noticed that when the BACKUP DATABASE command is issued without the TO clause the backup file is stored to the working directory where the command is issued.

I'm wondering if it's possible to configure a default location for backups such that it's used when the location is not specified in the command.

What if the free space on the storage is not enough? Is there a setting to tell DB2 to automatically remove the oldest backup as for circular logging?

Best Answer

No, it's not possible to specify a default location. The best way to do this would be to write a shell script (which specifies your location of choice) to handle your backups.

You can have DB2 remove old backups (using the AUTO_DEL_REC_OBJ database configuration parameter with proper values for NUM_DB_BACKUPS and REC_HIS_RETENTN), but that will only occur after a successful backup.

So you'll need to ensure that there is enough space for the backup to complete successfully.