Technote (FAQ)
Question
This technote gives examples of how to use scripts to halt your database using a pre-backup script while the snapshot copies are being created. and restart it in a backup command file script before running the sysback backup.
Answer
The SysBack (IBM Storage Manager for System Backup and Recovery) 6.1 manual recommends halting your databases and applications while the snapshot copies are being created using the Pre-backup script. You may then use the Backup Command File script to restart the databases or applications just before beginning the backup of the snapshot copies. The Pre-backup Script option is used to specify the location and filename of a user defined script that will execute before the snapshots are created. If the full path name of the file is not specified, the process will attempt to locate the specified filename in the /usr/lpp/sysback/sbsnapshot directory.
The following gives examples of how to use scripts to halt a database during the snapshot operation, and restart it before running a sysback backup.
1) Setup:
1.1) stop/start db scripts
Create and test scripts in the /usr/lpp/sysback/sbsnapshot directory to stop and start your database, for example named: stopdb and startdb. Note that it is not required to place the scripts in the sbsnapshot directory; if you don't then specify full path name to the scripts.
1.2) backup command file script
Add stopdb to the backup command file script you're invoking with sbsnapshot -B option.
For example, if running script named sbsnapshot_vg to run a backup of the datavg volume group, the commands could look like this:
-
./startdb
mkvgback -jR $1 -f /dev/rmt0 -x -W -u datavg
2) sbsnapshot backup
Invoke the script that stops the database with the -p option. In testing, the -p option worked right after sbsnapshot, as putting it later resulted in errors. For example, to take a snapshot of the filesystem mounted on the fslv00 logical volume and run the backup command script, invoking the stopdb pre-backup script run:
# sbsnapshot -p ./stopdb -B sbsnapshot_vg -v fslv00
Sample output:
Note that we see the stopdb and sbsnapshot_vg scripts being executed in the output; although we don't see the startdb script being executed, it ran successfully.
The following JFS2 filesystems in volume group "datavg" will have a
snapshot logical volume created:
Mountpt LV Name Snapshot Snapshot Size
LV Name (MB)
--------------------------- ------- --------------- ----------
/test fslv00 Auto Generate 615
======================================================================
Summary for Volume Group: datavg
Free PPs: 279(2232 megabytes)
PP Size: 8 megabytes
Total PP(s) Used For Snapshot: 77(616 megabytes)
======================================================================
Executing Pre-Backup Script ./stopdb ..
-----------------------------------------------------------
Build Snapshot objects
======================
Creating snapshot of filesystem /test.
Successfully create snapshot of filesystem /test on logical volume fslv01.
Executing Backup Script /usr/lpp/sysback/sbsnapshot/sbsnapshot_vg ..
-----------------------------------------------------------
Generating LVM information ..
Generating table of contents ..
Pre-processing /test filesystem ..
Writing table of contents ..
Backing up Volume Groups " datavg"
Start date is Wed Jul 20 19:27:10 2011
User is root at rs77
Estimated size is 112 MB
ESTIMATED PROGRESS
-------------+--------------------+------------------+--------------
% Complete | Elapsed Time | Megabytes | Kbytes/Sec
-------------+--------------------+------------------+--------------
0 | 0 minutes of 0 | 0 of 112 | 511
Backing up /test filesystem ..
(relative to /snapshot21210 directory)
100 | 0 minutes of 0 | 113 of 113 | 6434
SUCCESS: Volume Group backup completed successfully.
Cleaning up snapshot objects
Removing both the logical volume "fslv01" and the snapshot for filesystem "/test".
rmlv: Logical volume fslv01 is removed.
SUCCESS: Snapshot completed successfully.
Related information
SysBack Snapshot Processing
Sysback Snapshot Backups: Pre-Backup Script
Rate this page:
Copyright and trademark information
IBM, the IBM logo and ibm.com are trademarks of International Business Machines Corp., registered in many jurisdictions worldwide. Other product and service names might be trademarks of IBM or other companies. A current list of IBM trademarks is available on the Web at "Copyright and trademark information" at www.ibm.com/legal/copytrade.shtml.