Reprinted from work partner Garrett, Helen "SQL Server performance Counter captures"
Capturing Windows performance Counters for SQL serversql Server performance Counters
The following counters is the recommended list to capture baseline performance metrics for SQL Server:
- Memory Available Mbytes (already added above)
- Memory Page faults/sec (already added above)
- Memory Page reads/sec (already added above)
- Memory Page writes/sec (already added above)
- Paging File% Usage (_total) (already added above)
- Processor% Privileged Time (_total)
- Processor% Processor time (_total)
- Processor% User time (_total)
- Physical Disk% Idle time (_total)
- Physical Disk AVG. Disk Queue Length (_total)
- Physical Disk AVG. Disk Sec/read (_total)
- Physical Disk AVG. Disk Sec/transfer (_total)
- Physical Disk AVG. Disk Sec/write (_total)
- SQL server:access methods/page splits/sec
- SQL server:buffer Manager Buffer Cache hit Ratio
- SQL Server:buffer Manager Page life expectancy
- SQL server:buffer Manager Page lookups/sec
- SQL server:buffer Manager Page reads/sec
- SQL server:buffer Manager Page writes/sec
- SQL server:general Statistics User Connections
- SQL server:memory Manager Memory Grants Pending
- SQL server:sql Statistics Batch requests/sec
- SQL Server:sql Statistics SQL compilations/sec
- SQL Server:sql Statistics SQL recompilations/sec
- SQL server:wait Statistics Memory Grant Queue Waits <all instances>
- SQL server:wait Statistics Network IO Waits <all instances>
- SQL server:wait Statistics non-page Latch Waits <all instances>
- SQL server:wait Statistics Page IO Latch Waits <all instances>
- SQL server:wait Statistics Page Latch Waits <all instances>
- System Processor Queue Length
Typeperf
Microsoft provides a command line utility "Typeperf" which allows capturing counters from a remote system to a monitoring System and logging these either to the Command window or a log file.
More information about the Typeperf command can is found at:
Https://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/nt_command_typeperf.mspx?mfr=true
Using typeperf with an Input File
Create a folder on the monitoring server named "Typeperf".
Create a new file in the Typeperf folder Namedtypeperf_sqlcounters.txt.
Edit the Typeperf_sqlcounters.txt file by copying the followingcontents into the file:
\\SERVERNAME\Memory\Available Bytes
\\SERVERNAME\Memory\Page reads/sec
\\SERVERNAME\Memory\Page writes/sec
\\SERVERNAME\Paging File (_total) \% Usage
\\SERVERNAME\PhysicalDisk (_total) \% Disk time
\\SERVERNAME\PhysicalDisk (_total) \avg. Disk Queue Length
\\SERVERNAME\PhysicalDisk (_total) \avg. Disk Sec/read
\\SERVERNAME\PhysicalDisk (_total) \avg. Disk Sec/transfer
\\SERVERNAME\PhysicalDisk (_total) \avg. Disk Sec/write
\\SERVERNAME\Processor (_total) \% Privileged Time
\\SERVERNAME\Processor (_total) \% Processor time
\\SERVERNAME\Processor (_total) \% User time
\\servername\sqlserver:access Methods\page splits/sec
\\servername\sqlserver:buffer Manager\buffer Cache Hit ratio
\\servername\sqlserver:buffer manager\page Life expectancy
\\servername\sqlserver:buffer Manager\page lookups/sec
\\servername\sqlserver:general Statistics\user Connections
\\servername\sqlserver:memory Manager\Memory Grants Pending
\\servername\sqlserver:sql Statistics\batch requests/sec
\\servername\sqlserver:sql Statistics\sql compilations/sec
\\servername\sqlserver:sql Statistics\sql re-compilations/sec
\\servername\sqlserver:wait Statistics (*) \memory Grant Queuewaits
\\servername\sqlserver:wait Statistics (*) \network IO waits
\\servername\sqlserver:wait Statistics (*) \page IO latch waits
\\servername\sqlserver:wait Statistics (*) \page latch waits
\\SERVERNAME\System\Processor Queue Length
Perform a global replace of the SERVERNAME to match the actual SERVERNAME for the SQL Server so is to be monitored. Save the file and Close.
--------------------------------------------------------------Split Line-------------------------------------------------------- -------------------
Go to the Start menu, Command Prompt.
Change the directory to the location where the Typeperf directory is created.
At the command prompt, modify the next command to match the information for the SQL Server being monitored:
TYPEPERF-CF F:\TypePerf\TypePerf_SQLCounters.txt-f csv-o F:\TypePerf\mslab2191_yyyymmdd_hhmm. Csv-s brtc_mslab2191
-CF Name of the file that contains the list of counters to capture
-f Format of the log file, defaults to CSV
-o path\name of output file
-S Name of server to collect the counters from if one does not exist in the counter file
EXAMPLE:
TYPEPERF-CF F:\TypePerf\TypePerf_SQLCounters.txt-f csv-o F:\TypePerf\MSLAB2191_20161020_2025.csv-s brtc_mslab2191
Press Enter to start the counter collection ...
The [\] would run the command and capture the counters every second.
Verify the file specified for the output were created and is growing:
-------------------------------------------------------Split Line--------------------------------------------------------------- --------
When you are completed the SQL Server test, press Ctrl-c to stop the counter collection.
Close the Command Prompt window.
How to obtain SQL Server performance counter values under Windows platform