March 19, 2014 at 6:31 am
Hi Friends,
I am facing a issue, since couple of days.
Sql server memory is slowly consuming all memory of server. And when it reaches to max limit, my applications hosted on server gets slow and stops working.
SQL Server is having 65 GB RAM
Min Limit set to 0, and Max limit set to 40GM, in sql server configuration.
I also scheduled to execute following scripts , in sql server agent.
CHECKPOINT
DBCC DROPCLEANBUFFERS
DBCC FREESESSIONCACHE
DBCC FREEPROCCACHE
DBCC FREESYSTEMCACHE('All')
I also tried -
EXEC sp_configure 'show advanced option', '1';
I tried to analyze memory consumption, using following scripts -
SELECT COUNT(*) AS CACHED_PAGES_COUNT,
NAME AS BASETABLENAME, INDEXNAME,
INDEXTYPEDESC
FROM SYS.DM_OS_BUFFER_DESCRIPTORS AS BD
INNER JOIN
(
SELECT S_OBJ.NAME, S_OBJ.INDEX_ID,
S_OBJ.ALLOCATION_UNIT_ID, S_OBJ.OBJECT_ID,
I.NAME INDEXNAME, I.TYPE_DESC INDEXTYPEDESC
FROM
(
SELECT OBJECT_NAME(OBJECT_ID) AS NAME,
INDEX_ID ,ALLOCATION_UNIT_ID, OBJECT_ID
FROM SYS.ALLOCATION_UNITS AS AU
INNER JOIN SYS.PARTITIONS AS P
ON AU.CONTAINER_ID = P.HOBT_ID
AND (AU.TYPE = 1 OR AU.TYPE = 3)
UNION ALL
SELECT OBJECT_NAME(OBJECT_ID) AS NAME,
INDEX_ID, ALLOCATION_UNIT_ID, OBJECT_ID
FROM SYS.ALLOCATION_UNITS AS AU
INNER JOIN SYS.PARTITIONS AS P
ON AU.CONTAINER_ID = P.PARTITION_ID
AND AU.TYPE = 2
) AS S_OBJ
LEFT JOIN SYS.INDEXES I ON I.INDEX_ID = S_OBJ.INDEX_ID
AND I.OBJECT_ID = S_OBJ.OBJECT_ID ) AS OBJ
ON BD.ALLOCATION_UNIT_ID = OBJ.ALLOCATION_UNIT_ID
WHERE DATABASE_ID = DB_ID()
GROUP BY NAME, INDEX_ID, INDEXNAME, INDEXTYPEDESC
ORDER BY CACHED_PAGES_COUNT DESC;
GO
--To see the number of pages cached in memory and the amount of RAM used in MB:
select count(*) AS Page_Count
,count(*) * 8 / 1024 as Cached_Size_MB
from sys.dm_os_buffer_descriptors
--To see the number of pages cached in memory and the amount of RAM used in MB for each database:
SELECT count(*)AS Page_Count
,count(*) * 8 / 1024 as Cached_Size_MB
,CASE database_id
WHEN 32767 THEN 'ResourceDb'
ELSE db_name(database_id)
END AS Database_name
FROM sys.dm_os_buffer_descriptors
GROUP BY db_name(database_id) ,database_id
ORDER BY Page_Count DESC;
--To see the count of pages cached in memory for each object in the current database:
USE TMS
GO
SELECT count(*)AS Page_Count
,object_name ,index_id
FROM sys.dm_os_buffer_descriptors AS bd
INNER JOIN
(
SELECT object_name(object_id) AS object_name
,index_id ,allocation_unit_id
FROM sys.allocation_units AS au
INNER JOIN sys.partitions AS p
ON au.container_id = p.hobt_id
AND (au.type = 1 OR au.type = 3)
UNION ALL
SELECT object_name(object_id) AS name
,index_id, allocation_unit_id
FROM sys.allocation_units AS au
INNER JOIN sys.partitions AS p
ON au.container_id = p.partition_id
AND au.type = 2
) AS obj
ON bd.allocation_unit_id = obj.allocation_unit_id
WHERE database_id = db_id()
GROUP BY object_name, index_id
ORDER BY Page_Count DESC;
But its not helping me out..
Can anyone pls suggest on the same?
March 19, 2014 at 7:45 am
First things first, take that agent job out. Scheduling some major performance degradation is usually not something you do to a production system.
Is it SQL which is consuming the memory? How did you check?
Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability
March 20, 2014 at 12:21 am
Thnx Gail
Yes, I had disabled the job. Although I scheduled it temporarily.
Yes, SQLServer.exe is consuming all the available memory with the server.
March 20, 2014 at 2:35 am
GilaMonster (3/19/2014)
Is it SQL which is consuming the memory? How did you check?
Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability
March 24, 2014 at 12:27 am
1. In task manager SQLServer.exe memory consumption is shown as 65GB
2. After restarting it, everything starts working normally for 17 to 18 Hours
3. Again memory consumption goes to 10%.
March 24, 2014 at 12:28 am
I mean again memory consumption goes to 100%, pls ignore 10%
March 24, 2014 at 3:01 pm
Hello,
By default SQL Server is designed to use memory in large quantities, in order to cache data pages, plans and other DB objects in the Memory (Buffer pool).Under noramal conditions SQL Serevr will consume as much memory as it needs from the available RAM. When OS sets the memory low resource notification flag it is under these circumstances SQL Server will trim its working set (memory usage).
In order to avoid such a behaviour set the MAX_SERVER_MEMORY sp_configure option.
Refrence: http://www.red-gate.com/community/books/accidental-dba (Chap 4)
March 25, 2014 at 12:27 pm
Are you experiencing any memory pressures on the server or memory related errors ?
--
SQLBuddy
Viewing 8 posts - 1 through 7 (of 7 total)
You must be logged in to reply to this topic. Login to reply