zoukankan      html  css  js  c++  java
  • 查询当前数据查询锁死语句SP_WHO3

    CREATE PROCEDURE [dbo].[sp_who3] 
    (  @SessionID INT = NULL ) 
    AS
    BEGIN
    SELECT
        SPID                = er.session_id 
        ,STATUS             = ses.STATUS 
        ,[Login]            = ses.login_name 
        ,Host               = ses.host_name 
        ,BlkBy              = er.blocking_session_id 
        ,DBName             = DB_Name(er.database_id) 
        ,CommandType        = er.command 
        ,SQLStatement       = st.text 
        ,ObjectName         = OBJECT_NAME(st.objectid) 
        ,ElapsedMS          = er.total_elapsed_time 
        ,CPUTime            = er.cpu_time 
        ,IOReads            = er.logical_reads + er.reads 
        ,IOWrites           = er.writes 
        ,LastWaitType       = er.last_wait_type 
        ,StartTime          = er.start_time 
        ,Protocol           = con.net_transport 
        ,ConnectionWrites   = con.num_writes 
        ,ConnectionReads    = con.num_reads 
        ,ClientAddress      = con.client_net_address 
        ,Authentication     = con.auth_scheme 
    FROM sys.dm_exec_requests er 
    OUTER APPLY sys.dm_exec_sql_text(er.sql_handle) st 
    LEFT JOIN sys.dm_exec_sessions ses 
    ON ses.session_id = er.session_id 
    LEFT JOIN sys.dm_exec_connections con 
    ON con.session_id = ses.session_id 
    WHERE er.session_id > 50 
        AND @SessionID IS NULL OR er.session_id = @SessionID 
    ORDER BY
        er.blocking_session_id DESC
        ,er.session_id 
    END
  • 相关阅读:
    Spring事务管理
    Spring中使用Hibernate
    tkinter学习笔记_04
    tkinter学习笔记_03
    tkinter学习笔记_02
    tkinter学习笔记_01
    tkinter模块常用参数(python3)
    单选框默认选中
    Tkinter & mysql 的登录框练习
    python爬虫-喜马拉雅_晚安妈妈睡前故事
  • 原文地址:https://www.cnblogs.com/duoe/p/15752078.html
Copyright © 2011-2022 走看看