views:

35

answers:

1

I have a SQL Server 2008 database and I have a problem with this database that I don't understand.

The steps that caused the problems are:

  • I ran a SQL query to update a table called authors from another table called authorAff
  • The authors table is 123,385,300 records and the authorsAff table is 139,036,077
  • The query took about 7 days executing but it didn't finish
  • I decided to cancel the query to do it another way.
  • The connection on which I was running the query disconnected suddenly so the database became in recovery until the query cancels
  • The server was shut down many times afterwards because of some electricity problems
  • The database took about two days and then recovered.
  • Now when I run this query

    SELECT TOP 1000 * FROM AUTHORS WITH(READUNCOMMITTED)

It executes and returns the results but when I remove WITH(READUNCOMMITTED) hint it gets locked by a process running on the master database that appears only on the Activity Monitor with Command [DB STARTUP] and no results show up. so what is the DB STARTUP command and if it's a problem, how can I solve it?

Thank you in advance.

+2  A: 

I suspect that your user database is still trying to rollback the transaction that you canceled. A general rule of thumb indicates that it will take about the same amount of time, or more, for an aborted transaction to rollback as it has taken to run.

The rollback can't be avoided even with the SQL Server stops and starts you had.

The reason you can run a query WITH(READUNCOMMITTED) is because it's ignoring the locks associated with transaction that is rolling back. Your query results are considered unreliable, but ironically, the results are probably what you want to see since the blocking process is a rollback.

The best solution is to wait it out, if you can afford to do so. You may be able to find ways to kill the blocking process, but then you should be concerned with database integrity.

bobs