2

On a test box I wanted to get an idea of how long adding an identity field would take to a table with roughly a half billion rows. The process ran for about 10 hours and we noticed it was getting dangerously low on disk space on the lun for the log.

We addressed the log disk space issue by removing some other items but I'm afraid we might have been too late as it got down to like 10MB.

Is there a way to know immediately if the query began rolling back the alter table statement due to insufficient space? I know a transaction that has had a rollback will show up in sp_who with a status of rollback. I also know a transaction that was purposely killed will have a status of killed/rollback.

But, is there a way to know immediately if a process is being rolled back due to insufficient space before the rollback is complete and the message is returned to SSMS?

Looking at sp_WhoIsActive, sp_Who, sp_Who2 it still shows the original alter table as the command with a status of suspended - I'm concerned that it's actually rolling back however. Is there a way to tell? Am I mistaken and it would show up as rolling back like a killed spid would?

If it fails it fails, but I'd like to know if I'm moving forward or moving backwards.

RThomas
  • 3,446
  • 6
  • 30
  • 48

1 Answers1

2

We use sp_whoisactive which has a column called Status. When a query is rolling back you can see status = rollback. It also gives a percentage completion.

We're using SQL 2014, but I'm pretty sure the status was there on 2012 as well

Greg
  • 3,292
  • 5
  • 33
  • 57