MSSQL中的KILL SPID命令

0    138    1

Tags:

👉 本文共约7407个字,系统预计阅读时间或需28分钟。

This article gives an overview of the KILL SPID command and how to monitor the rollback progress.
本文概述了KILL SPID命令以及如何监视回滚进度。

介绍 (INTRODUCTION)

Once we connect to a SQL Server instance, it assigns a unique identification number to each connection. It is the Server Process ID and commonly known as SPID. SPID 1 to 50 is reserved for SQL Server internal processes, and the user process starts from SPID 51.
一旦连接到SQL Server实例,它将为每个连接分配一个唯一的标识号。 它是服务器进程ID,通常称为SPID。 SPID 1到50保留用于SQL Server内部进程,而用户进程从SPID 51开始。

在SQL SERVER中检查SPID的不同方法 (DIFFERENT WAYS TO CHECK THE SPID IN SQL SERVER)

You can check all processes in SQL Server using the following ways.
您可以使用以下方法检查SQL Server中的所有进程。

使用SP_WHO2命令: (USING SP_WHO2 COMMAND:)

Execute the sp_who2 command, and it lists out all the SPID’s including the system and user processes.
执行sp_who2命令,它列出了所有SPID,包括系统进程和用户进程。
MSSQL中的KILL SPID命令

使用动态管理视图: (USING DYNAMIC MANAGEMENT VIEW:)

We can use the DMV sys.dm_exec_sessions to get the session details.
我们可以使用DMV sys.dm_exec_sessions来获取会话详细信息。

MSSQL中的KILL SPID命令

使用活动监视器: (USING ACTIVITY MONITOR:)

Connect to a SQL instance in SSMS and, right-click on SQL instance. Launch Activity Monitor. It opens the following Activity Monitor that contains Overview, Processes tabs.
连接到SSMS中SQL实例,然后右键单击SQL实例。 启动活动监视器。 它将打开以下活动监视器,其中包含“概述”,“进程”选项卡。
In the Processes tab, we can view the SP ID and details such as login, database, application, hostname. By default, Activity Monitor displays the User processes as shown in the following image.
在“进程”选项卡中,我们可以查看SP ID和详细信息,例如登录名,数据库,应用程序,主机名。 默认情况下,活动监视器显示用户进程,如下图所示。
MSSQL中的KILL SPID命令
If we want to view all SPID’s, set the User Process column value from the drop-down to All (1 – User Process, 0- System process).
如果要查看所有SPID,请从下拉列表中将“用户进程”列值设置为“全部”(1 –用户进程,0 –系统进程)。
MSSQL中的KILL SPID命令

使用SSMS信息栏: (USING SSMS INFORMATION BAR:)

Once we open a new session in SSMS, it shows the following information in the information bar.
在SSMS中打开新会话后,它将在信息栏中显示以下信息。

标签:

Avatar photo

小麦苗

学习或考证,均可联系麦老师,请加微信db_bao或QQ646634621

您可能还喜欢...

发表回复

嘿,我是小麦,需要帮助随时找我哦。
  • 18509239930
  • 个人微信

  • DB宝
  • 个人邮箱
  • 点击加入QQ群
  • 个人微店

  • 回到顶部