- KnowledgeBase >
- SQL >
- How to generate a memory usage by database report in mssql
How to generate a memory usage by database report in mssql
DECLARE @total_buffer INT;
SELECT @total_buffer = cntr_value
FROM sys.dm_os_performance_counters
WHERE RTRIM([object_name]) LIKE '%Buffer Manager'
AND counter_name = 'Database Pages';
;WITH src AS
(
SELECT
database_id, db_buffer_pages = COUNT_BIG(*)
FROM sys.dm_os_buffer_descriptors
--WHERE database_id BETWEEN 5 AND 32766
GROUP BY database_id
)
SELECT
[db_name] = CASE [database_id] WHEN 32767
THEN 'Resource DB'
ELSE DB_NAME([database_id]) END,
db_buffer_pages,
db_buffer_MB = db_buffer_pages / 128,
db_buffer_percent = CONVERT(DECIMAL(6,3),
db_buffer_pages * 100.0 / @total_buffer)
FROM src
ORDER BY db_buffer_MB DESC;
Additional Articles
- Firewall
- Website Panels
- DELL
- Dynamic DNS
- Hardware
- P2V
- PineApp
- PRTG
- SSL
- VMware
-
Windows
- hmail
- IIS
- Logs
- Security
- How to change activation key in WIN2012
- How to configure time server in server 2003 & 2008
- How to disable the tcp connection limit per IP
- Scripts
- Basic Encoding
- Add disk cleanup utility in windows server 2008 r2
- Custom snmp for Windows
- Reduce Windows 7 +sp1 or 2008 +sp1 WinSXS Folder Size (Cleanup WinSXS After SP1 Install)
- How to install and set Remote Desktop Service
- How to recover DFS of a cloned windows server
- How to find files by size with PowerShell
- How to recover DFS of a cloned windows server (1)
- Wordpress
- DB
- Linux
- Public Cloud
-
SQL
- Backup SQL server Agent
- Backup resotre multiple bak files from directory
- Change db schema to dbo
- ChangeDBownerOnTables
- Export sqlusers with password and sid
- Found max big table
- Full Text Search On SQL
- How To Obtain The Size Of All Tables In A SQL Server Database
- Kill all active connections on DB
- SQL Server which database takes all memory
- How to change a mirrored database server to principal
- How to kill all active connections on MSSQL server
- What to do when SQL Server is in recovery
- How to Start SQL Server Instance in a Single User Mode
- SQL Change schema to dbo
- How to generate a memory usage by database report in mssql
- Switchs
- Backups
- More topics....
- Networking
X