Following script is useful when you have multiple databases on single instance.
When you need to provide your operation team to take backup of DB1 not the other databases like DB2, DB3, following script is helpful to accomplish you task.
Simply add the script in you menu and let them initiate backup what you instructed them.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 | #!/bin/bash clear echo "======================================" echo echo "ONLINE DB Backup Script" echo echo "======================================" echo echo "List of database" echo db2 list db directory |grep "Database name" echo echo "Type database name" read dbname echo "Enter COB date For which You are going to Execute(e.g:DDMMYY)" read cobdate echo "Type of Application Backup (Type "Before" or "After" Backup If more then One COB will be executed on same day type Before1 or After1" read bkup cb="$dbname"_"$bkup"_"$cobdate"_COB mkdir -p /backup/$cb echo $cb db2 connect to $dbname date date > backup_rpt.txt db2 backup database $dbname online to /backup/$cb compress >> backup_rpt.txt date date >> backup_rpt.txt du -ms /backup/$cb >> backup_rpt.txt echo "Current DB Backup Size" du -ms /backup/$cb echo "Your $dbname-$bkup-$cobdate DB Backup is Created" mail -s "$dbname-$bkup-$cobdate DB ONLINE BACKUP" < backup_rpt.txt |