Restore a Transaction Log
Syntax RESTORE LOG {database | @database_var} file_or_filegroup_or_pages [ ,...f ] [FROM backup_device [ ,...n ] ] [WITH option [,option...]] [;] Options: {CHECKSUM | NO_CHECKSUM } {CONTINUE_AFTER_ERROR | STOP_ON_ERROR } FILE = { backup_set_file_number | @backup_set_file_number } KEEP_REPLICATION MEDIANAME = { media | @media_variable } MEDIAPASSWORD = { mediapassword | @mediapw_variable } MOVE 'logical_file_name_in_backup' TO 'operating_system_file_name' [ ,...n ] PASSWORD = { password | @password_variable } ] {RECOVERY | NORECOVERY | STANDBY = {standby_file_name | @standby_file_name_var } } REPLACE RESTART RESTRICTED_USER {REWIND | NOREWIND } {UNLOAD | NOUNLOAD } STATS [ = percentage ] { STOPAT = { date_time | @date_time_var } | STOPATMARK = { 'mark' | 'lsn:lsn_number' } [ AFTER datetime ] | STOPBEFOREMARK = { 'mark' | 'lsn:lsn_number' } [ AFTER datetime ] } backup_device: logical_backup_device @logical_backup_device_var {DISK | TAPE } = 'physical_backup_device' {DISK | TAPE } = @physical_backup_device_var file_or_filegroup_or_pages:
FILE = {logical_file_name_in_backup | @logical_file_name_in_backup_var}
FILEGROUP = {logical_filegroup | @logical_filegroup_var}
PAGE = 'fileID:pageID [ ,...p ]'
Key:
DATABASE - The target database.
FROM backup_device - The backup device from which to restore.
CHECKSUM - verify all backup checksums (or fail)
NO_CHECKSUM - Disable validation of checksums
FILE - The backup set to be restored (text string)
KEEP_REPLICATION - Retain replication settings for log shipping. Recover a warm standby.
MEDIANAME - Specify the name for the media, check for a matching media name on the backup volume.
MOVE - The data or log file (logical name) should be moved by restoring it to the file location specified.
RECOVERY- After the restore, roll back any uncommitted transactions.
NORECOVERY- Do not roll back any uncommitted transactions. Use if applying another tx log later.
STANDBY - Specify a standby (undo) file that allows the recovery to be undone, for offline restore only.
REPLACE - Overwrite any existing database with the same name.
RESTART - Restart a restore operation that has been interrupted.
RESTRICTED_USER - Restrict access to the newly restored db to the db_owner, dbcreator, or sysadmin roles.
UNLOAD - Automatically rewind and unload the backup tape when the backup is finished.
STATS - Display a message each time n percentage completes.
STOPATMARK - Recover to a marked transaction or log sequence number
STOPBEFOREMARK - Recover to a marked transaction or log sequence number
FILE - Logical filename in backup (number)
FILEGROUP - Logical filegroup
PAGE - Page restore (full recovery only)
Examples
RESTORE DATABASE SS64
FROM SS64_1
WITH NORECOVERY
RESTORE LOG SS64
FROM SS64Log1
WITH RECOVERY
"The desire for safety stands against every great and noble enterprise" - Cornelius Tacitus
Related commands:
Complete Restore - an Entire Database from a Full database backup.
Partial Restore - part of database/point in time
Restore Files - Files, Filegroups, or Pages
RESTORE DATABASE_SNAPSHOT
RESTORE FILELISTONLY - List database and log files
RESTORE VERIFYONLY - Verify the backup but don't restore it
BACKUP
Equivalent Oracle command: RMAN - Recovery Manager