LIST ACTIVE SESSIONSsp_who

 

spid

ecid

status

loginame

hostname

blk

dbname

cmd

request_id

1

0

background

sa

0

NULL

RESOURCE MONITOR

0

2

0

suspended

sa

0

NULL

LOG WRITER

0

51

0

sleeping

STORES\RLittle

CC-P-AOMAPP

0

master

AWAITING COMMAND

0

52

0

sleeping

FOUNDATION

ACC-JY

0

Foundation

AWAITING COMMAND

0

53

0

sleeping

CRM_HOST_LIVE

WEB-GB

0

CRM_HOST_LIVE

SELECT

0

54

0

sleeping

NT AUTHORITY\SYSTEM

CC-P-AOMDB

0

msdb

AWAITING COMMAND

0

55

0

sleeping

Admin

CCUK00130T001

0

CRM_HOST_LIVE

AWAITING COMMAND

0

56

0

sleeping

bte_ideradba

VM0227

0

master

AWAITING COMMAND

0

57

0

sleeping

NT AUTHORITY\SYSTEM

CC-P-AOMDB

0

msdb

AWAITING COMMAND

0

58

0

sleeping

NT AUTHORITY\SYSTEM

CC-P-AOMDB

0

ReportServer

AWAITING COMMAND

0

59

0

sleeping

CRM_HOST_LIVE

CC-P-AOMAPP

0

CRM_HOST_LIVE

AWAITING COMMAND

0

60

0

sleeping

FOUNDATION

VIRTUALXP-63912

0

Foundation

SELECT

0

 

LIST ACTIVE SESSIONS – T_sql

SELECT DISTINCT name AS database_name, session_id, host_name, login_time, login_name, reads, writes

FROM sys.dm_exec_sessions

LEFT OUTER JOIN

sys.dm_tran_locks ON sys.dm_exec_sessions.session_id = sys.dm_tran_locks.request_session_id

INNER JOIN

sys.databases ON sys.dm_tran_locks.resource_database_id = sys.databases.database_id

WHERE resource_type ‘DATABASE’

AND name =’CRM_HOST_LIVE’

ORDER BY name

 

 

CRM_HOST_LIVE

76

_ICT_CIM_5

2015-09-04 09:53:05.800

CRM_HOST_LIVE

3

11

CRM_HOST_LIVE

84

WEB-GB

2015-09-01 10:18:47.557

CRM_HOST_LIVE

0

0

 

GET EXCLUSIVE LOCKS – T_sql

SELECT DISTINCT name AS database_name, session_id, host_name, login_time, login_name, reads, writes

FROM sys.dm_exec_sessions

LEFT OUTER JOIN

sys.dm_tran_locks ON sys.dm_exec_sessions.session_id = sys.dm_tran_locks.request_session_id

INNER JOIN

sys.databases ON sys.dm_tran_locks.resource_database_id = sys.databases.database_id

WHERE resource_type ‘DATABASE’

AND request_mode like ‘%X%’

–AND name =’CRM_HOST_LIVE’

ORDER BY name

Kill