Open Source RDBMS - Seamless, Scalable, Stable and Free

한국어 | Login |Register

How to Restore a Database in CUBRID

A CUBRID database restore is the procedure of restoring the database to a previous state, by using the backup files, active logs and archive logs, previously created by a database backup.

  • In the command line using the cubrid restoredb utility.
  • Using the CUBRID Manager GUI database administration tool.

Note: When we talk about backup and restore, we need to mention that the restore environment must have the same operating system and the same version of CUBRID as the backup environment.

If you need to migrate your database from other database systems to CUBRID or from older version of CUBRID to the latest, there is another dedicated tool called the CUBRID Migration Toolkit (CMT) which supports such scenarios.

CUBRID restoredb utility

The syntax of the tool is:

> cubrid restoredb [ options ] database_name
[ options ]
-d | -B | -l | -p | -o | -u |
--up-to-date | --backup-file-path | --level | --partial-recovery | --output-file | --replication-mode | --use-database-location-path | --list

For complete information about the usage of this utility, please consult the online manual at http://www.cubrid.org/cubrid_backup_restore_2#CUBRID-restoredb-utility-1 or the offline help available within the CUBRID Manager client.

Note: This tool can be executed only in a standalone mode (it will not work in a client-server mode, as the backupdb tool does). For more explanation, read further.

Restore examples

In this example we will assume that we have the backup files we have created in the previous How to Backup a Database in CUBRID tutorial.

First of all, you can always get the list of the available backups, by executing the following command:

> cubrid restoredb --list demodb

The database you are trying to restore should be stopped before you run the restoredb tool. Otherwise, you are subject to receive the following error message.

restoredb list error

To stop the database, type the following command where demodb is the name of your database:

> cubrid server stop demodb

Once you execute the cubrid restoredb --list demodb command successfully, you will obtain the information about the available backups for the specified database:

restoredb list information

Please note that by default the level 0, i.e. full backup will show up if exists. Using the “-l” parameter, you can obtain information about specific level backups:

restoredb list level 2

What we will do now is a simple exercise which will show the steps to be taken to quickly restore a database state.

Let’s connect to the demodb database and delete all the data from the table code. So, first let’s enter the CSQL command line tool by typing:

>csql –C –u dba demodb

To truncate the table code type

> truncate code;
> ;x

The ;x command will tell CSQL to execute the statement.

CSQL truncate table

And now let’s perform a database restore, to the point of the last backup:

CUBRID stop database and restore

Remember, it is not in the scope of this tutorial to go through all the available options for performing a restore using the restoredb tool. See http://www.cubrid.org/cubrid_backup_restore_2 for more information.

Finally, let’s verify that the data which was previously deleted from the code table has been restored:

CSQL check database

And if you used the “-o” option for the restore command, then you will find detailed information about the restore procedure, saved in the specified file; for example:

restoredb log file

As you can see from this exercise, restoring a database to a previous state is not at all a difficult task. The key to the process is to have the appropriate backups in place and to develop and implement an efficient backup strategy for your CUBRID installation.

Restore database using CUBRID Manager Client

In the example above, we showed you how to restore a database using the restoredb command line tool. In addition to this, there is another easy way to restore a database – which is using the interface provided by the CUBRID Manager client.

To restore a database, you can do one of the followings:

  • Click the Restore Database CUBRID Manager Restore database icon icon from the toolbar.
  • Right-click on the database in the navigation tree and then select Restore Database.
  • Select Action -> Restore Database in the main menu.

Remember, a database restore can be performed only when the database server is not running; therefore, menus will be disabled while the database is running.

When using one of these options, the CUBRID Manager client will display the dialog shown below, where you can setup all the options needed to perform the restore:

CUBRID Manager restore database window

In the CUBRID Manager client, there are other features available related to the backup and restore, which were not presented in this tutorial. As we already mentioned in the 1st part of the tutorial, we highly encourage you to try out the rich backup & restore options provided by the CUBRID Manager client interface.

In addition, we strongly recommend reading about two other very useful CUBRID tools:

  • cubrid loaddb
  • cubrid unloaddb

These tools can be used for easy data export & import, including the databases schema.

See also

Getting Help

If you have any questions related the CUBRID Restore, you can tweet to @cubrid or post your message on the CUBRID Forum.




You are either using a very old browser or a browser that is not supported.
In order to browse cubrid.org you need to have one of the following browsers:



Internet Explorer: Mozilla Firefox: Google Chrome: