SQL Dumbass

Fighting dumbasses, one query at a time…

Locked out

We have an upgrade to an application being deployed and as part of the upgrade there is a database piece. The app team decides (rightfully) to make certain that no one tries to connect to the database while the upgrade is happening, and they tell their users to not use any apps that connect to the database. So far, so good.

Well, one account continues to open a connection, and no one has any idea about the account. I recognize it and point towards the person on a different team, as it is a service account used by a web pool to connect to the database. Unfortunately, it cannot be turned off anytime soon, as we do not host the servers making the connection. So, what to do?

I decide to put the db in single user mode, kill all connections, and have them run the upgrade. It fails, because the upgrade opens about thirty connections to the database. Why? Good question.

I decide to switch the database to dbo use only, take it out of single user mode, and have them run the upgrade. Before the upgrade starts, that service account connects again. Turns out the account is a sys admin. Why? Good question.

We remove the service account from sys admin and try to get things going again. It reconnects. Since it is not a sys admin, and not a dbo, and not an alias, we are stumped as to how it can connect. You would think that I would know the answer as to how it is getting in, but I don’t. Suddenly, my colleague realizes that we could lock the accounts.

Lock the account! Why did i not think of that! We lock a few accounts, just to be safe, and the upgrade gets underway, only a few hours later than desired.