Is my Database consistent after running DBCC CHECKDB with ALLOW_DATA_LOSS

  • Dear All,

    I ran into a suspect database today. I followed the below steps to make it online

    1. Set database to EMERGENCY

    1. Run CHECKDB ( Now this step didn't return any consistency and allocation error)

    2. When I tried to take Database Online. It gave me error ( The log sequence -- doesn't match with data file)

    3. Then I tried to run DBCC CHECKDB with REPAIR_REBUILD ( It failed)

    3. Then I ran DBCC CHECKDB With REPAIR_ALLOW_DATA_LOSS ( I got a warning :--

    Warning:- The log for database 'DBName' has been rebuilt. Transactional consistency has been lost. The RESTORE chain was broken, and the server no longer has context on the previous log files.[/highlight]

    4. After running DBCC CHECKDB we again didn't find any consistency and allocation error.

    My concern here is as the CHECKDB has not returned any error, then have I lost any data after running REPAIR_ALLOW_DATA_LOSS ( Table, Index Data).

    Thanks in Advance.

  • Not from the checkDB, it just rebuilt the log. The concern is if there were any transactions (or partial transactions) that had been written to the log but not to the data file at the point that whatever happened to send the DB suspect happened.

    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
  • Thanks Gail,

    Because CheckDB didn't give any log error. Does this mean that CHECKDB never look for log file in its operation.

  • The error you gave does not mean the log is corrupt. Could be that the log and data file don't match, could be other causes 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
  • I got below error when I tried to take DB ONLINE :-

    The log scan number (8615:729:38) passed to log scan in database 'DBName' is not valid. This error may indicate data corruption or that the log file (.ldf) does not match the data file (.mdf).

    Error: 9003, Severity: 21, State: 15

  • Was that before or after you ran the repair?

    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
  • I got below error Before I ran Repair on my DB,when I tried to take DB ONLINE :-

    The log scan number (8615:729:38) passed to log scan in database 'DBName' is not valid. This error may indicate data corruption or that the log file (.ldf) does not match the data file (.mdf).

    Error: 9003, Severity: 21, State: 15

    The error came when I tried to take the DB Online, After CHECKDB ran successfully returning no errors.

  • iirc CheckDB doesn't check the log file. That is sever though, it will likely need a checkDB with repair allow data loss to rebuild the log.

    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
  • Thanks Gail,

    I did the same.

Viewing 9 posts - 1 through 8 (of 8 total)

You must be logged in to reply to this topic. Login to reply