Skip to content

Instantly share code, notes, and snippets.

@hoangitk
Last active August 29, 2015 14:09
Show Gist options
  • Select an option

  • Save hoangitk/ca1f0493abdd5fcf3f0a to your computer and use it in GitHub Desktop.

Select an option

Save hoangitk/ca1f0493abdd5fcf3f0a to your computer and use it in GitHub Desktop.
Restore db from bak file
-- check list files
RESTORE FILELISTONLY
FROM DISK = '<backup db file>.bak'
-- Restore
RESTORE DATABASE [<new db name>]
FROM DISK = N'<backup db file>.bak'
WITH FILE = 1,
MOVE N'<DataLogicalName>' TO N'<new path>\<DB_data>.MDF',
MOVE N'<LogLogicalName>' TO N'<new path>\<DB_log>.LDF',
NOUNLOAD, STATS = 10
GO
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment