Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Administration (2000)
 memory usage

Author  Topic 

kotsas
Yak Posting Veteran

65 Posts

Posted - 2001-10-25 : 02:41:17
How can I see how much memory each spid is using ( if he is using lot I will kill that process). IS THERE ANY COLUMN IN ANY OF SYSTEM TABLES?

Wanderer
Master Smack Fu Yak Hacker

1168 Posts

Posted - 2002-06-13 : 06:46:27
In case anyone is interested in this still, I have an SP that will give you this kind of info. The input here is a userid, but it should be simnple to modify to a SPID...

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[DBASP_users_procs]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[DBASP_users_procs]
GO

SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS ON
GO



CREATE proc DBASP_users_procs @who varchar(255)
as

select
convert(varchar(8),nt_username) as UserId,
convert(varchar(15),hostname) as PC_Name,
convert(varchar(30),program_name) as Program_Name,
"DB_Name"=substring(master..sysdatabases.name,1,35),
convert(varchar(15),loginame) as SQL_Login,
spid,
cpu,
physical_io,
(memusage*4) as Mem_Used_in_K

from master..sysprocesses
join master..sysdatabases on master..sysprocesses.dbid = master..sysdatabases.dbid
where nt_username = @who
order by 1,3,7
GO
SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS ON
GO




Go to Top of Page
   

- Advertisement -