WSUS: Unable to Take WSUS SQL DB offline or Dettach (SQL Locks)

by butsch 1. April 2015 15:55

We mainly have seen this on Small Business Servers SBS. We migrated WSUS to a standalone Server and wanted to remove the SBS integrated WSUS Server.


Problem 1:

WSUS Database lock prevents handling of SQL DB from Windows Update Server.


ALTER DATABASE failed because a lock could not be placed on database 'SUSDB'. Try again later.

Unable to Uninstall WSUS Server Components after migrated to other server on old Server. (Sample SBS)

First task Stop Services:

Click Start, point to Programs, point to Administrative Tools, and then click Services.

Right-click IIS Admin Service, and then click Stop.

Right-click Update Services, and then click Stop.

Problem 2:

Still you are unable to take the DB offline. Mostly this was because the DB reaches some SQL Limit 2/20GB etc.


There where locks on the SQL DB.

The lock means that the DB is unstable and should not be touched in this case. Because we don't need it anymore (After WSUS was migrated to new Server) you can kill the process in SQL Management studio.


Here is how to connect to WSUS Database on Server 2003/2008R2 and 2012R2

Auf 2003:     \\.\pipe\MSSQL$MICROSOFT##SSEE\sql\query

Auf 2012R2:    \\.\pipe\microsoft##WID\tsql\query



Or with SQLCMD:


sqlcmd -S np:\\.\pipe\MSSQL$MICROSOFT##SSEE\sql\query

use master

alter database SUSDB set single_user with rollback immediate


sp_detach_db SUSDB



ERROR: ALTER DATABASE failed because a lock could not be placed on database 'SUSDB'. Try again later.


Here is how to solve this:


Shows current locks

exec sp_who2

Shows the sessions locks that are on the SQL-Express DB.

Then kill all locks which are stuck.

Example Kills Lock with SPID 57:

kill 57

kill 56

You should be able to Dettach the Database now and clean up the WSUS.


Some external Links:


Comments are closed

Werbung von Drittfirmen (Nicht Butsch Informatik):

Werbung von Drittfirmen via Google Adsense: