Open Source RDBMS - Seamless, Scalable, Stable and Free

한국어 | Login |Register

Versions available for this page: CUBRID 8.3.1 |  CUBRID 8.4.0 |  CUBRID 8.4.1 |  CUBRID 8.4.3 |  CUBRID 9.0.0 | 

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. When 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).

Syntax

cubrid copydb [options] src-database-name dest-database-name

 

options: [{--server-name=}host] [{-F |--file-path=}database_path ] [ {-L |--log-path=}log_path] [{-B |--lob-base-path=}lob_file_path] [{-E |--extended-volume-path=}path][{-i |--control-file=}FILE] [-r|--replace] [-d|--delete-source] [--copy-lob-path]

  • cubrid: An integrated utility for the CUBRID service and database management.
  • copydb: 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.
Options

Registering a host name (--server-name)

The following example shows how to specify 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 how to specify 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 displayed. 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 how to specify 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 displayed. 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 how to specify 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.

cubrid copydb -E home/usr/CUBRID/databases/extvols demodb new_demodb

Specifying an input file where directory path information is stored (-i or --control file)

The following example shows how to specify 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   source_fullvolname   dest_fullvolname

0 /usr/databases/demodb        /drive1/usr/databases/new_demodb

1 /usr/databases/demodb_data1  /drive1/usr/databases/new_demodb new_data1

2 /usr/databases/ext/demodb index1 /drive2//usr/databases/new_demodb new_index1

3 /usr/ databases/ext/demodb index2  /drive2/usr/databases/new_demodb new_index2

  • 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 -opyhome/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.

cubrid copydb --copy-lob-path demodb new_demodb

Copying LOB file directory simultaneously with specifying it (-B or --lob-base-path)

If the -B option is specified, a specified directory is specified as for LOB files of a new database and a source database is copied. This option cannot be used with the --copy-lob-path option.

cubrid copydb -B /home/usr/CUBRID/databases/new_lob demodb new_demodb