Quantcast
Channel: My Errors & My Solutions
Viewing all articles
Browse latest Browse all 123

ALTER DATABASE failed because a lock could not be placed on database

$
0
0

My Errors & My Solutions
My Errors & My Solutions - It Could Happen To You

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

EXEC sp_who2  --or sp_who

to know the list of SPIDs’ processes where DBName is {DatabaseName}
then execute the following command for each of them to kill these processes

KILL {SPIDNumber}  --e.g. KILL 55

Now finally you can execute your query to ALTER the database.

Did my solution solve your problem? Leave a reply.

ALTER DATABASE failed because a lock could not be placed on database
Sergio Castelluccio


Viewing all articles
Browse latest Browse all 123