Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* 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
Add Comment
Please, Sign In to add comment