Guest User

Untitled

a guest
Jun 18th, 2018
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.45 KB | None | 0 0
  1. /* 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. */
  2.  
  3. ALTER DATABASE [database_name] SET SINGLE_USER WITH ROLLBACK IMMEDIATE
  4. RESTORE DATABASE [database_name]
  5. FROM DISK = N'C:\path\to\backup\backupfile.bak'
  6. WITH FILE = 1, KEEP_REPLICATION, NOUNLOAD, REPLACE, STATS = 10
  7. GO
Add Comment
Please, Sign In to add comment