1) Create path to hold the running scripts
here in our example C:\testlab\s2
2) Create a batch script by name memory_in_use.bat
Code is as follows :
bcp "select object_name,counter_name,cntr_value/1024,getdate() from sys.dm_os_performance_counters where object_name='MSSQL$CSFSPD3TEST2:Memory Manager' and counter_name in ('Target Server Memory (KB)','Total Server Memory (KB)')" queryout C:\testlab\s2\dup_mem_res.xls -T -c -S CSCINDAE744358\CSFSPD3TEST2
cd C:\testlab\s2
copy mem_res.xls+dup_mem_res.xls tempfile.xls
del mem_res.xls
ren tempfile.xls mem_res.xls
3) Create a mem_res.xls excel sheet.Open the sheet and in the first row manually enter the columns one by one
Here for our example :
Counter_Name Object_Name ValueinMB Date
4) Create a dup_mem_res.xls excel sheet.
5) Now create a scheduled tasks from os as shown in the below figure and configure it to run every x minutes or hours as per your requirement :
Wednesday, September 1, 2010
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment