Managing ObjectStore

osrestore: Restoring Databases from Backups

The osrestore utility copies databases from backup storage locations to your disk or rawfs. Backups must have been created with the osbackup utility. See also Overview of the Backup/Restore Facility.

Syntax

osrestore [options] -f backup-file [-f backup-file]... [pathname_
translation]...
-f backup-
file 
Specifies a file or tape device that contains a backup image from which to restore data-bases. You can specify the -f option one or more times. Required.

On UNIX systems, you can specify -f - (hyphen) to indicate stdin.

pathname_
translation... 
Specifies a pair of pathnames separated by a space. The first pathname in the pair indicates the source of the database as recorded in the backup image. The second pathname indicates the target, that is, the pathname for the database after it is restored.

You can specify zero, one, or more pathname translations. Each pathname can be a directory or a single database. However, you cannot specify a directory as the source and a database as the target.

If you do not specify at least one pathname_translation, all databases in the backup image are restored in their original locations.

Options
-a 
Aborts the restore operation if the utility cannot open the restore device. This raises an exception that indicates the problem.

The default is that if the restore utility fails to open the device, it displays a message and waits for you to correct the problem.

Examples of failure to open the device are having a write-protected tape or no tape loaded.

-b blocking-factor 
Specifies a blocking factor to use for tape input and output. This parameter applies only when you are restoring data from a tape. The blocking factor is in units of 512-byte blocks. The default on UNIX is 126 blocks. The maximum blocking factor is 512 blocks.

-n 
Normally, if a directory is specified as a source for osrestore, all databases in the directory and its subdirectories are restored. Including the -n option limits the operation to databases in the named directory.

-0 (zero)
Restores the database image specified with the -f flag, then exits. There is no prompt for additional volumes.

-p 
The -p (permissions) option causes osrestore to restore database permissions for the rawfs stored in the archive log file for the database being restored.

-S exec_command_name 
Specifies the pathname of a command to be executed when the osrestore utility reaches the end of the media. This command should mount the next volume before returning. The exit status from this command must be 0 or the restore operation aborts. Note that this option is an uppercase S.

-t 
Displays a list of databases in the backup image.

Description

ObjectStore applications cannot access databases that are being restored until the entire restoration process has finished.

Specify a pathname_translation when you want to restore

Procedure

To restore databases, begin with a level 0 backup image. The osrestore utility prompts for incremental backup images you might want to apply after this. Not all incremental backups need to be applied. To determine the incremental backups to apply, list the backup levels in chronological order, starting with the level 0 backup. For example, suppose you performed the following backups:

Your list would look like this: 0, 5, 6, 2, 4.

Scanning the list from right to left, find the lowest incremental backup level greater than 0, in this case, the level 2 backup made on Thursday. To restore databases to their state as of the backup on Friday, apply the level 0 backup and the incremental backups made at levels 2 and 4, in that order.

Block size

The block size must be 512 bytes or less. The osrestore utility cannot work when the block size is greater than 512 bytes.

Comparing databases

You might want to have two copies of the same database for verification purposes, a restored version and the original version. Following is a sample command line for doing this. In this example, backup.img contains foo::/db. The pathname translation does the job in one step.

osrestore -f backup.img foo::/db foo::/restore.db

Windows to UNIX pathname translation example

You must specify a pathname translation when you restore or recover data on an architecture that is different from the architecture on which you are restoring the data. An example is a Windows NT to UNIX pathname translation. The backup image being restored is /tmp/my.img. The interaction is on a UNIX system. You need not do anything special when you make the backup on the Windows NT system.

In the first interaction, the command line specifies the -t option, which instructs the osrestore utility to list the databases in the specified backup image. Nothing is actually restored. The only database in the backup image is mckinley:e:\r4tsd_data\arch.0. This is a Windows NT database, and the following example shows that the osrestore utility on a UNIX system translates it to mckinley:e:/r4tsd_data/arch.0. The utility automatically translates back slashes (\) to slashes (/).

% osrestore -f /tmp/my.img -t
Recovering from volume #1 (/tmp/my.img)...
mckinley:e:/r4tsd_data/arch.0
Closing volume #1 (/tmp/my.img).
%
In the second interaction, the command line specifies the pathname translation mckinley:e:/r4tsd_data/ /recovery. This instructs the osrestore utility to copy all files in the backup image in the mckinley:e:/r4tsd_data/ directory to the /recovery directory on the local machine. In this example, this is only arch.0.

% osrestore -f /tmp/my.img mckinley:e:/r4tsd_data/ /recovery
Recovering from volume #1 (/tmp/my.img)...
Restoring 3175 sectors to database "vancouver:/recovery/arch.0"
Recovered to time Fri Mar 3 14:07:24 1999
Do you wish to restore from any additional incremental backups? 
(yes/no):
no
Closing volume #1 (/tmp/my.img).
%

Examples

The following examples illustrate some uses of osrestore. Although it is not shown, osrestore prompts you to indicate whether you want to restore from incremental backups.

The examples are UNIX examples; however, they would be the same on any platform except the file name format.

Listing databases
in backup image

The following example displays a list of databases in the backup.img backup image:

% osrestore -t -f /backup.img 
::eudyp:/test/ 
::eudyp:/test:       data1.odb       data2.odb       data3.odb
::cleopat:/results/
::cleopat:/results:       r1.odb       r2.odb       r3.odb
The following example indicates that the backup image contains six file databases. Three are in the /test directory; they were backed up on host eudyp. Three are in the /results directory; they were backed up on host cleopat.

Copying backups
to new Servers

Restores all databases on Server eudyp to Server kellen, and all databases on Server cleopat to Server eudyp:

% osrestore -f backup.img   eudyp:/ kellen:/   cleopat:/ eudyp:/
restoring "::eudyp:/test/data1.odb" to "::kellen:/test/data1.odb"   
restoring "::eudyp:/test/data2.odb" to "::kellen:/test/data2.odb"
restoring "::eudyp:/test/data3.odb" to "::kellen:/test/data3.odb"
restoring "::cleopat:/results/r1.odb" to "::eudyp:/results/r1.odb"
restoring "::cleopat:/results/r2.odb" to "::eudyp:/results/r2.odb"
restoring "::cleopat:/results/r3.odb" to "::eudyp:/results/r3.odb"

Changing Servers
and directories

Restores all databases in the /test directory on Server eudyp into the /test-copy directory on Server kellen:

% osrestore -f backup.img   eudyp:/test   kellen:/test-copy
restoring "::eudyp:/test/data1.odb" to "::kellen:/test-copy/data1.odb"   
restoring "::eudyp:/test/data2.odb" to "::kellen:/test-copy/data2.odb"
restoring "::eudyp:/test/data3.odb" to "::kellen:/test-copy/data3.odb"

Restoring a single database

Restores the database eudyp:/test/data1.odb to /tmp:

% osrestore -f backup.img   eudyp:/test/data1.odb   eudyp:/tmp
restoring "::eudyp:/test/data1.odb" to "::eudyp:/tmp/data1.odb" 

Restoring to source with one exception

Restore everything in the /test directory on Server eudyp to its original location except data1.odb, which gets restored in the /example directory on Server cleopat.

% osrestore -f backup.img eudyp:/test/data1.odb   cleopat:/example 
\ eudyp:/test   eudyp:/test
restoring "::eudyp:/test/data1.odb" to "::cleopat:/example/data1.odb"   
restoring "::eudyp:/test/data2.odb" to "::eudyp:/test/data2.odb"
restoring "::eudyp:/test/data3.odb" to "::eudyp:/test/data3.odb"
In this example, the order of the pathname translations is important. Specify specific pathnames before you specify directories that include those pathnames.

Restoring to source

Restores the entire backup image to its original location.

% osrestore -f backup.img
restoring "::eudyp:/test/data1.odb" to "::eudyp:/test/data1.odb" 
restoring "::eudyp:/test/data2.odb" to "::eudyp:/test/data2.odb" 
restoring "::eudyp:/test/data3.odb" to "::eudyp:/test/data3.odb" 
restoring "::cleopat:/results/r1.odb" to "::cleopat:/results/r1.odb" 
restoring "::cleopat:/results/r2.odb" to "::cleopat:/results/r2.odb" 
restoring "::cleopat:/results/r3.odb" to "::cleopat:/results/r3.odb" 

Restoring all to a local directory

Restores the entire backup image into the /examples directory on the local host (twinkie).

% osrestore -f back.img eudyp:/test /examples    cleopat:/results 
/examples
restoring "::eudyp:/test/data1.odb" to "::twinkie:/examples/data1.odb" 
restoring "::eudyp:/test/data2.odb" to "::twinkie:/examples/data2.odb" 
restoring "::eudyp:/test/data3.odb" to "::twinkie:/examples/data3.odb" 
restoring "::cleopat:/results/r1.odb" to "::twinkie:/examples/r1.odb" 
restoring "::cleopat:/results/r2.odb" to "::twinkie:/examples/r2.odb" 
restoring "::cleopat:/results/r3.odb" to "::twinkie:/examples/r3.odb" 

API

None



[previous] [next]

Copyright © 1999 Object Design, Inc. All rights reserved.

Updated: 03/11/99 11:19:07