Skip to content

Instantly share code, notes, and snippets.

@timothyclifford
Created August 25, 2011 13:27
Show Gist options
  • Save timothyclifford/1170653 to your computer and use it in GitHub Desktop.
Save timothyclifford/1170653 to your computer and use it in GitHub Desktop.
SQL restore locked DB
-- Get all the current SPID's
EXEC sp_who2
-- Kill a given SPID
KILL <SPID>
-- Set database offline
ALTER DATABASE <DATABASENAME> SET OFFLINE WITH NO_WAIT
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment