Update

Sybase ASE 查找正在執行的程序

  • March 13, 2015

UPDATE INDEX STATISTICS在一些巨大的桌子上跑步。它已經執行了大約 1 小時。是否有一些程序/方法可以找到執行此命令的百分比?sp_who, sp_sysmon不要幫忙。謝謝。

在 SybaseASE 中沒有直接的方法可以做到這一點(與 sql server 不同,它公開 DMV 數據)。

你可以靠近看看你UPDATE INDEX STATISTICS是否得到了CPUPhysical IO而不是blocked

我使用以下查詢:

select l.spid
   ,p.status as status
   ,Db_name(l.dbid) as dbname
   ,p.hostname as hostname
   ,p.program_name as program_name
   ,substring(Object_name(l.id, l.dbid), 1, 30) as object
   ,p.blocked
   ,case 
       when type = 1
           then "Exclusive table lock"
       when type = 2
           then "Shared table lock"
       when type = 3
           then "Exclusive intent lock"
       when type = 4
           then "Shared intent lock"
       when type = 5
           then "Exclusive page lock"
       when type = 6
           then "Shared page lock"
       when type = 7
           then "Update page lock"
       when type = 8
           then "Exclusive row lock"
       when type = 9
           then "Shared row lock"
       when type = 10
           then "Update row lock"
       when type = 11
           then "Shared next key lock"
       when type = 256
           then "Lock is blocking another process"
       when type = 512
           then "Demand lock"
       end as "TYPE_OF_LOCK"
   ,l.page "Page"
   ,Substring(p.cmd, 1, 16) as executing_command
   ,p.physical_io as "PHYSICAL_I/O"
   ,p.cpu as cpu
from master..syslocks l
   ,master..sysprocesses p
where l.spid = p.spid

引用自:https://dba.stackexchange.com/questions/95045