• Vertigo44 (12/29/2011)


    Is there a way for me to tell if the database was cleanly shutdown or not? I know that the state is 'RECOVERY PENDING' since the LDF file is missing.

    I can tell you outright that is was not shut down cleanly. If it had been, it would not be in recovery pending right now. Also, straight from the error log that you posted:

    2011-12-26 19:31:13.26 spid16s FileMgr::StartLogFiles: Operating system error 2(The system cannot find the file specified.) occurred while creating or opening file 'D:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Data\EMR_log.ldf'. Diagnose and correct the operating system error, and retry the operation.

    2011-12-26 19:31:13.32 spid16s File activation failure. The physical file name "D:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Data\EMR_log.ldf" may be incorrect.

    2011-12-26 19:31:13.32 spid16s The log cannot be rebuilt because the database was not cleanly shut down.

    I want to make sure I do things in the right order to better my chances of restoring the MDF file and creating a new MDF file.

    You're not trying to create a new MDF

    ALTER DATABASE emergencydemo SET SINGLE_USER;

    GO

    DBCC CHECKDB (emergencydemo, REPAIR_ALLOW_DATA_LOSS) WITH NO_INFOMSGS;

    GO

    I already posted the steps for you.

    GilaMonster (12/27/2011)


    Switch the database to emergency mode, then to single user mode, run checkDB with the repair_allow_data_loss option. It will lose data, it may not work. If it doesn't work, there's no further alternatives, this is the very last resort.

    That's the exact steps that Paul's blog post gives too.

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass