The RESTORE statement

To restore a database, see the syntax in RESTORE statement in Chapter 1, “SQL Statements,” in Reference: Statements and Options. The statement also describes requirements for restoring read-only and read-write files and dbspaces.

Remember that you must be connected to the utility_db database as DBA to issue this statement.

You must specify the db_file and at least one archive_device.

For db_file you specify the location of the catalog store file for the database (created with the suffix .db by default). You can specify the full pathname or a pathname relative to the directory where the database was created. If you specify a new pathname, the catalog store and any files created relative to it are moved to that location, except for any files you include in a RENAME clause.

Just as for backup, each archive_device specifies the API (third party) and, for the Sybase API, the physical tape device or disk file name from which you are restoring. For third-party APIs, the content of the archive_device string depends on your vendor. The archive device must not be a raw disk device. When you restore from disk files using the Sybase API, you must supply the same number of archive devices as were specified when this backup was created.

WARNING! If you misspell a tape device name and give a name that is not a valid tape device on your system, RESTORE assumes it is a disk file and tries to read from it.

See “Specifying archive devices” for details on specifying devices.

NoteIf you are restoring from tape devices on Windows, note that you do not need to redouble the backslashes when you specify tape devices for restore, as you did for backup.

Example 1 — Restoring to the same location

This Windows example restores a database to iquser.db. The database is restored from two disk files. All database files are restored to their original locations.

RESTORE DATABASE 'iquser.db'
FROM 'c:\\iq\\backup1'
FROM 'c:\\iq\\backup2'

For examples of restores of read-write and read-only files, see RESTORE statement in Chapter 1, “SQL Statements,” in Reference: Statements and Options.