---
title: "coradb utilities"
description: "Reference of the coradb utilities: createdb, addvoldb, deletedb, renamedb, copydb, installdb, locale, time zone and TDE key commands."
url: "https://www.coradb.ai/manual/admin/admin_utils.html"
markdown_url: "https://www.coradb.ai/manual/markdown/admin/admin_utils.md"
product: "CoraDB"
version: "1.0"
keywords: "coradb utilities, coradb createdb, coradb addvoldb, coradb deletedb, coradb renamedb, coradb copydb, coradb installdb, coradb alterdbhost, coradb tde, coradb genlocale, coradb gen_tz"
---

# coradb utilities

The **coradb** command runs the administration utilities of CoraDB. Each utility is called as `coradb utility_name [options] database_name`; `coradb utility_name` without arguments prints its options.

```text
coradb utility_name [option] database_name
```

| Task | Utilities |
|---|---|
| Create, extend and remove databases | [createdb](https://www.coradb.ai/manual/admin/admin_utils.html#createdb), [addvoldb](https://www.coradb.ai/manual/admin/admin_utils.html#addvoldb), [deletedb](https://www.coradb.ai/manual/admin/admin_utils.html#deletedb) |
| Rename, move, copy and register databases | [renamedb](https://www.coradb.ai/manual/admin/admin_utils.html#renamedb), [alterdbhost](https://www.coradb.ai/manual/admin/admin_utils.html#alterdbhost), [copydb](https://www.coradb.ai/manual/admin/admin_utils.html#copydb), [installdb](https://www.coradb.ai/manual/admin/admin_utils.html#installdb) |
| Back up and restore | [backupdb](https://www.coradb.ai/manual/admin/admin_backup.html#backupdb), [restoredb](https://www.coradb.ai/manual/admin/admin_backup.html#restoredb) |
| Export and import schema and data | [unloaddb](https://www.coradb.ai/manual/admin/admin_unload.html#unloaddb), [loaddb](https://www.coradb.ai/manual/admin/admin_unload.html#loaddb) |
| Space, statistics and plans | [spacedb](https://www.coradb.ai/manual/admin/admin_space.html#spacedb), [compactdb](https://www.coradb.ai/manual/admin/admin_space.html#compactdb), [vacuumdb](https://www.coradb.ai/manual/admin/admin_space.html#vacuumdb), [optimizedb](https://www.coradb.ai/manual/admin/admin_space.html#optimizedb), [plandump](https://www.coradb.ai/manual/admin/admin_space.html#plandump) |
| Server statistics | [statdump](https://www.coradb.ai/manual/admin/admin_statdump.html#statdump) |
| Locks and transactions | [lockdb](https://www.coradb.ai/manual/admin/admin_transactions.html#lockdb), [tranlist](https://www.coradb.ai/manual/admin/admin_transactions.html#tranlist), [killtran](https://www.coradb.ai/manual/admin/admin_transactions.html#killtran) |
| Consistency checks and diagnostics | [checkdb](https://www.coradb.ai/manual/admin/admin_diag.html#checkdb), [diagdb](https://www.coradb.ai/manual/admin/admin_diag.html#diagdb), [paramdump](https://www.coradb.ai/manual/admin/admin_diag.html#paramdump) |
| Encryption keys | [tde](https://www.coradb.ai/manual/admin/admin_utils.html#tde) |
| Locales and time zones | [genlocale, dumplocale, synccolldb](https://www.coradb.ai/manual/admin/admin_utils.html#locale-commands), [gen_tz, dump_tz](https://www.coradb.ai/manual/admin/admin_utils.html#timezone-commands) |

The processes themselves — the service, database servers, brokers and the Java SP server — are controlled with `coradb service`, `coradb server`, `coradb broker` and `coradb javasp`; see [Controlling CoraDB processes](https://www.coradb.ai/manual/admin/control.html).

Most utilities can run in client-server mode (**-C**), against a running database server, or in standalone mode (**-S**), opening the database files directly; standalone mode needs the database server to be stopped. Which modes a utility supports is given in its section.

## coradb utility logging

CoraDB supports logging feature for the execution result of **coradb** utilities; for details, see [coradb utility logging](https://www.coradb.ai/manual/admin/control.html#coradb-utility-logging).


## createdb

The **coradb createdb** utility creates databases and initializes them with the built-in CoraDB system tables. It can also define initial users to be authorized in the database and specify the locations of the logs and databases. In general, the **coradb createdb** utility is used only by DBA.

> **Warning:**
> When you create database, a locale name and a charset name after a DB name must be specified(e.g. ko_KR.utf8). It affects the length of string type, string comparison operation, etc. The specified charset when creating database cannot be changed later, so you should be careful when specifying it.
>
> For charset, locale and collation setting, see [An overview of globalization](https://www.coradb.ai/manual/sql/i18n.html).


``` bash
coradb createdb [options] database_name locale_name.charset
```

- **coradb**: An integrated utility for the CoraDB service and database management.
- **createdb**: A command used to create a new database.
- *database_name*: Specifies a unique name for the database to be created, without including the path name to the directory where the database will be created. If the specified database name is the same as that of an existing database name, CoraDB halts creation of the database to protect existing files.
- *locale_name*: A locale name to use in the database should be input. For a locale name which can be used in CoraDB, refer to [Step 1: selecting a locale](https://www.coradb.ai/manual/sql/i18n_locale.html#step-1-selecting-a-locale).
- *charset*: A characterset to use in the database should be input. A character set which can be used in CoraDB is iso88591, euckr or utf8.
  - If *locale_name* is en_US and *charset* is omitted, a character set will be iso88591.
  - If *locale_name* is ko_KR and *charset* is omitted, a character set will be utf8.
  - All locale names except en_US and ko_KR cannot omit *charset*, and a *charset* can be specified only with utf8.

The maximum length of database name is 17 in English.

The following shows \[options\] available with the **coradb** **createdb** utility.

**--db-volume-size=SIZE**

This option specifies the size of the database volume that will be created first. The default value is the value of the system parameter **db_volume_size**. You can set units as K, M, G and T, which stand for kilobytes (KB), megabytes (MB), gigabytes (GB), and terabytes (TB) respectively; if you omit the unit, bytes will be applied. The size of the database is always rounded up to 64 disk sectors, which depends on the size of a page and can be 16M, 32M or 64M for page size 4k, 8k and 16k respectively.

The following example shows how to create a database named *testdb* and assign 512 MB to its first volume.

``` bash
coradb createdb --db-volume-size=512M testdb en_US
```

**--db-page-size=SIZE**

This option specifies the size of the database page; the minimum value is 4K and the maximum value is **16K** (default). K stands for kilobytes (KB). The value of page size is one of the following: 4K, 8K, or 16K. If a value between 4K and 16K is specified, system rounds up the number. If a value greater than 16K or less than 4K, the specified number is used.

The following example shows how to create a database named *testdb* and configure its page size 16K.

``` bash
coradb createdb --db-page-size=16K testdb en_US
```

**--log-volume-size=SIZE**

This option specifies the size of the database log volume. The default value is the same as database volume size, and the minimum value is 20M. You can set units as K, M, G and T, which stand for kilobytes (KB), megabytes (MB), gigabytes (GB), and terabytes (TB) respectively. If you omit the unit, bytes will be applied.

The following example shows how to create a database named *testdb* and assign 256 MB to its log volume.

``` bash
coradb createdb --log-volume-size=256M testdb en_US
```

**--log-page-size=SIZE**

This option specifies the size of the log volume page. The default value is the same as data page size. The minimum value is 4K and the maximum value is 16K. K stands for kilobytes (KB). The value of page size is one of the following: 4K, 8K, or 16K. If a value between 4K and 16K is specified, system rounds up the number. If a value greater than 16K or less than 4K, the specified number is used.

The following example shows how to create a database named *testdb* and configure its log volume page size 8K.

``` bash
coradb createdb --log-page-size=8K testdb en_US
```

**--comment=COMMENT**

This option specifies a comment to be included in the database volume header. If the character string contains spaces, the comment must be enclosed in double quotes.

The following example shows how to create a database named *testdb* and add a comment to the database volume.

``` bash
coradb createdb --comment "a new database for study" testdb en_US
```

**-F, --file-path=PATH**

The **-F** option specifies an absolute path to a directory where the new database will be created. If the **-F** option is not specified, the new database is created in the current working directory.

The following example shows how to create a database named *testdb* in the directory /dbtemp/new_db.

``` bash
coradb createdb -F "/dbtemp/new_db/" testdb en_US
```

**-L, --log-path=PATH**

The **-L** option specifies an absolute path to the directory where database log files are created. If the **-L** option is not specified, log files are created in the directory specified by the **-F** option. If neither **-F** nor **-L** option is specified, database log files are created in the current working directory.

The following example shows how to create a database named *testdb* in the directory /dbtemp/newdb and log files in the directory /dbtemp/db_log.

``` bash
coradb createdb -F "/dbtemp/new_db/" -L "/dbtemp/db_log/" testdb en_US
```

**-B, --lob-base-path=PATH**

This option specifies a directory where **LOB** data files are stored when **BLOB/CLOB** data is used. If the **--lob-base-path** option is not specified, LOB data files are store in \<*location of database volumes created*\>/**lob** directory.

The following example shows how to create a database named *testdb* in the working directory and specify /home/data1 of local file system as a location of LOB data files.

``` bash
coradb createdb --lob-base-path "file:/home1/data1" testdb en_US
```

**--server-name=HOST**

This option enables the server of a specific database to run in the specified host when CoraDB client/server is used. The information of a host specified is stored in the **databases.txt** file. If this option is not specified, the current localhost is specified by default.

The following example shows how to create a database named *testdb* and register it on the host *aa_host*.

``` bash
coradb createdb --server-name aa_host testdb en_US
```

**-r, --replace**

This option creates a new database and overwrites an existing database if one with the same name exists.

The following example shows how to create a new database named *testdb* and overwrite the existing database with the same name.

``` bash
coradb createdb -r testdb en_US
```

**--more-volume-file=FILE**

This option creates an additional volume based on the specification contained in the file specified by the option. The volume is created in the same directory where the database is created. Instead of using this option, you can add a volume by using the **coradb addvoldb** utility.

The following example shows how to create a database named *testdb* as well as an additional volume based on the specification stored in the **vol_info.txt** file.

``` bash
coradb createdb --more-volume-file vol_info.txt testdb en_US
```

The following is a specification of the additional volume contained in the **vol_info.txt** file. The specification of each volume must be written on a single line.

``` text
#xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
# NAME volname COMMENTS volcmnts PURPOSE volpurp NPAGES volnpgs
NAME data_v1 COMMENTS "data information volume" PURPOSE data NPAGES 1000
NAME data_v2 COMMENTS "data information volume" NPAGES 1000
NAME temp_v1 COMMENTS "temporary information volume" PURPOSE temp NPAGES 500
#xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
```

As shown in the example, the specification of each volume consists following.

``` text
[NAME volname] [COMMENTS volcmnts] [PURPOSE volpurp] NPAGES volnpgs
```

- *volname*: The name of the volume to be created. It must follow the UNIX file name conventions and be a simple name not including the directory path. The specification of a volume name can be omitted. If it is, the "database name to be created by the system_volume identifier" becomes the volume name.
- *volcmnts*: Comment to be written in the volume header. It contains information on the additional volume to be created. The specification of the comment on a volume can also be omitted.
- *volpurp*: The purpose for which the volume will be used. It can be either permanent data (default option) or temporary.

> **Note:**
> For backward compatibility, all old keywords, **data**, **index**, **temp**, or **generic** are accepted. **temp** stands for temporary data purpose, while the rest stand for permanent data purpose.


- *volnpgs*: The number of pages of the additional volume to be created. The specification of the number of pages of the volume cannot be omitted; it must be specified. The actual volume size is rounded up to the next multiple of **64 sectors**.

**--user-definition-file=FILE**

This option adds users who have access to the database to be created. It adds a user based on the specification contained in the user information file specified by the parameter. Instead of using the **--user-definition-file** option, you can add a user by using the **CREATE USER** statement (for details, see [CREATE USER](https://www.coradb.ai/manual/sql/authorization.html#create-user)).

The following example shows how to create a database named *testdb* and add users to *testdb* based on the user information defined in the **user_info.txt** file.

``` bash
coradb createdb --user-definition-file=user_info.txt testdb en_US
```

The syntax of a user information file is as follows:

``` text
USER user_name [ <groups_clause> | <members_clause> ]

<groups_clause>: 
    [ GROUPS <group_name> [ { <group_name> }... ] ]

<members_clause>: 
    [ MEMBERS <member_name> [ { <member_name> }... ] ]
```

- The *user_name* is the name of the user who has access to the database. It must not include spaces.
- The **GROUPS** clause is optional. The *group_name* is the upper level group that contains the *user_name* . Here, the *group_name* can be multiply specified and must be defined as **USER** in advance.
- The **MEMBERS** clause is optional. The *member_name* is the name of the lower level member that belongs to the *user_name* . Here, the *member_name* can be multiply specified and must be defined as **USER** in advance.

Comments can be used in a user information file. A comment line must begin with a consecutive hyphen lines (--). Blank lines are ignored.

The following example shows a user information in which *grandeur* and *sonata* are included in *sedan* group, *tuscan* is included in *suv* group, and *i30* is included in *hatchback* group. The name of the user information file is **user_info.txt**.

``` sql
--
-- Example 1 of a user information file
--
USER sedan
USER suv
USER hatchback
USER grandeur GROUPS sedan
USER sonata GROUPS sedan
USER tuscan GROUPS suv
USER i30 GROUPS hatchback
```

The following example shows a file that has the same user relationship information as the file above. The difference is that the **MEMBERS** statement is used in the file below.

``` sql
--
-- Example 2 of a user information file
--
USER grandeur
USER sonata
USER tuscan
USER i30
USER sedan MEMBERS sonata grandeur
USER suv MEMBERS tuscan
USER hatchback MEMBERS i30
```

**--corasql-initialization-file=FILE**

This option executes an SQL statement on the database to be created by using the corasql interpreter. A schema can be created based on the SQL statement contained in the file specified by the parameter.

The following example shows how to create a database named *testdb* and execute the SQL statement defined in table_schema.sql through the corasql interpreter.

``` bash
coradb createdb --corasql-initialization-file table_schema.sql testdb en_US
```

**-o, --output-file=FILE**

This option stores messages related to the database creation to the file given as a parameter. The file is created in the same directory where the database was created. If the **-o** option is not specified, messages are displayed on the console screen. The **-o** option allows you to use information on the creation of a certain database by storing messages, generated during the database creation, to a specified file.

The following example shows how to create a database named *testdb* and store the output of the utility to the **db_output** file instead of displaying it on the console screen.

``` bash
coradb createdb -o db_output testdb en_US
```

**-v, --verbose**

This option displays all information on the database creation operation onto the screen. Like the **-o** option, this option is useful in checking information related to the creation of a specific database. Therefore, if you specify the **-v** option together with the **-o** option, you can store the output messages in the file given as a parameter; the messages contain the operation information about the **coradb createdb** utility and database creation process.

The following example shows how to create a database named *testdb* and display detailed information on the operation onto the screen.

``` bash
coradb createdb -v testdb en_US
```

> **Note:**
> - **temp_file_max_size_in_pages** is a parameter used to configure the maximum size of temporary volumes - used for complicated queries or storing arrays - on the disk. With the default value **-1**, the temporary volumes size is only limited by the capacity of the disk specified by the **temp_volume_path** parameter. If the value is 0, no temporary volumes can be created. In this case, a permanent volume with temporary data purpose should be added by using the [coradb addvoldb](https://www.coradb.ai/manual/admin/admin_utils.html#addvoldb) utility. For an efficient storage management, it is recommended to use the latter approach.
> - By using the [coradb spacedb](https://www.coradb.ai/manual/admin/admin_space.html#spacedb) utility, you can check the remaining space of each volume. By using the [coradb addvoldb](https://www.coradb.ai/manual/admin/admin_utils.html#addvoldb) utility, you can add more volumes as needed while managing the database. You are advised to add more volumes when there is less system load. When all preassigned volumes are completely in use, the database system automatically creates new volumes.


The following example shows how to create a database, with additional volumes, including one for temporary data purpose.

``` bash
coradb createdb --db-volume-size=512M --log-volume-size=256M coradbdb en_US
coradb addvoldb -S -n coradbdb_DATA01 --db-volume-size=512M coradbdb
coradb addvoldb -S -p temp -n coradbdb_TEMP01 --db-volume-size=512M coradbdb
```

> **Note:**
> **Creating a database using an existing key file**
>
> When the database is created, a key file is created together by default. If you want to use an existing key file when creating a database:
>
> 1.  Copy the key file with the name **\<database-name\>\_keys**.
> 2.  Specify the directory path of the copied key file by the system parameter **tde_keys_file_path**.
> 3.  Create a database by using the **createdb utility**.
>
> For more information on the TDE key file, see [File-based master key management](https://www.coradb.ai/manual/security.html#file-based-master-key-management).



## addvoldb

If you want to micromanage CoraDB storage volumes, addvoldb is the tool for you. You can finely tune each file name, path, purpose, and size. The database system can handle all storage by itself, but it uses default values to configure each new volume.

The command for manually adding a database volume is as follows.

``` bash
coradb addvoldb [options] database_name
```

- **coradb**: An integrated utility for CoraDB service and database management.
- **addvoldb**: A command that adds a specified number of pages of the new volume to a specified database.
- *database_name*: Specifies the name of the database to which a volume is to be added without including the path name to the directory where the database is to be created.

The following example shows how to create a database, with additional multi-purpose volumes.

``` bash
coradb createdb --db-volume-size=512M --log-volume-size=256M coradbdb en_US
coradb addvoldb -S -n coradbdb_DATA01 --db-volume-size=512M coradbdb
coradb addvoldb -S -p temp -n coradbdb_TEMP01 --db-volume-size=512M coradbdb
```

The following shows \[options\] available with the **coradb addvoldb** utility.

**--db-volume-size=SIZE**

**--db-volume-size** is an option that specifies the size of the volume to be added to a specified database. If the **--db-volume-size** option is omitted, the value of the system parameter **db_volume_size** is used by default. You can set units as K, M, G and T, which stand for kilobytes (KB), megabytes (MB), gigabytes (GB), and terabytes (TB) respectively. If you omit the unit, bytes will be applied. The size of the database is always rounded up to 64 disk sectors, which depends on the size of a page and can be 16M, 32M or 64M for page size 4k, 8k and 16k respectively.

The following example shows how to add a volume for which 256 MB are assigned to the *testdb* database.

``` bash
coradb addvoldb --db-volume-size=256M testdb
```

**-n, --volume-name=NAME**

This option specifies the name of the volume to be added to a specified database. The volume name must follow the file name protocol of the operating system and be a simple one without including the directory path or spaces. If the **-n** option is omitted, the name of the volume to be added is configured by the system automatically as "database name_volume identifier". For example, if the database name is *testdb*, the volume name *testdb_x001* is automatically configured.

The following example shows how to specify a different name, *testdb_v1*, to newly added volume.

``` bash
coradb addvoldb -n testdb_v1 testdb
```

**-F, --file-path=PATH**

This option specifies the directory path where the volume to be added will be stored. If the **-F** option is omitted, the value of the system parameter **volume_extension_path** is used by default.

The following example shows how to add a volume in the */dbtemp/addvol* directory. Since the **-n** option is not specified for the volume name, the volume name *testdb_x001* will be created.

``` bash
coradb addvoldb -F /dbtemp/addvol/ testdb
```

**--comment COMMENT**

This option facilitates to retrieve information on the added volume by adding such information in the form of comments. It is recommended that the contents of a comment include the name of **DBA** who adds the volume, or the purpose of adding the volume. The comment must be enclosed in double quotes.

The following example shows how to add a volume and inserts a comment with additional information.

``` bash
coradb addvoldb --comment "Data volume added by cheolsoo kim because permanent data space was almost depleted." testdb
```

**-p, --purpose=PURPOSE**

This option specifies the purpose of the volume to be added. The purpose defines the type of files that will be stored in added volume:

- **PERMANENT DATA** to store table rows, indexes and system files.
- **TEMPORARY DATA** to store intermediate and final results of query processing and sorting.

If not specified, the purpose of the volume is by default considered **PERMANENT DATA**. The following example shows how to change it to temporary.

``` bash
coradb addvoldb -p temp testdb
```

> **Note:**
> PERMANENT DATA volumes used to be classified as generic, data and index. The design of volumes has been changed, and since then the classification no longer exists. In order to avoid invalidating your old scripts, we chose to keep the keywords as valid options, but their effect will be the same. The only remaining option value with a real effect is temp.
>
> For detailed information on each purpose, see [Database volume structure](https://www.coradb.ai/manual/intro.html#database-volume-structure).


**-S, --SA-mode**

This option accesses the database in standalone mode without running the server process. This option has no parameter. If the **-S** option is not specified, the system assumes to be in client/server mode.

``` bash
coradb addvoldb -S --db-volume-size=256M testdb
```

**-C, --CS-mode**

This option accesses the database in client/server mode by running the server and the client separately. There is no parameter. Even when the **-C** option is not specified, the system assumes to be in client/server mode by default.

``` bash
coradb addvoldb -C --db-volume-size=256M testdb
```

**--max-writesize-in-sec=SIZE**

The **--max-writesize-in-sec** is used to limit the impact of system operating when you add a volume to the database. This can limit the maximum writing size per second. The unit of this option is K(kilobytes) and M(megabytes). The minimum value is 160K. If you set this value as less than 160K, it is changed as 160K. It can be used only in client/server mode.

The below is an example to limit the writing size of the 2GB volume as 1MB. Consuming time will be about 35 minutes(= (2048MB/1MB) /60 sec.).

``` bash
coradb addvoldb -C --db-volume-size=2G --max-writesize-in-sec=1M testdb
```


## deletedb

The **coradb deletedb** utility is used to delete a database. You must use the **coradb deletedb** utility to delete a database, instead of using the file deletion commands of the operating system; a database consists of a few interdependent files.

The **coradb deletedb** utility also deletes the information on the database from the database location file (**databases.txt**). The **coradb deletedb** utility must be run offline, that is, in standalone mode when nobody is using the database.

``` bash
coradb deletedb  [options] database_name
```

- **coradb**: An integrated utility for the CoraDB service and database management.
- **deletedb**: A command to delete a database, its related data, logs and all backup files. It can be executed successfully only when the database is in a stopped state.
- *database_name*: Specifies the name of the database to be deleted without including the path name.

The following shows \[options\] available with the **coradb deletedb** utility.

**-o, --output-file=FILE**

This option specifies the file name for writing messages:

``` bash
coradb deletedb -o deleted_db.out testdb
```

The **coradb** **deletedb** utility also deletes the database information contained in the database location file (**databases.txt**). The following message is returned if you enter a utility that tries to delete a non-existing database.

``` bash
coradb deletedb testdb
Database "testdb" is unknown, or the file "databases.txt" cannot be accessed.
```

**-d, --delete-backup**

This option deletes database volumes, backup volumes and backup information files simultaneously. If the -**d** option is not specified, backup volume and backup information files are not deleted.

``` bash
coradb deletedb -d testdb
```


## renamedb

The **coradb 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.

In contrast, the **coradb alterdbhost** utility configures or changes the host name of the specified database. In other words, it changes the host name configuration in the **databases.txt** file.

``` bash
coradb renamedb [options] src_database_name dest_database_name
```

- **coradb**: An integrated utility for the CoraDB 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.
- *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.

The following shows \[options\] available with the **coradb renamedb** utility.

**-E, --extended-volume-path=PATH**

This option renames an extended volume created in a specific directory path (e.g. /dbtemp/addvol/), and then moves the volume to a new directory. This specifies a new directory path (e.g. /dbtemp/newaddvols/) where the renamed extended volume will be moved.

If it 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.

``` bash
coradb renamedb -E /dbtemp/newaddvols/ testdb testdb_1
```

**-i, --control-file=FILE**

The option specifies 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.

``` bash
coradb renamedb -i rename_path testdb testdb_1
```

The following 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.

``` text
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.

``` text
-5  /home1/user/testdb_vinf       /home1/CoraDB/databases/testdb_1_vinf
-4  /home1/user/testdb_lginf      /home1/CoraDB/databases/testdb_1_lginf
-3  /home1/user/testdb_bkvinf     /home1/CoraDB/databases/testdb_1_bkvinf
-2  /home1/user/testdb_lgat       /home1/CoraDB/databases/testdb_1_lgat
 0  /home1/user/testdb            /home1/CoraDB/databases/testdb_1
 1  /home1/user/backup/testdb_x001/home1/CoraDB/databases/backup/testdb_1_x001
```

**-d, --delete-backup**

This option renames 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.

``` bash
coradb renamedb -d testdb testdb_1
```


## alterdbhost

The **coradb alterdbhost** utility sets or changes the host name of the specified database. It changes the host name set in the **databases.txt** file.

``` bash
coradb alterdbhost [option] database_name
```

- **coradb**: An integrated utility for the CoraDB service and database management
- **alterdbhost**: A command used to change the host name of the current database

The following shows the option available with the **coradb alterdbhost** utility.

**-h, --host=HOST**

The *-h* option specifies the host name to be changed. When this option is omitted, specifies the host name to localhost.


## copydb

The **coradb 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 **coradb copydb** utility can be executed only offline (that is, state of a source database stop).

``` bash
coradb copydb [options] src-database-name dest-database-name
```

- **coradb**: An integrated utility for the CoraDB service and database management.
- **copydb**: A command that copy or move a database from one to another location.
- *src-database-name*: The names of source and target databases to be copied or moved.
- *dest-database-name*: A new (target) database name.

If options are omitted, a target database is copied into the same directory of a source database.

The following shows \[options\] available with the **coradb copydb** utility.

**--server-name=HOST**

The *--server-name* option specifies 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.

``` bash
coradb copydb --server-name=cora_server1 testdb new_testdb
```

**-F, --file-path=PATH**

The *-F* option specifies 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.

``` bash
coradb copydb -F /home/usr/CoraDB/databases testdb new_testdb
```

**-L, --log-path=PATH**

The *-L* option specifies 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.

``` bash
coradb copydb -L /home/usr/CoraDB/databases/logs testdb new_testdb
```

**-E, --extended-volume-path=PATH**

The *-E* option specifies 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.

``` bash
coradb copydb -E home/usr/CoraDB/databases/extvols testdb new_testdb
```

**-i, --control-file=FILE**

The **-i** option specifies 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. This option cannot be used with the **-E** option. An input file named copy_path is specified in the example below.

``` bash
coradb copydb -i copy_path testdb new_testdb
```

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

``` text
# volid   source_fullvolname   dest_fullvolname
0 /usr/databases/testdb        /drive1/usr/databases/new_testdb
1 /usr/databases/testdb_data1  /drive1/usr/databases/new_testdb_data1
2 /usr/databases/ext/testdb_ext1 /drive2//usr/databases/new_testdb_ext1
3 /usr/databases/ext/testdb_ext2  /drive2/usr/databases/new_testdb_ext2
```

- *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 valid path.

**-r, --replace**

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

``` bash
coradb copydb -r -F /home/usr/CoraDB/databases testdb new_testdb
```

**-d, --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 **coradb 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.

``` bash
coradb copydb -d -F /home/usr/CoraDB/databases testdb new_testdb
```

**--copy-lob-path=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.

``` bash
coradb copydb --copy-lob-path testdb new_testdb
```

**-B, --lob-base-path=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.

``` bash
coradb copydb -B /home/usr/CoraDB/databases/new_lob testdb new_testdb
```


## installdb

The **coradb installdb** utility is used to register the information of a newly installed database to **databases.txt**, which stores database location information. The execution of this utility does not affect the operation of the database to be registered.

``` bash
coradb installdb [options] database_name 
```

- **coradb**: An integrated utility for the CoraDB service and database management.
- **installdb**: A command that registers the information of a moved or copied database to **databases.txt**.
- *database_name*: The name of database to be registered to **databases.txt**.

If no \[options\] are used, the command must be executed in the directory where the corresponding database exists.

The following shows \[options\] available with the **coradb installdb** utility.

**--server-name=HOST**

This option registers the server host information of a database to **databases.txt** with a specific host name. If this is not specified, the current host information is registered.

``` bash
coradb installdb --server-name=cora_server1 testdb
```

**-F, --file-path=PATH**

This option registers the absolute directory path of a database volume to **databases.txt** by using the **-F** option. If this option is not specified, the path of a current directory is registered as default.

``` bash
coradb installdb -F /home/coradb/CoraDB/databases/testdb testdb
```

**-L, --log-path=PATH**

This option registers the absolute directory path of a database log volume to **databases.txt** by using the **-L** option. If this option is not specified, the directory path of a volume is registered.

``` bash
coradb installdb -L /home/coradb/CoraDB/databases/logs/testdb testdb
```

## tde

The **coradb tde** utility is used to manage the TDE encryption of the database and can only be executed by the **DBA** user. With **coradb tde** utility, you can change the key set on the database, add a new key, or remove a key in the key file stably. Also, you can inquire about the keys added to the key file and the key set on the database. For more information, see [TDE (transparent data encryption)](https://www.coradb.ai/manual/security.html#tde-transparent-data-encryption).

``` bash
coradb tde <operation> [option] database_name
```

- **coradb**: An integrated utility for the CoraDB service and database management.
- **tde**: A utility that manages TDE encryption applied to the database.
- *operation*: There are four types of operation: key addition, key deletion, key change, and showing keys' information. One operation must be set, and they are exclusive.
- *database_name*: The name of the database on which TDE administration operations to be performed.

The following table shows \<operation\> available with the coradb tde utility.

**-s, --show-keys**

This option displays information about the keys set on the database and keys in the key file (\_keys).

``` bash
$ coradb tde -s testdb
Key File: /home/usr/CoraDB/databases/testdb/testdb_keys

The current key set on testdb:
Key Index: 2
Created on Fri Nov 27 11:14:54 2020
Set     on Fri Nov 27 11:15:30 2020

Keys Information:
Key Index: 0 created on Fri Nov 27 11:11:27 2020
Key Index: 1 created on Fri Nov 27 11:14:47 2020
Key Index: 2 created on Fri Nov 27 11:14:54 2020
Key Index: 3 created on Fri Nov 27 11:14:55 2020

The number of keys: 4
```

**The current key** section shows the information on the key set on the current database, which displays the index for the key in the key file, the creation time, and the set time. The set key can be identified by the key index and creation time, and a key change plan can be established with the set time.

**Keys Information** section shows the keys added and being managed in the key file, through which the key indexes and creation time of them is checked.

**-n, --generate-new-key**

This option is used to add a new key to the key file (up to 128). If it is successful, the index of the added key is displayed, and this index is used to identify the key when changing or removing the key later. Information of added keys can be checked by \\\\show-keys.

``` bash
$ coradb tde -n testdb
Key File: /home/usr/CoraDB/databases/testdb/testdb_keys

SUCCESS: A new key has been generated - key index: 1 created on Tue Dec  1 11:30:47 2020
```

**-d, --delete-key=KEY_INDEX**

This option is used to remove a key specified by index from the key file. The key currently set on the database cannot be removed.

``` bash
$ coradb tde -d 1 testdb
Key File: /home/usr/CoraDB/databases/testdb/testdb_keys

SUCCESS: The key (index: 1) has been deleted
```

**-c, --change-key=KEY_INDEX**

This option is used to change the key set on the database to another key existing in the key file. When changing, both the previously set key and the new key to be set must exist.

``` bash
$ coradb tde -c 2 testdb
Key File: /home/usr/CoraDB/databases/testdb/testdb_keys

Trying to change the key from the key (index: 0) to the key (index: 2)..
SUCCESS: The key has been changed from the key (index: 0) to the key (index: 2)
```

To change the key set on the database, a user must first create a key to be set by the \\\\generate-new-key option. The user can create a new key to change, or create multiple keys in advance for changing the key according to their own security plans.

The following table shows \[options\] available with the coradb tde utility.

**-p, --dba-password=PASSWORD**

This option specifies the password of the DBA.

## Locale commands

**coradb genlocale** utility compiles the locale information to use. This utility is executed in the **make_locale.sh** script ( **.bat** for Windows).

**coradb dumplocale** utility dumps the compiled binary locale (CoraDB locale library) file as a human-readable format on the console. It is better to save the output as a file by output redirection.

**coradb synccolldb** utility checks if the collations between database and locale library are consistent or not, and synchronize them.

For more detailed usage, see [Locale setting](https://www.coradb.ai/manual/sql/i18n_locale.html#locale-setting).

## Timezone commands

**coradb gen_tz** utility has two modes:

- **new** mode when it compiles the IANA timezone data stored in the tzdata folder into a C source code file. This file is then converted into a .so shared library for Linux or .dll library for Windows using the **make_tz.sh** (Linux) / **make_tz.bat** (Windows) scripts.
- **extend** mode is similar to new but is used when you want to update your timezone data to a different version and ensure backward compatibility with the old data. It is always used with a database name argument. In some situations, when it is impossible to ensure backward compatibility just by merging the two versions of timezone data, an update of the data in the tables of the database is done. It is executed using **make_tz.sh -g extend** for Linux and **make_tz.bat /extend** for Windows.

**coradb dump_tz** utility dumps the compiled CoraDB timezone library file as a human-readable format on the console. It is better to save the output as a file by output redirection.
