SH Latch

  • Hi,

    After a disk failure we had a corruption on a live database, we did have backups and was able to perform a restore to bring everything back online so restores not a problem, however a question over the type of corruption and is purely educational.

    First CHECKDB results: Msg 0, Level 11, State 0, Line 0

    A severe error occurred on the current command. The results, if any, should be discarded.

    At this point I know this is probably going to be an unrecoverable corruption but will try, next is to run DBCC CHECKTABLE (only 5 tables in this DB) which runs ok except on one which returns:

    Msg 8966, Level 16, State 2, Line 1

    Unable to read and latch page (1:79912) with latch type SH. Latch failed.

    Msg 8966, Level 16, State 2, Line 1

    Unable to read and latch page (1:79913) with latch type SH. Latch failed.

    Msg 8966, Level 16, State 2, Line 1

    Unable to read and latch page (1:79914) with latch type SH. Latch failed.

    Msg 8966, Level 16, State 2, Line 1

    Unable to read and latch page (1:79915) with latch type SH. Latch failed.

    So looks like corruption across just 4 pages, after running DBCC PAGE I was able to find the range of data (about 121 rows) which it couldn’t read. Now I have tried deleting those rows but get a timeout error as it can’t create a latch on the pages, can’t update or do any modifications.

    I do have those pages in the restored database but because the database is in simple mode, page restore isn’t an option and DBCC repair_allow_data_loss doesn’t remove the corruption either.

    Any other idea on how you could get the delete not to use a SH lock or bypass it? Like I said this is only educational, the database was restored from backup awhile ago.

  • I do have those pages in the restored database but because the database is in simple mode, page restore isn’t an option and DBCC repair_allow_data_loss doesn’t remove the corruption either.

    The database should be in full or bulk_logged recovery model in order to perform a page restore.

    See Requirements for page restoring on this link http://technet.microsoft.com/en-us/library/ms175168(v=sql.105).aspx and this link too: http://technet.microsoft.com/en-us/library/ms175168.aspx

    Regards,

    IgorMi

    Igor Micev,My blog: www.igormicev.com

  • You can't bypass latches, they are essential for physical protection of the page. Besides, the latch error is a symptom of the corruption, not a cause. If you could bypass the latch (which you can't), you'd get other errors.

    Copy the good data out and truncate the table. Truncating doesn't need to read the pages, therefore doesn't encounter the corrupt pages.

    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

Viewing 3 posts - 1 through 2 (of 2 total)

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