You are here: Database Administration > Backing Up and Restoring Databases > Using Snapshots to Restore Data > Restoring Data to Snapshots

Restoring Data to Snapshots

After successful execution of either hot copy on an SSM or a copy operation on a stopped SSM, you have the snapshot whose state you want to restore to. You also have the archive and journal data that is needed to create a new archive that provides the database state captured by the snapshot of interest. You are ready to invoke the nuochk utility to restore to that snapshot. Execution of the nuochk utility is the only way to restore to a snapshot.

The nuochk restore operation is an offline operation. You do not restore to the snapshot on a running database. Neither the source nor the target archives can be in use by a running database. The nuochk restore operation creates a new archive and you can then specify this archive when starting an SM or SSM.

The nuochk utility is in the NUODB_HOME/bin directory. The format for invoking nuochk to restore to a snapshot is as follows:

nuochk --repair
   --restore-snapshot snapshot_id 
   --restore-dir destination_dir  
   --snapshot-archive snapshot_archive_dir 
   --journal enable 
   [--journal-dir journal_dir]
     location

Option Description
--repair Required. Execution of nuochk will perform clean up operations in the hot copy before creating the restored archive.
--restore-snapshot snapshot_id

Required. Specify the ID of the snapshot you want to use to restore data. For example: --restore-snapshot 123456

--restore-dir destination_dir  Required. Specify a file system directory that will contain the restored archive. This directory must not exist. For example: ‑‑restore-dir /tmp/archive-from-snapshot-123456.
--snapshot-archive snapshot_archive_dir 

Required. Specify the directory that contains the snapshot you want to restore to. This snapshot archive must be the result of a hot copy operation. For example: ‑‑snapshot-archive /tmp/hotcopy/1/snapshots.

--journal enable Required. The nuochk utility reads the journal from the hot copy.
--journal-dir journal_dir

Specify the path of the journal directory that was the result of the hotcopy operation. Required if you specified a journal directory when you invoked the hotcopy operation. Otherwise, do not specify this option.

location Required. Specify the path of the archive directory that was the result of the hotcopy operation.

For example:

$  nuochk --repair --restore-snapshot 123456 
   --restore-dir /tmp/archive-at-snapshot-123456 
   --snapshot 
   --snapshot-archive /tmp/hotcopy/1/snapshots 
   --journal enable 
   --journal-dir /tmp/hotcopy/1/journal 
   /tmp/hotcopy/1/archive

For more information, see NuoDB Check.