Create Windows Performance Counter for SQL Server and Disk I/O (Perfmon) via command line
Steps to create PerfMon. (Tested in Windows 2016)
- create a folder "D:\PerfMonLogs\" for storing the log
- run a command prompt as Administrator
- Capture SQL log:
- Configuration the perfmon with below steps
- For default instance:
logman create counter myperf -f bin -c "\SQLServer:Buffer Manager\*" "\SQLServer:Memory Node(*)\*" "\SQLServer:Buffer Node(*)\*" "\SQLServer:Locks(*)\*" "\SQLServer:Databases(*)\*" "\SQLServer:Database Mirroring(*)\*" "\SQLServer:General Statistics\*" "\SQLServer:Latches\*" "\SQLServer:Access Methods\*" "\SQLServer:SQL Statistics\*" "\SQLServer:Memory Manager\*" "\SQLServer:Wait Statistics(*)\*" "\LogicalDisk(*)\*" "\PhysicalDisk(*)\*" "\Processor(*)\*" "\Process(*)\*" "\Memory\*" "\System\*" -si 00:00:01 -o D:\PerfMonLogs\my_perf_log.blg -cnf 24:00:00 -max 500 - Or use below command for named instance:
logman create counter myperf -f bin -c "\MSSQL$InstanceName:Buffer Manager\*" "\MSSQL$InstanceName:Memory Node(*)\*" "\MSSQL$InstanceName:Buffer Node(*)\*" "\MSSQL$InstanceName:Locks(*)\*" "\MSSQL$InstanceName:Databases(*)\*" "\MSSQL$InstanceName:Database Mirroring(*)\*" "\MSSQL$InstanceName:General Statistics\*" "\MSSQL$InstanceName:Latches\*" "\MSSQL$InstanceName:Availability Replica(*)\*" "\MSSQL$InstanceName:Database Replica(*)\*" "\MSSQL$InstanceName:Access Methods\*" "\MSSQL$InstanceName:SQL Statistics\*" "\MSSQL$InstanceName:Memory Manager\*" "\MSSQL$InstanceName:Wait Statistics(*)\*" "\LogicalDisk(*)\*" "\PhysicalDisk(*)\*" "\Processor(*)\*" "\Process(*)\*" "\Memory\*" "\System\*" -si 00:00:01 -o D:\PerfMonLogs\my_perf_log.blg -cnf 24:00:00 -max 500 - Start the perfmon
logman start myperf - Stop the perfmon
logman stop myperf - Capture Disk I/O (StorPort) log
- Create trace as below:
Logman create trace "drivers_storage" -ow -o D:\PerfMonLogs\drivers_storage.etl -p "Microsoft-Windows-StorPort" 0xffffffffffffffff 0xff -nb 16 16 -bs 1024 -mode Circular -f bincirc -max 4096 -ets - Create workload on SQL server and wait for a few minute
- Stop the trace:
Logman stop "drivers_storage" -ets - Compress and upload all the .blg files from "D:\PerfMonLogs\"
Comments