Bring mssql database online/offline

2 Feb

When trying to bring database offline, you may get this error:

ER DATABASE failed because a lock could not be placed on database ‘CJISData’. Try again later.
ALTER DATABASE statement failed. (Microsoft SQL Server, Error: 5061)

To bring the database back online, just use:


If you get error because of user logged in:

select spid from master..sysprocesses where dbid=db_id(‘XXX’);
kill spid;


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: