ALTER DATABASE failed because a lock could not be placed on database ‘{DatabaseName}’. Try again later.
Cause:
One or more processes regarding {DatabaseName}, also in sleeping status, are blocking your query
Solution:
Execute
[sourcecode lang=”sql”]EXEC sp_who2 –or sp_who[/sourcecode]
to know the list of SPIDs’ processes where DBName is {DatabaseName}
then execute the following command for each of them to kill these processes
[sourcecode lang=”sql”]KILL {SPIDNumber} –e.g. KILL 55[/sourcecode]
Now finally you can execute your query to ALTER the database.
Did my solution solve your problem? Leave a reply.