Tuesday, January 4, 2011

Stuck Database – the JOY!

I was playing with extending Fluent Migrator and wanted to check what was left in my DB after the last try.

Trying to open the tables sub folder gave me this error:

 

So I tried taking the DB offline and got stuck with:

image

Closing that window and trying to open the DB again got me:

image

So I have decided to go brutal, I opened Computer Management->Services and Applications->Services and stopped the SQL Server (MSSQLSERVER) service:

image

And then started it again (I like to give it a few second to relax then doing the restart).

Now reconnecting to the DB works.

 

But what about the bug that caused all of this?

I tried the test again, but this time tried to open the Tables folder at the same time:

image

The test is stuck on:

image

 

What I found out?

The test is stuck when trying to open a workspace to the SDE. But (this time) I don't blame ESRI because it seems the current connection to SQL doesn't allow any other connection – I can't even open SQL Server Management.

What I found in the code?

Fluent Migrator opens a connection and then begins a transaction – and closes it only when all the "StepUp"s are complete. While I want to open a SDE connection in the middle of that transaction – and get stuck doing it.