Last active
August 29, 2015 14:09
-
-
Save hoangitk/ca1f0493abdd5fcf3f0a to your computer and use it in GitHub Desktop.
Restore db from bak file
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| -- 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