Use the following procedure to create a split mirror of a database in a different
location on the same system for use as a backup image in a Db2
pureScale
environment. This procedure can be used instead of performing backup database operations on the
database. This procedure is only applicable in Linux systems.
About this task
Important: To run the db2cm utility as the root user, ensure the DB2INSTANCE environment
variable is set to the instance owner.
Procedure
To use a split mirror as a backup image:
- Connect to the primary database using the following
command:
db2 connect to <db_name>
- Configure the General Parallel File System (GPFS) on the
secondary cluster by extracting and importing the settings from the primary cluster. On the primary
cluster, run the following GPFS
command:
mmfsctl filesystem syncFSconfig -n remotenodefile
where
remotenodefile is the list of hosts in the secondary cluster.
- 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.
- Determine which file systems must be suspended and copied using the following
command:
db2cm -cfs -list -filesystem
- Suspend each GPFS file system that contains container data
or log data using the following
command:
/usr/lpp/mmfs/bin/mmfsctl filesystem suspend-write
where
filesystem represents a file system that contains data or log data.Note: While the GPFS file systems are suspended, write
operations are blocked. You should only be performing the split mirror operations during this period
to minimize the amount of time that operations are blocked.
- 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 GPFS file systems that were suspended using the
following command for each suspended file system:
/usr/lpp/mmfs/bin/mmfsctl filesystem resume
where
filesystem represents a suspended file system that contains data or log
data.
- Resume the I/O write operations for the primary database using the following
command:
db2 set write resume for database
Assuming that a situation requires you to restore the database using the split mirror as the
backup image, perform the following steps:
- Stop the primary database instance using the following
command:
db2stop
- Stop the cluster manager on each host in the cluster using the following
command:
db2cm -cm -stop -host host -force
Note: The last
host which you shut down must be the host from which you are issuing this command.
- Stop the GPFS cluster on the primary database instance
using the following command:
db2cm -cfs -stop -all
- Copy the split-off data off the primary database using appropriate operating system-level
commands.
Important: Do not copy the split-off log files, because the original logs are
needed for rollforward recovery.
- Start the GPFS cluster on the primary database instance
using the following command:
db2cm -cfs -start -all
- Start the cluster manager using the following
command:
db2cm -cm -start -domain
- Start the database instance using the following command:
db2start
- Initialize the primary database using the following
command:
db2inidb database_alias as mirror
- Rollforward the primary database to the end of the logs, or to a point-in-time, and stop.