SQL Administration: Dynamic Management Views
Introduction
Permission to Execute DMV [Security]
SELECT privilege on VIEW SERVER STATE and for database scoped DMV, the user must have SELECT privilege on VIEW DATABASE STATE.- GRANT VIEW SERVER STATE to
- GRANT VIEW DATABASE STATE to
DENY command to restrict access to a specific DMV.Getting Started
DM_. So when you need to query a DMV, you should prefix the view name with SYS. As an example, if you need to see the total physical memory of the SQL Server machine; then execute the below TSQL command:SELECT
(Physical_memory_in_bytes/1024.0)/1024.0 AS Physical_memory_in_Mb
FROM
sys.dm_os_sys_info
- SQL Server related [Hardware Resources] DMV
- Database related DMV
- Index related DMV
- Execution related DMV
1. SQL Server Related DMV
a) sys.dm_os_sys_info
b) sys.dm_os_hosts
c) sys.dm_os_schedulers
d) sys.dm_io_pending_io_requests
e) sys.dm_io_virtual_file_stats
f) sys.dm_os_memory_clerks
g) sys.dm_os_ring_buffers
a) sys.dm_os_sys_info
- CPU Count: Number of logical CPUs in the server
- Hyperthread-ratio: Ratio of logical and physical CPUs
Physical_memory_in_bytes: Amount of physical memory availableVirtual_memory_in_bytes: Amount of virtual memory availableBpool_commited: Committed physical memory in buffer poolOS_Priority_class: Priority class for SQL Server processMax_workers_thread: Maximum number of workers which can be created
b) sys.dm_os_hosts
Name: Name of the host registeredType: Type of hosted component [SQL Native Interface/OLE DB/MSDART]Active_tasks_count: Number active tasks host placedActive_ios_count: I/O requests from host waiting