Script uses " xp_cmdshell" command, which can be disabled on your server. , SMALLINT = ( SELECT MAX ( ID ) FROM #tbl_MemoryStatusDump ), VARCHAR (100 ), VARCHAR (20 ), TINYINT, VARCHAR (100 ), VARCHAR (20 ) WHILE < SELECT = PATINDEX ( '% %', REVERSE ( RTRIM ( Dump ))), = LEFT ( Dump, LEN ( Dump ) - ), = RIGHT ( RTRIM ( Dump ), - 1 ) FROM #tbl_MemoryStatusDump WHERE ID = IF = 1įROM #tbl_MemoryStatusDump WHERE ID = ELSE IF LEFT ,1 ) = '(' SET = 1 ELSE IF != 'NULL' and LEFT ,1 ) != '-' INSERT INTO # tbl_MemoryStatus (,, , ) SELECT, ,, CAST as MONEY ) FROM #tbl_MemoryStatusDump WHERE ID = SET += 1 ENDġ. INSERT INTO # tbl_MemoryStatusDump ( Dump ) EXEC ( 'xp_cmdshell ''sqlcmd -E -S localhost -Q "DBCC MEMORYSTATUS" ''' ) IF OBJECT_ID ( 'tempdb.#tbl_MemoryStatus' ) IS NOT NULL DROP TABLE #tbl_MemoryStatus ĬREATE TABLE # tbl_MemoryStatusDump ( ID INT IDENTITY (1 ,1 ) PRIMARY KEY, Dump VARCHAR (100 )) ĬREATE TABLE # tbl_MemoryStatus ( ID INT IDENTITY (1 ,1 ), VARCHAR (100 ), VARCHAR (20 ), VARCHAR (100 ), MONEY ) IF OBJECT_ID ( 'tempdb.#tbl_MemoryStatusDump' ) IS NOT NULL DROP TABLE #tbl_MemoryStatusDump It is like if I'm asking for driving direction I can get the answer only in Chinese.īeing in frustration, I've decided to make it available in native SQL language. There is no problem with PowerShell for me, but the whole Idea seems wrong. I've did a quick search over the internet and found several parsing solutions, but all of them are based on PowerShell. So in order to achieve that we have to parse results of "DBCC MEMORYSTATUS". That will make research easier and data can be stored or compared with the base line. ![]() To eliminate both these problem all these different counters have to be in the same table/data set. I had to scroll down and shuffle 115 different data sets to find the counter I want. I had to wait several seconds to get the full result set.Ģ. When I wanted to research memory problem on a server and started to dig deeper into "DBCC MEMORYSTATUS" command.Very useful links to understand that command were from Microsoft:ĭuring the research I've faced two problems:ġ.
0 Comments
Leave a Reply. |