Copying/Moving Database

Description

The cubrid copydb utility copy or move a database to another location. As arguments, source and target name of database must be given. A target database name must be different from a source database name. Wh the target name argument is specified, the location of target database name is registered in the databases.txt file. The cubrid copydb utility can be executed only offline (that is, state of a source database stop).

cubrid : An integrated utility for the CUBRID service and database management.

copyd: A command that copy or move a database from one to another location.

options : For details about each option, see its description and the examples. If options are omitted, a target database is copied into the same directory of a source database.

src_database_name : The names of source and target databases to be copied or moved.

dest_database_name : A new (target) database name.

Option

Registering the host name (--server-name)

The following example shows specifying a host name of new database. The host name is registered in the databases.txt file. If this option is omitted, a local host is registered.

cubrid copydb --server-name=cub_server1 demodb new_demodb

Storing a new database volume in a specific directory (-F or --file-path)

The following example shows specifying a specific directory path where a new database volume is stored with an -F option. It represents specifying an absolute path. If the specified directory does not exist, an error is outputted. If this option is omitted, a new database volume is created in the current working directory. And this information is specified in vol-path of the databases.txt file.

cubrid copydb -F /home/usr/CUBRID/databases demodb new_demodb

Storing a new database log volume in a specific directory (-L or --log-path)

The following example shows specifying a specific directory path where a new database volume is stored with an -L option. It represents specifying an absolute path. If the specified directory does not exist, an error is outputted. If this option is omitted, a new database volume is created in the current working directory. And this information is specified in log-path of the databases.txt file.

cubrid copydb -L /home/usr/CUBRID/databases/logs demodb new_demodb

Storing a new database extended volume in a specific directory (-E or --extended-volume-path)

The following example shows specifying a specific directory path where a new database extended volume is stored with an -E. If this option is omitted, a new database extended volume is created in the location of a new database volume or in the registered path of controlling file. The -i option cannot be used with this option.

The following example shows specifying an input file where a new directory path information and a source volume are stored to copy or move multiple volumes into a different directory, respectively. The -i option cannot be used with the -E option. An input file named copy_path is specified in the example below.

cubrid copydb -i copy_path demodb new_demodb

The following is an exmaple of input file that contains each volume name, current directory path, and new directory and volume names.

volid : An integer that is used to identify each volume. It can be checked in the database volume control file (database_name_vinf).

source_fullvolname : The current directory path to each source database volume.

dest_fullvolname : The target directory path where new volumes will be stored. You should specify a vaild path.

Overwriting if same database exists (-r or --replace)

If the -r option is specified, a new database name overwrites the existing database name if it is identical, insteading outputting an error.

cubrid copydb -r -F /home/usr/CUBRID/databases demodb new_demodb

Deleting a source database if is is copied (-d or --delete-source)

If the -d option is specified, a source database is deleted after the database is copied. This execution brings the same the result as executing cubrid deletedb utility after copying a database. Note that if a source database contains LOB data, LOB file directory path of a source database is copied into a new database and it is registered in the lob-base-path of the databases.txt file.

cubrid copydb -d -copyhome/usr/CUBRID/databases demodb new_demodb

Copying LOB file directory (--copy-lob-path)

If the --copy-lob-path option is specified, a new directory path for LOB files is created and a source database is copied into a new directory path. If this option is omitted, the directory path is not created. Therefore, the lob-base-path of the databases.txt file should be modified separately. This option cannot be used with the -B option.