Created
October 20, 2010 01:33
-
-
Save adamvduke/635585 to your computer and use it in GitHub Desktop.
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
/* Forces exclusive access to a database allowing a restore and subsequently restores the database from a backup file. This will interrupt any existing connections and rollback any in progress transactions. Use at your own risk. */ | |
ALTER DATABASE [database_name] SET SINGLE_USER WITH ROLLBACK IMMEDIATE | |
RESTORE DATABASE [database_name] | |
FROM DISK = N'C:\path\to\backup\backupfile.bak' | |
WITH FILE = 1, KEEP_REPLICATION, NOUNLOAD, REPLACE, STATS = 10 | |
GO |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment