Sometimes when you detach the database (while trying to detach the project collection database), it fell into the “Single User” mode thenyou are not able to do anything about it because its single user mode and other user has connected to it.

Root cause:

Single User mode


exec sp_dboption ‘tfs_DefaultCollection’, ‘single user’, ‘false’

select, d.dbid, spid, login_time, nt_domain, nt_username, loginame

from sysprocesses p inner join sysdatabases d on p.dbid = d.dbid
where = ‘tfs_DefaultCollection’

kill 51