Transact-SQL Restore Examples

Listings 16.11 through 16.14 show some samples of restoring the database using T-SQL scripts.

Listing 16.11. Sample Script for a Full Database Recovery
--Restore northwind from the first backup on device nwbackup
-- Recover the database
USE MASTER
RESTORE DATABASE Northwind
FROM nwbackup
WITH FILE = 1,
RECOVERY
Listing 16.12. Sample Script for a Full and Log Recovery
-- Restore northwind from the first backup on device nwbackup
-- Restore two logs from device nwlogback
-- Recover the database
USE MASTER
RESTORE DATABASE northwind
FROM nwbackup
WITH FILE = 1,
NORECOVERY
GO
RESTORE LOG northwind
FROM nwlogback
WITH FILE = 1,
NORECOVERY
GO
RESTORE LOG northwind
FROM nwlogback
WITH FILE = 2,
RECOVERY
					
Listing 16.13. ...

Get Microsoft® SQL Server™ 2000 Unleashed, Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.