Pages

Saturday, June 1, 2013

How to apply RESTORE checks on database backup files?

Execute the following Microsoft SQL Server T-SQL script to demonstrate the restore command variations for checking the content of a database backup file: 
USE master;

restore headeronly from disk='F:\data\backup\inventorydb.bak'

restore filelistonly from disk='F:\data\backup\inventorydb.bak'

restore labelonly from disk='F:\data\backup\inventorydb.bak'

restore verifyonly from disk='F:\data\backup\inventorydb.bak'

-- RESTORE DATABASE to a new location syntax
RESTORE DATABASE [NEWAdventureWorks] FROM  DISK = N'F:\temp\AW.bak'
WITH  -- FILE = 6, 
MOVE N'AdventureWorks_Data' TO N'F:\data\AW.mdf', 
MOVE N'AdventureWorks_Log' TO N'F:\data\log\AW8.ldf', 
NOUNLOAD,  STATS = 10
GO
------------

No comments:

Post a Comment