The Zabbix tool, posted in the comment, is not really working, because the server doesn't run on Windows, only the agent. See info in their requirements page. This means you'd need to install the tool on a Linux machine and only an agent on the Windows machine. Great if you have a heterogeneous environment, not really helpful in a full Win environment.
The same situation is for Nagios, another interesting open source monitoring tool. They say there is a package only for Windows, but the doc page it redirects to doesn't work now.
Of complete free monitoring tools useful for SQL 2000 I'm not really aware, but you can use successfully a pair of:
Perfmon (find more info here)
Server trace (trace specific queries, not just everything) -> actually files that can be open in SQL Profiler
SQL Alerts (info in MSDN article or here, in this SimpleTalk article)
PS: found that a great monitoring tool is also working on SQL 2000. So you'd better try to test Confio Ignite free. It's fantastic for the price :-).
PS2: there is also a small free monitoring tool from Idera -> SQL Check, but I don't know if it works on SQL 2000.
You can use the below query to determine the Memory usage at database level:
SELECT
(CASE WHEN ([database_id] = 32767)
THEN N'Resource Database'
ELSE DB_NAME ([database_id]) END) AS [DatabaseName],
COUNT (*) * 8 / 1024 AS [MBUsed],
SUM (CAST ([free_space_in_bytes] AS BIGINT)) / (1024 * 1024) AS [MBEmpty]
FROM sys.dm_os_buffer_descriptors
GROUP BY [database_id];
GO
If you want to analyse further at object level that which object in that database from above query is using a lot memory use below query:
EXEC sp_MSforeachdb
N'IF EXISTS (SELECT 1 FROM (SELECT DISTINCT DB_NAME ([database_id]) AS [name]
FROM sys.dm_os_buffer_descriptors) AS names WHERE [name] = ''?'')
BEGIN
USE [?]
SELECT
''?'' AS [Database],
OBJECT_NAME (p.[object_id]) AS [Object],
p.[index_id],
i.[name] AS [Index],
i.[type_desc] AS [Type],
--au.[type_desc] AS [AUType],
--DPCount AS [DirtyPageCount],
--CPCount AS [CleanPageCount],
--DPCount * 8 / 1024 AS [DirtyPageMB],
--CPCount * 8 / 1024 AS [CleanPageMB],
(DPCount + CPCount) * 8 / 1024 AS [TotalMB],
--DPFreeSpace / 1024 / 1024 AS [DirtyPageFreeSpace],
--CPFreeSpace / 1024 / 1024 AS [CleanPageFreeSpace],
([DPFreeSpace] + [CPFreeSpace]) / 1024 / 1024 AS [FreeSpaceMB],
CAST (ROUND (100.0 * (([DPFreeSpace] + [CPFreeSpace]) / 1024) / (([DPCount] + [CPCount]) * 8), 1) AS DECIMAL (4, 1)) AS [FreeSpacePC]
FROM
(SELECT
allocation_unit_id,
SUM (CASE WHEN ([is_modified] = 1)
THEN 1 ELSE 0 END) AS [DPCount],
SUM (CASE WHEN ([is_modified] = 1)
THEN 0 ELSE 1 END) AS [CPCount],
SUM (CASE WHEN ([is_modified] = 1)
THEN CAST ([free_space_in_bytes] AS BIGINT) ELSE 0 END) AS [DPFreeSpace],
SUM (CASE WHEN ([is_modified] = 1)
THEN 0 ELSE CAST ([free_space_in_bytes] AS BIGINT) END) AS [CPFreeSpace]
FROM sys.dm_os_buffer_descriptors
WHERE [database_id] = DB_ID (''?'')
GROUP BY [allocation_unit_id]) AS buffers
INNER JOIN sys.allocation_units AS au
ON au.[allocation_unit_id] = buffers.[allocation_unit_id]
INNER JOIN sys.partitions AS p
ON au.[container_id] = p.[partition_id]
INNER JOIN sys.indexes AS i
ON i.[index_id] = p.[index_id] AND p.[object_id] = i.[object_id]
WHERE p.[object_id] > 100 AND ([DPCount] + [CPCount]) > 12800 -- Taking up more than 100MB
ORDER BY [FreeSpacePC] DESC;
END';
Use the querys above in SP's to run at a time period to collect the data you require and this would help you analyse better!
Best Answer
There's
Sql Server Profiler
which comes with the installation. It allows you to monitor all SQL statements with various filter criteria. You could also pair it up withPerfMon
to investigate performance.MSDN Sql Server Profiler
I also found this site Receiving Profiler Events. Which allows real-time tracking in .NET.