系统断定检查已失败。有关详细信息,请查看 SQL Server 错误日志

【1】报错信息

运行删除时报错

 

操作的删除语句:

IF OBJECT_ID('tempdb..#temp_Robot') IS NOT NULL  
DROP TABLE #temp_Robot  
  
CREATE TABLE #temp_Robot(UserID INT NOT NULL PRIMARY KEY)  
select * from #temp_robot
    
INSERT INTO #temp_Robot SELECT UserID FROM Db_Tank..Sys_Users_Order WHERE IsRobot IN (1,3)  
DELETE FROM #temp_Robot WHERE UserID IN (SELECT UserID FROM Db_Tank..Sys_Users_Detail WHERE ConsortiaID>0) 

--核心语句在这里
DELETE Db_Tank..Sys_Users_History WHERE UserID IN (SELECT UserID FROM #temp_Robot)

报错信息:

Location: lckmgr.cpp:9421
Expression:    NULL == m_lockList.Head ()
SPID:    56
Process ID:    5972
Location:    "xact.cpp":2630
Expression:    !m_updNestedXactCnt
SPID:    56
Process ID:    5972
Description:    Trying to use the transaction while there are 1 parallel nested xacts outstanding
Location:    "xact.cpp":2788
Expression:    !m_updNestedXactCnt
SPID:    56
Process ID:    5972
Description:    Trying to use the transaction while there are 1 parallel nested xacts outstanding
Location:    "xact.cpp":3851
Expression:    !m_parNestedXactCnt
SPID:    56
Process ID:    5972
Description:    Trying to use the transaction while there are 7 parallel nested xacts outstanding
Location:    "xact.cpp":2879
Expression:    !m_updNestedXactCnt
SPID:    56
Process ID:    5972
Description:    Trying to use the transaction while there are 1 parallel nested xacts outstanding
消息 3624,级别 20,状态 1,第 1 行
系统断定检查已失败。有关详细信息,请查看 SQL Server 错误日志
消息 0,级别 20,状态 0,第 0 行
当前命令发生了严重错误。应放弃任何可能产生的结果。

系统日志报错:

      

【2】排查办法

  (1)使用select count(1) from Db_Tank..Sys_Users_History

    发现也是卡顿,连查询都不能查,明显有问题啊。count(1) 探索的是聚集索引列

扫描二维码关注公众号,回复: 8405886 查看本文章

  (2)查看表结构 sp_help Sys_Users_History

    

   只有一个userid的聚集索引,正好我们删除也是用它来关联的。估计问题就出在这里了。

  当然,这只是经验之谈,如果没什么经验的朋友建议运行DBCC CHECKDB 检查一下这个库。

【3】解决办法,重建索引

use db_tank
go
alter index PK_Sys_Users_History on Sys_Users_History rebuild

OK,搞定!

【4】总结

  出了问题不要慌,要想办法定位原因,然后得以解决

  

猜你喜欢

转载自www.cnblogs.com/gered/p/12144516.html