Created
April 18, 2011 13:47
-
-
Save ruslander/925367 to your computer and use it in GitHub Desktop.
MS Sql Backup, Restore script
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
=========== BACKUP | |
USE master; | |
BACKUP DATABASE [Ecp] | |
TO DISK = N'C:\dbbackups\ecp.Bak' WITH NOFORMAT, NOINIT, | |
NAME = N'Ecp-Full Database Backup', SKIP, NOREWIND, NOUNLOAD, STATS = 10 | |
=========== RESTORE | |
USE master; | |
ALTER DATABASE [Ecp] SET OFFLINE WITH | |
ROLLBACK IMMEDIATE | |
GO | |
RESTORE DATABASE [Ecp] | |
FILE = N'Ecp' FROM DISK = N'C:\dbbackups\ecp.Bak' WITH FILE = 1, | |
NOUNLOAD, REPLACE, STATS = 10 | |
GO | |
ALTER DATABASE [Ecp] SET ONLINE | |
GO |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment