Restoring your databases

Example 3 — Moving a user dbspace

Relative pathnames in the RENAME clause work as they do when you create a database or dbspace: the main IQ Store dbspace, Temporary Store dbspaces, and Message Log are restored relative to the location of db_file (the Catalog Store); user-created IQ Store dbspaces are restored relative to the directory that holds the main IQ dbspace.

If you are renaming files while restoring both full and incremental backups, be sure you use the dbspace names and paths consistently throughout the set of restores. It is the safest way to ensure that files are renamed correctly.

If a dbspace was added between the full backup and an incremental backup, and you are renaming database files, you need one more RENAME clause for the incremental restore than for the full restore. Similarly, if a dbspace was deleted between backups, you need one fewer RENAME clause for the restores from any backups that occurred after the dbspace was deleted.

See “Recording dbspace names” for information on how to obtain a list of the dbspace names in your database, so that you will know the correct names to include in RENAME clauses.

This example shows how you restore the full and incremental backups in example shown earlier in this chapter. In this case, media failure has made a UNIX raw partition unusable. The user-defined dbspace on that raw partition, IQ_USER, must be moved to a new raw partition, /dev/rdsk/c1t5d2s1. No other database files are affected.

First, you connect to the utility_db database. Then you restore the full backup from two tape devices. In this case they are the same two tape devices used to make the backup, but the devices could differ as long as you use the same number of archive devices, the same media type (tape or disk), and the same tape sets in the correct order, as described in “Restoring in the correct order”.

The first RESTORE command is:

RESTORE DATABASE ’asiquser’ FROM ’/dev/rmt/0n’

FROM ’/dev/rmt/1n’

RENAME IQ_SYSTEM_MAIN TO ’/dev/rdsk/c2t0d1s1’ RENAME IQ_SYSTEM_TEMP TO ’/dev/rdsk/c2t1d1s1’ RENAME IQ_SYSTEM_MSG TO ’asiquser.iqmsg’ RENAME IQ_USER TO ’/dev/rdsk/c1t5d2s1’

The second RESTORE command, to restore the incremental backup, is:

RESTORE DATABASE ’asiquser’ FROM ’/dev/rmt/0n’

RENAME IQ_SYSTEM_MAIN TO ’/dev/rdsk/c2t0d1s1’ RENAME IQ_SYSTEM_TEMP TO ’/dev/rdsk/c2t1d1s1’

402

Page 422
Image 422
Sybase 12.4.2 manual 402