Restores a backed up database from an archive.
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
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 you do not need to specify the encryption key to restore the database.
Archive backups created with version 12 database servers cannot be restored with version 11 or earlier database servers.
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. You may want to prevent 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
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, image backups to tape are not supported.
During the execution of this statement, you can request progress messages. See progress_messages option.
You can also use the Progress connection property to determine how much of the statement has been executed. See Progress connection property.
The permissions required to execute this statement are set on the server command line, using the -gu option. The default setting is to require DBA authority. See -gu dbeng12/dbsrv12 server option.
This statement is not supported on Windows Mobile.
None.
SQL/2008 Vendor extension.
Windows Mobile Not supported on Windows Mobile.
The following example restores a database from a tape drive. The number of backslashes that are required depends on which database you are connected to when you execute RESTORE DATABASE. The database affects the setting of the escape_character option. It is normally set to On, but is set to Off in utility_db. When connected to any database other than utility_db, the extra backslashes are required.
RESTORE DATABASE 'd:\\dbhome\\mydatabase.db' FROM '\\\\.\\tape0'; |
Discuss this page in DocCommentXchange.
|
Copyright © 2010, iAnywhere Solutions, Inc. - SQL Anywhere 12.0.0 |