SQL Server:如何杀死-3 SPID?

pla*_*ton 11 sql-server kill spid

有关积极SPIDs和均匀的大量信息-1,-2但我没有找到任何信息Blocked By -3.有人能帮忙吗?

GUID是全0,而当我运行sp_who2MASTER分贝它显示SPID56RUNNABLEtempdb当我尝试,但kill它还是运行sp_who2tempdb它没有显示出来,而MASTERtempdb sp_who2实例都是SPID 54.

编辑:运行时,SELECT * FROM sys.sysprocesses WHERE spid = 56这是被阻止的SPID的输出:

spid    56
kpid    10500
blocked -3
waittype    0x0006
waittime    313816
lastwaittype    LCK_M_IS                        
waitresource    TAB: 5:1668253048:0                                                                                                                                                                                                                                             
dbid    5
uid 1
cpu 0
physical_io 0
memusage    4
login_time  02:44.3
last_batch  02:44.5
ecid    0
open_tran   0
status  suspended                     
sid 0x0105000000000005150000003DBE35AE805F26A82A34E78AE903000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
hostname    DESKTOP-JOS7UMG                                                                                                                 
program_name    Microsoft SQL Server Management Studio - Query                                                                                  
hostprocess 11364
cmd SELECT
net_library LPC                                                                                                
context_info    0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
sql_handle  0x01000500C609543A909F01271002000000000000
stmt_start  124
stmt_end    356
request_id  0
Run Code Online (Sandbox Code Playgroud)

EDIT2:当运行select req_transactionUOW from master..syslockinfo where req_spid = [SPID Number]KILL '[UOW Number]',输出req_transationUOW出现全0和杀害时,我得到以下错误:

The distributed transaction with UOW {00000000-0000-0000-0000-000000000000} does not exist.
Run Code Online (Sandbox Code Playgroud)

编辑3:当我运行select * from sys.dm_exec_requests下面的行是输出.我能在这里做kill什么吗?SPID不会解锁表格,我不想在崩溃服务器的情况下不顾一切地杀死所有东西.

session_id  59
request_id  0
start_time  10:23.4
status  suspended
command SELECT
sql_handle      0x020000007509B2241E0ED80CA5FE2A1542C26EF873795AB30000000000000000000000000000000000000000
statement_start_offset  0
statement_end_offset    68
plan_handle 0x060005007509B224D06FB16B1002000001000000000000000000000000000000000000000000000000000000
database_id 5
user_id 1
connection_id   E63659D9-A41B-4FAE-89B2-6026AE51B938
blocking_session_id -3
wait_type   LCK_M_IS
wait_time   4246
last_wait_type  LCK_M_IS
wait_resource   OBJECT: 5:1668253048:0 
open_transaction_count  0
open_resultset_count    1
transaction_id  374312
context_info    0x
percent_complete    0
estimated_completion_time   0
cpu_time    0
total_elapsed_time  4247
scheduler_id    3
task_address    0x0000021236EC8108
reads   0
writes  0
logical_reads   2
text_size   2147483647
language    us_english
date_format mdy
date_first  7
quoted_identifier   1
arithabort  1
ansi_null_dflt_on   1
ansi_defaults   0
ansi_warnings   1
ansi_padding    1
ansi_nulls  1
concat_null_yields_null 1
transaction_isolation_level 2
lock_timeout    -1
deadlock_priority   0
row_count   1
prev_error  0
nest_level  0
granted_query_memory    0
executing_managed_code  0
group_id    2
query_hash  0x496ED8C805DE7CAA
query_plan_hash 0x36444CF46922D91E
statement_sql_handle    NULL
statement_context_id    NULL
dop 1
parallel_worker_count   NULL
external_script_request_id  NULL
Run Code Online (Sandbox Code Playgroud)

Mar*_*ith 2

-3 spid 是“延迟事务”。

\n

在数据库恢复期间,SQL Server 遇到一个活动事务,由于某些 IO 问题而无法回滚。因此,在数据库恢复期间为此事务获取的锁永远不会被释放,并且与会话相关联-3

\n

你无法消除这个问题,你需要解决根本问题。有关此问题的解决方案,请参阅“将事务移出 DEFERRED 状态”。下面列出了这些要点,以提供快速概述和一些防止链接失效的保护措施,但是......

\n

\xe2\x9a\xa0\xef\xb8\x8f 注意!其中一些可能会导致数据丢失!在尝试此操作之前,请参阅链接的文章以了解重要的其他详细信息

\n
    \n
  • 如果由于文件组脱机而推迟,请使文件组重新联机。
  • \n
  • 重新启动数据库并希望问题是暂时的。
  • \n
  • 恢复数据库(可能在线)
  • \n
  • 将文件组标记为已失效
  • \n
  • 修复数据库
  • \n
\n

Paul Randal 在此给出了如何设计延期交易的示例。

\n