Search code examples
sql-server-2012recoverydisaster-recovery

sql server 2012 go to recovery mode take long time afte reboot


After rebooting server one of the database goes to mode In recovery . The log size is 117 Gig )

When I looked at errorlo the last message was:

2015-03-11 11:27:43.04 spid36s Recovery of database 'XXXx_DW' (10) is 3% complete (approximately 114050 seconds remain). Phase 2 of 3. This is an informational message only. No user action is required.

The only solution is waiting..? What happen if I restore latest backup to database, it will go online or not?. Any suggestion appreciated


Solution

  • First I would like to ask when you rebooted SQL Server did you made sure no job was running, no long running transactions were there, no user was running some transaction ?

    If you missed above point I would say you are not aware about how to shutdown SQL server, specially the production one.

    When you shutdown SQL Server all inflight transactions would be stopped/cancelled and when database comes online SQL Server crash recovery would happen and that is what happening in message

    Recovery of database 'XXXx_DW' (10) is 3% complete

    Recovery has three phases analysis, redo and undo. Database is completely accessible only after all three phases of recovery has completed. In fast recovery, which is enterprise feature, database comes online after REDO phase. Yes your only solution is waiting. All these phases are required to bring database to consistent state, unless it finds itself in consistent state database won't come online

    What happen if I restore latest backup to database

    At this point of time when database is in recovery you won't be allowed to perform restore on it as it is locked and wont allow access. You can restore the backup with diferent name though but i dont think there is any advantage in doing this.

    Moral of story: Dont just blindly reboot server.