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 | 

Unloading Database

Description

The purposes of unloading/loading a database are as follows:

  • To reconstruct the database by rebuilding the database volume
  • To perform migration to a different system environment
  • To perform migration to a different version of the DBMS
Syntax

cubrid unloaddb [ options ] database_name

[ options ]

-i | -O | -s | -d | -v | -S | -C |

--input-class-file | --output-path | --schema-only | --data-only | --verbose | --SA-mode | --CS-mode | --include-reference | --input-class-only | --lo-count | --estimated-size | --cached-pages | --output-prefix | --hash-file | --datafile-per-class

  • cubrid : An integrated utility for the CUBRID service and database management.
  • unloaddb : A utility that creates ASCII files from a database. It is used together with the cubrid loaddb utility for replacing system, upgrading product version or reorganizing database volumes. It can be used both in standalone and client/server modes. Data can be unloaded even when the database is running.
  • options : A short option starts with a single dash (-) while a full name option starts with a double dash (--). Note that options are case sensitive.
  • database_name : Specifies the name of the database to be unloaded.
Return value

Return values of cubrid unloaddb utility are as follows:

  • 0 : Success
  • Non-zero : Failure
Generated Files
  • Schema file (database-name_schema) : A file that contains information on the schema defined in the database.
  • Object file (database-name_objects) : A file that contains information on the records in the database.
  • Index file (database-name_indexes) : A file that contains information on the indexes defined in the database.
  • Trigger file (database-name_trigger) : A file that contains information on the triggers defined in the database. If you don't want triggers to be running while loading the data, load the trigger definitions after the data loading has completed.

Schema, object, index and trigger files are created in the same directory.

Option

The following table shows options that can be used with cubrid unloaddb utility. Options are case sensitive.

Option

Description

-i
--input-class-file

Unloads the database class into the input file specified in an argument.

-O
--output-path

Specifies the directory in which to create schema and object files. If the option is not specified, files are created in the current directory.

-s
--schema-only

Creates only the schema file, not the data file.

-d
--data-only

Creates only the data file, not the schema file.

-v
--verbose

Displays detailed information on the database being unloaded.

-S
--SA-mode

Unloads the database in standalone mode.

-C
--CS-mode

Unloads the database in client/server mode.

--include-reference

Unloads the object reference as well when the specified database class is unloaded with the -i option.

--input-class-only

Is used with the -i option. Creates only the schema files which are related to tables included in the input file.

--lo-count

Specifies the number of large object (LO) data files to be created in a single directory.
Default value : 0

--estimated-size

Specifies the number of records expected.

--cached-pages

Configures the number of object tables to be cached in the memory.
Default value : 100

--output-prefix

Specifies the prefix for schema and object file names.

--hash-file

Specifies the name of the hash file.

--datafile-per-class

Generates a data file per each table.

Input file with the list of tables to be unloaded (-i or --input-class-file)

The following is an example of a input file (table_list.txt).

table_1

table_2

..

table_n  

The -i option specifies the input file where the list of tables to be unloaded is stored so that only specified part of the database can be unloaded.

cubrid unloaddb -i table_list.txt demodb

The -i option can be used together with the --input-class-only option that creates the schema file related to only those tables included in the input file.

cubrid unloaddb --input-class-only -i table_list.txt demodb

The -i option can be used together with the --include-reference option that creates the object reference as well.

cubrid unloaddb --include-reference -i table_list.txt demodb

Specifying the directory where files created will be saved (-O or --output-path)

The -O option specifies the directory where the output files generated by the unload operation is saved. If the -O option is not specified, output files are created in the current working directory.

cubrid unloaddb -O ./CUBRID/Databases/demodb demodb

If the specified directory does not exist, the following error message will be displayed.

unloaddb: No such file or directory.

Creating the schema file only (-s or --schema-only)

The -s option specifies that only the schema file will be created from amongst all the output files which can be created by the unload operation.

cubrid unloaddb -s demodb

Creating the data file only (-d or -data-only)

The -d option specifies that only the data file will be created from amongst all of the output files which can be created by the unload operation.

cubrid unloaddb -d demodb

Creates data files by table (--datafile-per-class)

--datafile-per-class is the option specifying that the output file generated through unload operation creates a data file per each table. The file name is generated as <Database Name>_<Table Name>_objects for each table. However, all column values in object types are unloaded as NULL and %id class_name class_id part is not written in the unloaded file (see How to Write a File to Load Database).

cubrid unloaddb -d demodb

Displaying the unload status information (-v or --verbose)

The -v option displays detailed information on the database tables and records being unloaded while the unload operation is under way.

cubrid unloaddb -v demodb

Standalone mode (-S or --SA-mode)

The -S option performs the unload operation by accessing the database in standalone mode.

cubrid unloaddb -S demodb

Client/server mode (-C or --CS-mode)

The -C option performs the unload operation by accessing the database in client/server mode.

cubrid unloaddb -C demodb

Number of estimated records (--estimated-size)

The --estimated-size option allows you to assign hash memory to save records of the database to be unloaded. If the --estimated-size option is not specified, the number of records of the database is determined based on recent statistics information. This option can be used if the recent statistics information has not been updated or if a large amount of hash memory needs to be assigned. Therefore, if the number given as the argument for the option is too small, the unload performance deteriorates due to hash conflicts.

cubrid unloaddb --estimated-size 1000 demodb

Number of pages to be cached (--cached-pages)

The --cached-pages option specifies the number of pages of tables to be cached in the memory. Each page is 4,096 bytes. The administrator can configure the number of pages taking into account the memory size and speed. If this option is not specified, the default value is 100 pages.

cubrid unloaddb --cached-pages 500 demodb

Specifying the prefix for the name of the file to be created (--output-prefix)

The --output-prefix option specifies the prefix for the names of schema and object files created by the unload operation. Once the example is executed, the schema file name becomes abcd_schema and the object file name becomes abcd_objects. If the --output-prefix option is not specified, the name of the database to be unloaded is used as the prefix.

cubrid unloaddb --output-prefix abcd demodb