Use the following procedure to create a split mirror of
a primary database for use as a backup image. This procedure can
be used instead of performing backup database operations on the primary
database.
Procedure
To use a split mirror as a backup image:
- Create the split mirror.
- Connect to the primary database using the following command:
db2 connect to <db_name>
- Suspend the I/O write operations for the primary database using
the following command:
db2 set write suspend for database
Note: While
the database is in suspended state, you should not be running other
utilities or tools. You should only be making a copy of the database.
You can optionally flush all buffer pools before issuing SET
WRITE SUSPEND to minimize the recovery
window. This can be achieved using the FLUSH BUFFERPOOLS ALL statement.
- Create one or multiple split mirrors from the primary database
using appropriate operating system-level and storage-level commands.
Note: - Ensure that you copy the entire database directory including the
volume directory. You must also copy the log directory and any container
directories that exist outside the database directory. If you are
using multiple storage groups, you must copy all paths, including
files and subdirectories of those paths. To gather this information,
refer to the DBPATHS administrative view, which shows all the files
and directories of the database that need to be split.
- If you specified
the EXCLUDE LOGS with the SET WRITE command,
do not include the log files in the copy.
- Resume the I/O write operations on the primary database using
the following command:
db2 set write resume for database
- Assuming that a failure would occur on the system, perform
the following steps to restore the database using the split-mirror
database as the backup:
- Stop the database instance using the following command:
db2stop
- Copy the split-off data using operating system-level commands.
Important: Do not copy the split-off log files, because the
original logs are needed for rollforward recovery.
- Start the database instance using the following command:
db2start
- Initialize the primary database:
db2inidb database_alias as mirror
where database_alias represents
the database alias.
- Rollforward the database to the end of the logs, or to a point-in-time,
and stop.