SQLUSA.com
SQL SERVER 2008 GRAND SLAM
FREE TRIAL  CLICK HERE TO ORDER  SEARCH
SQL JOBS SQL Server Training Scripts JOB BANK
  SQL Server 2008 Training Scripts  
  SQL Server 2005 Training Scripts  
News SQL Server Articles SQL Format

How to check server instance memory usage?

Execute the following script to display buffer memory usage by database. SQL Server 2005 stores its data and indexes in 8KB data pages. The cached data pages also stored in 8KB pages in buffer memory. A list of all the data pages in memory can be viewed by querying the dynamic management view sys.dm_os_buffer_descriptors.

USE master;

 

SELECT   [Database] = isnull(db_name(database_id),'Resource DB'),

         BufferedPages = count(* ),

         BufferedKB = count(* ) * 8192 / 1024,

         FreeKB = sum(free_space_in_bytes) / 1024

FROM     sys.dm_os_buffer_descriptors

GROUP BY db_name(database_id)

ORDER BY BufferedPages DESC;

GO

/*  Database            BufferedPages     BufferedKB  FreeKB

Resource DB             3789              30312       8620

AdventureWorks          1322              10576       2053

AdventureWorks2008      888               7104        2494

..... */

------------

 

-- SQL Server memory check

DBCC memorystatus

/* Memory Manager       KB

VM Reserved             14794876

VM Committed            95268

Locked Pages Allocated  180224

Reserved Memory         1024

Reserved Memory In Use  0

..... */

------------

Related articles:

How to adjust memory usage by using configuration options in SQL Server

Server Memory Options

How to use the DBCC MEMORYSTATUS command to monitor memory usage on SQL Server 2005

 

Order SQL 2008 GRAND SLAM Today!
SQLUSA.com Home Page
SQL Server Training at www.sqlusa.com.
SQL Server 2008 Video Training at www.sqlusa.com.
SQL Server 2005 Training Videos at www.sqlusa.com.
Microsoft SQL Server 2000 Training Videos at www.sqlusa.com.

FREE SQL & Business Intelligence / OLAP Short Videos on YOUTUBE.com

Microsoft Community Contributor 2011
Invest in Your SUCCESS!

Search SQLUSA FREE SQL Server Articles & FREE T-SQL Scripts


Copyright 2005-2011, SMI Corp. All Rights Reserved.

SQL Server 2012 is a program product of Microsoft Corporation.
SQL Server 2008 is a program product of Microsoft Corporation.
SQL Server 2005 is a program product of Microsoft Corporation.
SQL Server 2000 is a program product of Microsoft Corporation.