Backing Up and Restoring Databases
Page 4 of 4

Restoring from a Backup

To restore a database for which both of the following are true:

  • The log is in the default location
  • There is no logDevice entry in the service.properties file governing the location to which the database is being restored

simply copy the backed-up database directory to the appropriate location and boot the database normally. Once the database has been booted, you may want to run a consistency check if time permits. (See Chapter 11, "Checking Database Consistency".)

NOTE: When copying a backed-up database to its new location, make sure there is not already a database of the same name there.

Here is an example that uses Windows NT operating system commands to restore a backup of toursDB to the directory d:\mydatabases:

rmdir d:\mydatabases\toursDB /s

xcopy c:\mybackups\1999-01-01\toursDB d:\mydatabases\toursDB /s /i

NOTE: This example uses commands specific to the Windows NT operating system. Use commands appropriate to your operating system to copy a directory and all contents to a new location.

Restoring a Database When the Log Is in a Non-Default Location

When You Backed up with Cloudscape's Built-In Backup Command

When you back up a database whose log is in a non-default location, in the backup itself Cloudscape puts the log in the default location. When you restore the database from such a backup, if you wish to put the log back in a non-default location, you will have to move the log by hand. Follow the instructions in Chapter 13, "Logging on a Separate Device" for moving a log by hand.

When You Backed up with Operating System Commands

If the database log is not in the default location, or if a logDevice entry is specified in the service.properties file governing the location to which the database is being restored, make sure the logDevice entry and the new log location correspond. Once they correspond, simply copy the database to the desired location and boot it normally.

To make the logDevice entry and the log location correspond, do one of the following:

  • Move the log to the location indicated by the logDevice property.
  • Alter the logDevice entry in service.properties to correspond to the log location.
  • Change both the new log location and logDevice property to represent the same location.
  • Move the log to the default location and delete the logDevice entry in service.properties.

Here is an example:

  1. Move the backup to the desired location for the database.

    xcopy c:\mybackups\1999-01-03\toursDB d:\mydatabases\toursDB /s /i

  2. Copy the backup of the log to the desired location.

    xcopy c:\mybackups\1999-01-03\toursDB\log h:\janets\tourslog\log /s /i

  3. Edit the service.properties file to reflect the correct location for the log:

    logDevice=H:/janets/tourslog