You can use the db2ed_clonedb command to clone a DB2 database using a Storage Checkpoint.
Cloning an existing database using a Storage Checkpoint must be done on the same host.
You have the option to manually or automatically recover the database when using the db2ed_clonedb command:
Manual (Interactive) recovery, which requires using the -i option, of the clone instance allows the user to control the degree of recovery by specifying which archive log files are to be replayed.
Automatic (non-interactive) recovery, which is the default usage of the command, recovers the entire database and replays all of the archive logs. You will not be prompted for any archive log names.
Before cloning the DB2 database, the following conditions must be met:
Options for the db2ed_clonedb command are:
Table: db2ed_clonedb command options
To clone a DB2 database with automatic DB2 recovery
Use the db2ed_clonedb command as follows:
$ /opt/VRTS/bin/db2ed_clonedb -S source_db -T target_db2 \ -c Checkpoint_1049927758 -m /db2clone/target_db2 -a \ /db2clone/db2inst1/NODE0000/SQL00002/SQLOGDIR/
Clone database succeeded.
The database will be rolled forward to 2003-04-09-22.36.02.0000.
/db2clone/db2inst1/NODE0000/SQL00002/SQLOGDIR/
will be used to be searched for archived logs during recovery.
Rollforward Status
Input database alias = TARGET_DB2
Number of nodes have returned status = 1
Node number = 0
Rollforward status = DB working
Next log file to be read = S0000002.LOG
Log files processed = -
Last committed transaction = 2003-04-08-20.32.53.000000
DB20000I The ROLLFORWARD command completed successfully.
Rollforward Status
Input database alias = TARGET_DB2
Number of nodes have returned status = 1
Node number = 0
Rollforward status = not pending
Next log file to be read =
Log files processed = S0000002.LOG - S0000002.LOG
Last committed transaction = 2003-04-08-20.32.53.000000
DB20000I The ROLLFORWARD command completed successfully.
To clone a DB2 database with interactive DB2 recovery
Use the db2ed_clonedb command as follows:
$ /opt/VRTS/bin/db2ed_clonedb -S source_db -T target_db3 \ -c Checkpoint_1049927758 -m /db2clone/target_db3 -i /db2clone/db2inst1/NODE0000/SQL00002/SQLOGDIR/ will be used to be searched for archived logs during recovery. Press <Return> to continue Or <r> to retry Or <q> to quit: The database will be rolled forward to 2003-04-09-22.36.02.0000. The archived logs will be retrieved from /db2clone/db2inst1/NODE0000/SQL00002/SQLOGDIR/. The estimated minimum logs are S0000002.LOG-S0000002.LOG. You can retrieve all log files by executing cp /db2clone/db2inst1/NODE0000/SQL00002/SQLOGDIR/*.LOG /db2clone/target_db3/REDOLOG from another session and then Press q to continue Or Press Enter to retrieve the minimum logs. The recovery process will stop if more logs is required. Press <Return> to continue ... or <q> to skip ... Rollforward Status Input database alias = TARGET_DB3 Number of nodes have returned status = 1 Node number = 0 Rollforward status = DB working Next log file to be read = S0000002.LOG Log files processed = - Last committed transaction = 2003-04-08-20.32.53.000000 DB20000I The ROLLFORWARD command completed successfully. Rollforward Status Input database alias = TARGET_DB3 Number of nodes have returned status = 1 Node number = 0 Rollforward status = not pending Next log file to be read = Log files processed = S0000002.LOG - S0000002.LOG Last committed transaction = 2003-04-08-20.32.53.000000 DB20000I The ROLLFORWARD command completed successfully.