Db2 Advanced Copy Services (ACS) user scripts
By providing your own script for snapshot operations, you can use storage hardware that does not provide a vendor library.
A script specifies the type of snapshot operation that you want performed, as well as some additional options. You specify the script name with the -script parameter for the appropriate command or API. The library for Db2 ACS invokes the script at various times through the operation.
You have to create the script yourself and ensure that it is executable. There is a sample script called libacssc.sh provided in samples/BARVendor for your reference. The sample script creates one tar file containing the database files and, if logs are included, a second one for the log files. You can use the sample script as a template for your own script, with the appropriate modifications that set it up for your storage device. You would probably want to remove the section that creates the tar file.
Snapshot backup
During a snapshot backup, the script extracts the information that is required for the current phase from the protocol file and runs the required actions for creating the snapshot. The script writes progress information to the protocol file for debugging reasons.
-a
:- prepare
- Runs any actions that need to take place before the snapshot is performed
- snapshot
- Performs the snapshot
- verify
- Verifies that the snapshot was successful produced (that is, the vendor tools did not return any errors)
- store_metadata
- Specifies actions that can occur after the snapshot has been produced and all required metadata has been stored to the protocol file. For example, the script can back up the protocol file or rename the backup image.
- rollback
- Cleans up the image if a snapshot has failed
Snapshot restore
During snapshot restores the protocol files that were written during snapshots are read, and new protocol files are written (to the same repository) to show the progress of the restore operation. Every restore operation writes a new protocol file. If the restore is successful, the corresponding protocol file is removed. If the operation fails, the protocol file remains for debugging purposes.
-a
:- prepare
- Runs any actions that need to take place before the restore is performed
- restore
- Restores the snapshot backup image
Snapshot management
When a snapshot backup image is deleted, the protocol files that were written during snapshots are read, and new protocol files are written (to the same repository) to show the progress of the delete operation. If the delete operation is successful, the corresponding protocol file is removed. If the operation fails, the protocol file remains for debugging purposes.
-a
:- prepare
- Runs any actions that need to take place before the restore is performed
- delete
- Deletes the snapshot backup image