Click here to monitor SSC
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


SH Latch


SH Latch

Author
Message
kyleheath33
kyleheath33
SSC Veteran
SSC Veteran (207 reputation)SSC Veteran (207 reputation)SSC Veteran (207 reputation)SSC Veteran (207 reputation)SSC Veteran (207 reputation)SSC Veteran (207 reputation)SSC Veteran (207 reputation)SSC Veteran (207 reputation)

Group: General Forum Members
Points: 207 Visits: 811
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.
Igor Micev
Igor Micev
SSCarpal Tunnel
SSCarpal Tunnel (4.2K reputation)SSCarpal Tunnel (4.2K reputation)SSCarpal Tunnel (4.2K reputation)SSCarpal Tunnel (4.2K reputation)SSCarpal Tunnel (4.2K reputation)SSCarpal Tunnel (4.2K reputation)SSCarpal Tunnel (4.2K reputation)SSCarpal Tunnel (4.2K reputation)

Group: General Forum Members
Points: 4158 Visits: 4843

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,SQL Server developer at Seavuswww.seavus.com
GilaMonster
GilaMonster
SSC-Forever
SSC-Forever (47K reputation)SSC-Forever (47K reputation)SSC-Forever (47K reputation)SSC-Forever (47K reputation)SSC-Forever (47K reputation)SSC-Forever (47K reputation)SSC-Forever (47K reputation)SSC-Forever (47K reputation)

Group: General Forum Members
Points: 47137 Visits: 44346
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


Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search