Monitoring your database server is crucial to being able to analyse its performance, and you want to be monitoring continually – it’s no good starting to monitor when you detect a problem, as you a) might not know that you have a problem, and b) you don’t know what normal operation looks like.
Perfmon is the current standard (although SQL Server 2008 has some nifty features that can complement Perfmon).Â I won’t go into details about how to use Perfmon, as there’s plenty of information available on the web, but it can be tricky to configure to get Perfmon running automatically after reboot, or if for some reason Perfmon fails (such as a temporary out of disk space error).
The simplest way is to use the logman.exe program, supplied with Windows 2003 and later, and available for Windows 2000.Â This command line program can start or stop Perfmon counter logs on either the local or a remote server, among many other tasks.
The way we use it is to schedule a task in SQL Agent or Windows Scheduler that runs every 5 or 10 minutes and attempts to start the Perfmon counter log specified.Â If the counter log is already started, an error is returned, but the counter log is not affected.
The command to start a job is (note that logman should be in your C:\Windows\System32 folder):
logman.exe start CounterCollectionName -s RemoteServerName
More information about Logman and its parameters is available at http://technet.microsoft.com/en-us/library/cc755366.aspx.