Background Image

DOCUMENTATION

?

Shortcut

PrevPrev Article

NextNext Article

Larger Font Smaller Font Up Down Go comment Print Attachment

The scope of this tutorial is to introduce the CUBRID capabilities for database backup & restore.
This is the 2nd part of the tutorial, focusing on CUBRID restore.  If you haven’t read the 1st part of the tutorial (focused on backup), we recommend to first reading it before continuing with this other part.

Database Restore

The CUBRID database restore is a 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.

To perform a database restore, users will typically use the cubrid restoredb utility or the CUBRID Admin GUI client.

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 https://www.cubrid.org/manual/en/10.2/admin/admin_utils.html#restoredb or the offline help available within the CUBRID Admin 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.

restore_cmd.png

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:

restore_list_2.png

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:

restore_list_level.png

What we will do now is a simple exercise which will show the steps 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;

truncate.png

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

restore_cmd__2.png

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 https://www.cubrid.org/manual/en/10.2/admin/admin_utils.html#restoredb for more information.

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

csql_restore.png

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:

restore_log.png

As you can see from this exercise, restoring a database to a previous state is not a difficult task at all. 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 Admin 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 Admin client.

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

  • Click the Restore Database restore_icon.png 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 Admin client will display the dialog shown below, where you can setup all the options needed to perform the restore:

restore_admin.png

In the CUBRID Admin 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 Admin client interface.

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

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

This concludes the CUBRID Backup & Restore tutorial. Please let us know your feedback and remember to periodically check the CUBRID web site for other tutorials and resources.

Thank you!


  1. CUBRID HA (High Availability) Starting Guide

    Date2020.05.22 CategoryServer
    Read More
  2. CUBRID GRANT ALL TABLES

    Date2020.07.17 CategoryServer
    Read More
  3. CUBRID Configuration Guide to Launch Services

    Date2020.06.24 CategoryServer
    Read More
  4. CUBRID Backup & Restore – Part II (Restore)

    Date2020.06.22 CategoryServer
    Read More
  5. CUBRID Backup & Restore – Part I (Backup)

    Date2020.06.22 CategoryServer
    Read More
  6. CSQL - Command Line SQL Interpreter

    Date2020.05.12 CategoryTools
    Read More
  7. Analyzing JDBC Logs with LOG4JDBC

    Date2020.05.21 CategoryInterfaces
    Read More
Board Pagination Prev 1 2 3 4 Next
/ 4

Join the CUBRID Project on