SQL Server Performance

Corrupted Log File

Discussion in 'SQL Server 2008 Questions [Archive Only - Closed]' started by Akthar, Jan 8, 2009.

  1. Akthar New Member

    Guys,
    Recently i came across a situation where the log file of an SQL Server Std 2008 database got corrupt. i was unable to view the database properties and contents.
    I did the following:
    1. Detach the corrupted database
    2. Create a new Database with the same Name, and same data file name
    3. Stop Sql Server service
    4. Replace the new data file with the Old file
    5. Start SQL Server
    6. Database is started in Suspect Mode
    7. Set the Databse in Emergency Mode
    8. Set Database in Single User Mode
    8. Run DBCC CheckDB Repair Allow Data Loss
    9. ReStart SQL Server Service
    10. Set the DB back to MultiUser Mode.
    Hope this helps.


  2. ghemant Moderator

    Thanks for sharing the workaround with us....
  3. gurucb New Member

    But you will have to be aware of the implications of it. Since a new log file is being built for the new database the recovery process will not occur and data may not consistent (business aspect) always. Though ofcourse this is the only way possible.
  4. satya Moderator

  5. Balal Ahmad New Member

    this worked for me

    EXEC sp_resetstatus "yourDBname";

    ALTER DATABASE "yourDBname" SET EMERGENCY

    DBCC checkdb("yourDBname")

    ALTER DATABASE "yourDBname" SET SINGLE_USER WITH ROLLBACK IMMEDIATE

    DBCC CheckDB ("yourDBname", REPAIR_ALLOW_DATA_LOSS)

    ALTER DATABASE "yourDBname" SET MULTI_USER

    i create the db with same name , stop sqlservice and replace both db and log file and then run this
  6. Luis Martin Moderator

    Welcome to the forums!.
    This thread is 2 years old.
    Anyway thanks for sharing.:)

Share This Page