Created
September 30, 2013 18:39
-
-
Save jahanson/6768153 to your computer and use it in GitHub Desktop.
Restores a database from a .bak file.
This file contains 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
USE [master] | |
ALTER DATABASE [Portal_Sandbox] SET SINGLE_USER WITH ROLLBACK IMMEDIATE | |
RESTORE DATABASE [Portal_Sandbox] | |
FROM DISK = N'C:\Portal93013.bak' | |
WITH FILE = 1, | |
MOVE N'Portal' TO N'D:\Data Files\Portal_sandbox.mdf', | |
MOVE N'Portal_log' TO N'D:\Data Files\Portal_sandbox_log.ldf', | |
NOUNLOAD, REPLACE, STATS = 5 | |
GO | |
Backup to file command.
BACKUP DATABASE Portal
TO DISK = 'C:\Portal93013.bak'
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Runs on Microsoft SQL 2008 R2.