Epic Puck

Ok, who locked the database?

by on Sep.09, 2011, under Coding, SQL

I work with six other developers. We don't have a SQL DBA per se. This means that sometimes my colleagues or even myself will have open SPIDs preventing a SQL RESTORE.

So, who locked the database?

select spid, status, loginame, hostname, blocked, db_name(dbid), cmd, *
 from master..sysprocesses where db_name(dbid) = 'database name'
Be Sociable, Share!
:database locked, open spid, sql, sql restore, sysprocesses, who locked the database

Comments are closed.

Looking for something?

Use the form below to search the site:

Still not finding what you're looking for? Drop a comment on a post or contact us so we can take care of it!