Quantcast
Channel: SQL Server DBA
Viewing all articles
Browse latest Browse all 80

Does AWS RDS SQL Server support Dynamic Management Views ?

$
0
0

Question: Does AWS RDS SQL Server support Dynamic Management Views ? I want to be able to return memory information , including total server memory and memory pressure 

Answer:  A SQL Server installation on a Windows Server supports Dynamic Management Views (DMV)  . The same applies to AWS RDS SQL Server. 

When you execute a  SELECT @@version on an AWS RDS - it's similar to the following output .:

Microsoft SQL Server 2019 (RTM-CU8) (KB4577194) - 15.0.4073.23 (X64) Sep 23 2020 16:03:08 Copyright (C) 2019 Microsoft Corporation Enterprise Edition: Core-based Licensing (64-bit) on Windows Server 2016 Datacenter 10.0 (Build 14393: ) (Hypervisor)

 

To execute these examples  the required permissions are : SELECT permission on object and VIEW SERVER STATE or VIEW DATABASE STATE permission

 

Let's look  through a few examples of system DMVs which are supported  on AWS RDS SQL Server

 

--find total server memory 

SELECT total_physical_memory_kb / 1024 AS MemoryMb FROM sys.dm_os_sys_memory;


--identify memory pressure 



SELECT
    EventTime,
    record.value('(/Record/ResourceMonitor/Notification)[1]', 'varchar(max)') as [Type],
    record.value('(/Record/MemoryRecord/AvailablePhysicalMemory)[1]', 'bigint') AS [Avail Phys Mem, Kb],
    record.value('(/Record/MemoryRecord/AvailableVirtualAddressSpace)[1]', 'bigint') AS [Avail VAS, Kb]
FROM (
    SELECT
        DATEADD (ss, (-1 * ((cpu_ticks / CONVERT (float, ( cpu_ticks / ms_ticks ))) - [timestamp])/1000), GETDATE()) AS EventTime,
        CONVERT (xml, record) AS record
    FROM sys.dm_os_ring_buffers
    CROSS JOIN sys.dm_os_sys_info
    WHERE ring_buffer_type = 'RING_BUFFER_RESOURCE_MONITOR') AS tab
ORDER BY EventTime DESC

If you want to list all the DMVs and Dynamic Management functions execute the query on Find all DMV and DMF

Some other useful DMVs for Index Analysis on Top 5 SQL Server DMV for Index Analysis


Viewing all articles
Browse latest Browse all 80

Trending Articles