Friday, March 6, 2015

how can you identify if autoresize is enabled?



$db2 get snapshot for tablespaces on MYDB


For Automatic Storage check “Using automatic storage” – if it’s “1” than it’s enabled for Automatic Storage.For automatic resize check “Auto-resize enabled”   and if it’s “Yes”


Monday, March 2, 2015

backup


Take an OFFLINE backup 
db2 connect to <dbname>
db2 quiesce database immediate force connections
db2 connect reset
db2 backup database <dbname> to <path> compress without prompting
after backup completes:
db2 connect to <dbname>
db2 unquiesce database
db2 connect reset
Take an ONLINE Backup
db2 backup db <dbname> to <path> online compress
or use a background process on a linux/unix machine
nohup db2 backup db <dbname> to <path> online compress &
List recent backups and where they are stored
=>db2 list history backup all for <dbname>
Check the integrity of a backup image
=>db2ckbkp <image name>
Restore from Incremental Backup Automatic
=>db2 restore db <dbname> incremental automatic taken at <timestamp>
If you need to restore an incremental backup manually this command will give you the required previous backups.
=>db2ckrst -d <dbname> -t <timestamp of image>




Question:  How can I delete all FULL backups of a specific DB2 database  older than X amount of days?
Answer:  To delete FULL backups greater than X amount of days   , use this example as a basis and modify to your requirements. This example applies if you’re using TSM as the backup mechanism.

$db2adutl delete FULL older than 14 days  db MYDB