Total Server Memory and Min, Max SQL Memory
Set nocount on
Declare
@fSysMemoryUtil decimal(10,2),
@vchrSysMemory varchar(10),
@intSysMemory bigint,
@vchrAvbMemory varchar(15),
@fAvalMemory decimal(10,2),
@maxServerMemory int,
@minServerMemory int
SELECT @intSysMemory = Ceiling(total_physical_memory_kb / (1024.0*1024.0)),
@fAvalMemory = available_physical_memory_kb /(1024.0 * 1024.0)
From sys.dm_os_sys_memory;
Set @vchrSysMemory = Cast(@intSysMemory as varchar);
Set @fSysMemoryUtil = Cast(@intSysMemory as decimal(10,2)) - @fAvalMemory;
select @maxServerMemory = CAST (value AS INT ) from sys.configurations
where name like '%max server memory%'
select @minServerMemory = CAST (value AS INT) from sys.configurations
where name like '%min server memory%'
select 'Total Server Memory ' + @vchrSysMemory + 'GB : Max SQL Memory ' + Cast(@maxServerMemory/1024.0 as varchar) + 'GB & Min SQL Memory ' + Cast(@fSysMemoryUtil/1024.0 as varchar) + ' GB '
union all
select 'Current Server Memory utilization is ' + Cast(convert (decimal(10,2),@fSysMemoryUtil/@vchrSysMemory * 100) as varchar) + '% --> Total Memory ' + @vchrSysMemory + 'GB = Available Memory ' + Cast(@fAvalMemory as varchar) + 'GB + Memory Used ' + Cast(@fSysMemoryUtil as varchar) + ' GB '
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home