Click here to view and discuss this page in DocCommentXchange. In the future, you will be sent there automatically.

SQL Anywhere 17 » SQL Anywhere Server - SQL Reference » SQL statements » Alphabetical list of SQL statements

RESTORE DATABASE statement

Restores a backed up database from an archive.

Syntax
RESTORE DATABASE filename
FROM archive-root
[ CATALOG ONLY 
  | [ RENAME dbspace-name TO new-dbspace-name ] ... ]
[ HISTORY { ON | OFF } ]
[ KEY encryption-key ]
filename : string | variable 
archive-root : string | variable 
new-dbspace-name : string | variable 
Parameters
  • FROM clause

    Use this clause to specify the location of the backup.

  • CATALOG ONLY clause

    Retrieves information about the named archive, and places it in the backup history file (backup.syb), but does not restore any data from the archive.

  • RENAME clause

    Allows you to specify a new location for each dbspace. You cannot use the RENAME clause to change the dbspace name. However, you can use the RENAME clause to change the file name.

  • HISTORY clause

    Allows you to control whether the RESTORE DATABASE operation is recorded in the history file, backup.syb.

  • KEY clause

    Allows you to specify the encryption key to restore an archived strongly encrypted database that was backed up with free page elimination on. If the back up was made with free page elimination off, then it is not necessary to specify the encryption key to restore the database. The key can be either a string or a variable name.

    As of version 12, you cannot restore archive backups created with version 11 or earlier database servers.

Remarks

Unless HISTORY OFF is specified, each RESTORE DATABASE operation updates a backup history file called backup.syb. This file records the BACKUP and RESTORE operations that have been performed on a database server. Consider preventing the RESTORE DATABASE operation from being recorded in backup.syb if the following conditions apply:

  • your RESTORE DATABASE operations occur frequently

  • there is no procedure to periodically archive or delete the backup.syb file

  • disk space is very limited

If disk sandboxing is enabled, then database operations are limited to the directory where the main database file is located.

RESTORE DATABASE replaces the database that is being restored. If you need incremental backups, use the image format of the BACKUP command and save only the transaction log; however.

During the execution of this statement, you can request progress messages.

You can also use the Progress connection property to determine how much of the statement has been executed.

You cannot be connected to the database you are restoring. You must be connected to a different database. For example, connect to the utility database. The database that you are encrypting must not be running.

Privileges

Your ability to execute this statement depends on the setting for the -gu database option, and whether you have the SERVER OPERATOR system privilege.

Side effects

None.

Standards
  • ANSI/ISO SQL Standard

    Not in the standard.