You are here: Database Administration > Backing Up and Restoring Databases > Using Copies of Current State to Restore Data

Using Copies of Current State to Restore Data

To restore a copy of the current state of a database, you can invoke the nuodbmgr restore database command to create a new database from your backup copy. The procedure is the same regardless of how you obtained the backup copy. That is, you can invoke nuodbmgr database restore on an archive created from a redundant storage manager, or a running database by means of a hot copy operation.

The restore command takes a database name as an argument. Specify the name of the archive that was the result of copying the database's current state.

Before you invoke the restore command, you must ensure that the archive is in the required location. The required location is identified by the host's archive_base host tag key . By default, the archive_base host tag key has this value: /var/opt/nuodb/production-archives. The associated journal must be in the default location, which is the journal directory inside the archive directory. Thus, the location of the archive that you want to restore is as follows:

archive_base_value/database_name

For example, for a database named test when the archive_base host tag key has the default value, the archive location must be:

/var/opt/nuodb/production-archives/test

When the archive you want to restore is not in the required location you must move or copy it to that location. Likewise, if the journal directory is not in the archive directory then you must move or copy it there.

When using the restore command, you may specify database options and template variables.

The example below creates a database called test_backup_oct16 based on the backup that was created in the example in Copying the Archive and Journal of the Shutdown Storage Manager. In the following example, you could alternatively specify, for example, test_archive_hotcopy050515 as the archive you want to restore and that would create the test_archive_hotcopy050515 database in the default archive directory (/var/opt/nuodb/production-archives/test_archive_hotcopy050515).

nuodb [domain] > restore database
Database Name: test_backup_oct16
Host (required for template: Single Host): ip-172-31-40-24
Database Options (optional): mem 3g
Template Variables (optional):
nuodb [domain] > show domain summary
Hosts:
[broker] * ip-172-31-40-24/107.23.52.10:48004 (us-east-1)
[broker] ip-172-31-46-122/54.165.58.157:48004 (us-east-1)

Database: test, (unmanaged), processes [2 TE, 2 SM], ACTIVE
[SM] ip-172-31-40-24/107.23.52.10:48005 (us-east-1) [ pid = 23781 ] [ nodeId = 9 ] RUNNING
[TE] ip-172-31-40-24/107.23.52.10:48006 (us-east-1) [ pid = 23120 ] [ nodeId = 4 ] RUNNING
[SM] ip-172-31-46-122/54.165.58.157:48007 (us-east-1) [ pid = 8151 ] [ nodeId = 1 ] RUNNING
[TE] ip-172-31-46-122/54.165.58.157:48008 (us-east-1) [ pid = 8167 ] [ nodeId = 2 ] RUNNING

Database: test_backup_oct16, (unmanaged) processes [1 TE, 1 SM], ACTIVE
[SM] ip-172-31-40-24/107.23.52.10:48007 (us-east-1) [ pid = 23845 ] [ nodeId = 1 ] RUNNING
[TE] ip-172-31-40-24/107.23.52.10:48008 (us-east-1) [ pid = 23860 ] [ nodeId = 2 ] RUNNING
nuodb [domain] >