SQL SERVER – Script to Kill All Inactive Sessions – Kill Sleeping Sessions from sp_who2

I consider myself fortunate that I get to work with so many different clients while engaged in Comprehensive Database Performance Health Check. Recently we found out that one of the third party application for the client is not closing the connections which they open after completing the transactions. This was negatively affecting their performance. We immediately opened the ticket with the third party application and while they provide the solution after patching the application we decided to kill all the inactive sessions.

Read More

SQL SERVER – 5061: FIX Error: ALTER DATABASE failed because a lock could not be placed on database ‘Database Name’. Try again later.

Every consulting engagement is different and I get to learn new things. In this blog post, I will share what I learned during my recent Comprehensive Database Performance Health Check. During health check to demonstrate one of the scenarios we had created a test database in our environment. However, after the test was complete we wanted to take the database offline so we eventually can drop it or bring it online if needed, however, as soon as we ran the command to take database offline, it gave is an error related to alter database failed because a lock could not be placed on database.

Read More