Cloning the DB2 database using db2ed_clonedb

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:

Before cloning the DB2 database, the following conditions must be met:

Prerequisites

  • You must first create a Storage Checkpoint.

    See Creating Storage Checkpoints using db2ed_ckptcreate.

  • Before using db2ed_clonedb to clone a database either within the same instance or across instances, ensure that your locale is the same as the database locale and that the locale is the same across instances. If you do not know what locale to set, refer to the file /opt/VRTSdb2ed/lib/DB2CODPAGE.tbl for a mapping between the locale and the database Code page.

  • Make sure you have enough space and system resources to create a clone instance on your system.

  • A clone database takes up as much memory and machine resources as the primary database.

Usage notes

  • The db2ed_clonedb command is used to create a copy of a database, cloning all existing database files to new locations.

  • The db2ed_clonedb command only works when the instance is up.

  • It is assumed that the user has a basic understanding of the database recovery process.

  • When cloning a database using db2ed_clonedb, any database within the target instance that has the same name as the source database to be cloned will be temporarily uncataloged and therefore unavailable. If the source database is being cloned within the same instance, it will be temporarily uncataloged while db2ed_clonedb is running. The database will be recataloged on completion of db2ed_clonedb.

  • See the db2ed_clonedb(1M) manual page for more information.

Options for the db2ed_clonedb command are:

Table: db2ed_clonedb command options

Option

Description

-I SOURCE_INSTANCE

Specifies the source DB2 database. If the instance is not specified here, it is set as the current user.

-S SOURCE_DATABASE

Specifies the name of the source DB2 database.

-T TARGET_DATABASE

Specifies the name of the new DB2 database that will be created.

-c CKPT_NAME

Indicates the name of the Storage Checkpoint to use for creating the new database. The Storage Checkpoint is mounted automatically during the cloning process.

-m MOUNT_POINT

Indicates the location of the database containers to be mounted.

-l

Requires the argument TARGET_DATABASE_REDOLOG_DIRECTORY. Specifies the redo log directory of the target database.

-i

Runs the command in interactive mode where you must respond to prompts by the system. The default mode is non-interactive. (Optional)

-a

Requires the argument RECOVERY_LOG_LOCATION. If this option is specified, a minimal database recovery will occur automatically after the clone is created. (Optional)

-o umount

Shuts down the clone database and unmounts the Storage Checkpoint file system.

-o restartdb

Mounts the Storage Checkpoint file system and starts the clone database. The -o restartdb option will not attempt to recover the clone database.

-d

Used with the -o umount option. If the -d option is specified, the Storage Checkpoint used to create the clone database will be removed along with the clone database.

To clone a DB2 database with manual DB2 recovery

To clone a DB2 database with automatic DB2 recovery

To clone a DB2 database with interactive DB2 recovery

To shut down the clone database and unmount the Storage Checkpoint

To mount a Storage Checkpoint file system and start the clone database

To delete a clone database and the Storage Checkpoint used to create it