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 | 



Renaming Database

Description

The cubrid renamedb utility renames a database. The names of information volumes, log volumes and control files are also renamed to conform to the new database one.

The cubrid alterdbhost utility configures or changes the host name of the specified database. It changes the host name configuration in the databases.txt file.

Syntax

cubrid renamedb options src_database_name dest_database_name

options : [{-E | --extended-volumn-path=}path ] [ {-i | --control-file=} file ] [-d | --delete-backup]

  • cubrid : An integrated utility for the CUBRID service and database management.
  • renamedb : A command that changes the existing name of a database to a new one. It executes successfully only when the database is in a stopped state. The names of related information volumes, log volumes and control files are also changed to new ones accordingly.
  • options : The -E, -i and -d options are supported. For details about each option, see its description and the examples.
  • src_database_name : The name of the existing database to be renamed. The path name to the directory where the database is to be created must not be included.
  • dest_database_name : The new name of the database. It must not be the same as that of an existing database. The path name to the directory where the database is to be created must not be included.
Options

Saving the renamed extended volume to a new directory (-E or --extended-volume-path)

The following example shows how to rename an extended volume created in a specific directory path (e.g. /dbtemp/addvol/) with a -E option, and then moves the volume to a new directory. The -E option is used to specify a new directory path (e.g. /dbtemp/newaddvols/) where the renamed extended volume will be moved. If the -E option is not specified, the extended volume is only renamed in the existing path without being moved. If a directory path outside the disk partition of the existing database volume or an invalid one is specified, the rename operation is not executed. This option cannot be used together with the -i option.

cubrid renamedb -E /dbtemp/newaddvols/ testdb testdb_1

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

The following example shows how to specify an input file in which directory information is stored to change all database name of volumes or files and assign different directory at once. To perform this work, the -i option is used. The -i option cannot be used together with the -E option.

cubrid renamedb -i rename_path testdb testdb_1

The followings are the syntax and example of a file that contains the name of each volume, the current directory path and the directory path where renamed volumes will be stored.

volid   source_fullvolname   dest_fullvolname

  • 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 volume.
  • dest_fullvolname : The target directory path where renamed volumes will be moved. If the target directory path is invalid, the database rename operation is not executed.

  -5  /home1/user/testdb_vinf       /home1/CUBRID/databases/testdb_1_vinf

  -4  /home1/user/testdb_lginf      /home1/CUBRID/databases/testdb_1_lginf

  -3  /home1/user/testdb_bkvinf     /home1/CUBRID/databases/testdb_1_bkvinf

  -2  /home1/user/testdb_lgat       /home1/CUBRID/databases/testdb_1_lgat

   0  /home1/user/testdb            /home1/CUBRID/databases/testdb_1

   1  /home1/user/backup/testdb_x001/home1/CUBRID/databases/backup/testdb_1_x001

Deleting and renaming backup files simultaneously (-d or --delete-backup)

By using the -d option, the following example shows how to rename the testdb database and at once forcefully delete all backup volumes and backup information files that are in the same location as testdb. Note that you cannot use the backup files with the old names once the database is renamed. If the -d option is not specified, backup volumes and backup information files are not deleted.

cubrid renamedb -d testdb testdb_1