You can use the db2tapemgr utility to store archived log files to tape devices. The db2tapemgr utility copies log files from disk to the specified tape device, and updates the recovery history file with the new location of the copied log files.
Set the database configuration parameter logarchmeth1 to the location on disk of the log files you want to copy to tape. The db2tapemgr utility reads this logarchmeth1 value to find the log files to copy. In a partitioned database environment, the logarchmeth1 configuration parameter must be set on each database partition that contains log files to be copied.
The db2tapemgr utility does not use the logarchmeth2 database configuration parameter.
Issue the db2tapemgr command with either the STORE or DOUBLE STORE parameter to transfer archived logs from disk to tape.
The STORE parameter stores a range or all log files from the log archive directory to a specified tape device and deletes the files from disk.
The DOUBLE STORE parameter scans the history file to see whether logs were stored to tape previously.
If a log has never been stored before, db2tapemgr stores the log file to tape and but does not delete it from disk.
If a log has been stored before, db2tapemgr stores the log file to tape and deletes it from disk.
Use DOUBLE STORE if you want to keep duplicate copies of your archived logs on tape and on disk, or if you want to store the same logs on two different tapes.
When you issue the db2tapemgr command with either the STORE or DOUBLE STORE parameter, the db2tapemgr utility first scans the history file for entries where the logarchmeth1 configuration parameter is set to disk. If it finds that any files that are supposed to be on disk, are not on disk, it issues a warning. If the db2tapemgr utility finds no log files to store, it stops the operation and issues a message to inform you that there is nothing to do.
Issue the db2tapemgr command with the RETRIEVE parameter to transfer files from tape to disk.
Use the RETRIEVE ALL LOGS or LOGS n TO n parameter to retrieve all archived logs that meet your specified criteria and copy them to disk.
Use the RETRIEVE FOR ROLLFORWARD TO POINT-IN-TIME parameter to retrieve all archived logs required to perform a rollforward operation and copy them to disk.
Use the RETRIEVE HISTORY FILE parameter to retrieve the history file from tape and copy it to disk.
If the db2tapemgr utility finds log files on disk, it then reads the tape header to make sure that it can write the log files to the tape. It also updates the history for those files that are currently on tape. If the update fails, the operation stops and an error message is displayed.
If the tape is writeable, the db2tapemgr utility copies the logs to tape. After the files are copied, the log files are deleted from disk. Finally, the db2tapemgr utility copies the history file to tape and deletes it from disk.
The db2tapemgr utility does not append log files to a tape. If a store operation does not fill the entire tape, then the unused space is wasted.
The db2tapemgr utility stores log files only once to any given tape. This restriction exists to avoid any problems inherent to writing to tape media, such as stretching of the tape.
In a partitioned database environment, the db2tapemgr utility only executes against one database partition at a time. You must run the appropriate command for each database partition, specifying the database partition number using the ON DBPARTITIONNUM parameter of the db2tapemgr command. You must also ensure that each database partition has access to a tape device.
The db2tapemgr utility is not supported in DB2® pureScale® environments.
The following example shows how to use the db2tapemgr command to store all log files from the primary archive log path for database sample on database partition number 0 to a tape device and remove them from the archive log path:
db2tapemgr db sample on dbpartitionnum 0 store on /dev/rmt0.1 all logs
The following example shows how to store the first 10 log files from the primary archive log path to a tape device and remove them from the archive log path:
db2tapemgr db sample on dbpartitionnum store on /dev/rmt0.1 10 logs
The following example shows how to store the first 10 log files from the primary archive log path to a tape device and then store the same log files to a second tape and remove them from the archive log path:
db2tapemgr db sample on dbpartitionnum double store on /dev/rmt0.1 10 logs
db2tapemgr db sample on dbpartitionnum double store on /dev/rmt1.1 10 logs
The following example shows how to retrieve all log files from a tape to a directory:
db2tapemgr db sample on dbpartitionnum retrieve all logs from /dev/rmt1.1
to /home/dbuser/archived_logs