Getting Started with Adobe After Effects - Part 6: Motion Blur


Upload Image Close it
Select File

Vishal Pawar is workin in The Most Group as MSBI Solution Architech
Browse by Tags · View All
sql 103
Query 58
#BI 32
Link 31
SQL Server 31
BI 30
#SQL Server 28
SSIS 23
brh 21
SSMA 17

Archive · View All
August 2011 36
June 2011 25
July 2011 21
December 2011 17
October 2011 12
September 2011 11
April 2012 7
November 2011 7
March 2012 5
January 2012 5

Vishal Pawar's Blog

BISQL # 64 - How to Check for all running process and How to Kill running process

Oct 28 2011 12:00AM by Vishal Pawar   

Hi geeks ,

There is always we need to check for all running process and sometimes  Kill running process.

Also there are lot of cases where we need to kill all processes running for given database also for performing DDL and DML attribute.

In this article we are covering

  1. To Check for all running process.
  2. To find out which database associated with above dbid
  3. To find out Query associated with specific spid
  4. To kill this process

To Check for all running process :

Following script will helps us to find all running process associated with all database

Script

USE      Master GO SELECT      SPID,DBID FROM SYSPROCESSES WHERE       DBID NOT IN (1,2,3,4)-- 1 for Master, 2 for Tempdb, 3 for Mode, 4 for MSDB  AND  SPID > 50 --SQL Server reserves SPID values of 1 to 50 for internal use  AND  SPID <> @@spid  --To exclude current user process*/ 

Output

image

But What is this SPID and DBID ?

SPID – Process ID

DBID – Database ID

Now lets try to decode based on this SPID and DBID

To find out which database associated with above DBID :

Now lets find out what is this DB ID form above result

Script

SELECT NAME FROM   SYSDATABASES WHERE  DBID=15 –Specify here above DBID 

Output

image

To find out Query associated with specific spid

Now we got the database now I want to find actual Query associated with it !!

Script

DECLARE @handle VARBINARY(64)   SELECT @handle = sql_handle FROM   sys.sysprocesses WHERE  SPID =57 -- Specify above SPID to get the query    SELECT text FROM  sys.dm_exec_sql_text(@handle) 

Output
image

Analysis this query if you don’t think its going to be harm any of your process the we can actually

To kill this process

Now we just need to provide SPID to kill that process .

Script

KILL 57 –Specify SPID to kill the process 

Output

image

This is sequence how we are killing process with analysis of Database as well as query associated with it !!

Hope this explanation is useful for you !!

Tags: Query,SQL


Vishal Pawar
24 · 7% · 2229
0
Liked
 
0
Lifesaver
 
0
Refreshed
 
0
Learned
 
0
Incorrect



Submit

Your Comment


Sign Up or Login to post a comment.

    Copyright © Rivera Informatic Private Ltd Contact us      Privacy Policy      Terms of use      Report Abuse      Advertising      [ZULU1097]