开发者

Selecting SQL Server 2008 metrics from a database?

First off, I'm not even sure this is possible. One of my co-workers is requesting that I help him retrieve performance metrics from a Microsoft SQL Server 2008 database using a remote connection and a SQL query.

Specifically, we are looking for stuff like database memory usage and CPU usage. Is this stored in a table somewhere that I can easily just SELECT it from?

I've tried googling this but mainly all I come up with are ads for products that do SQL performance monitoring. I realize we could use perfmon in Windows to get this data, but that's not what he's looking for. Also remote WMI gathering of perfmon metrics is out. It has to be a remote SQL query - some p开发者_如何转开发roduct limitation I won't get into in detail. :)

Even a definitive "This is not possible" is a valid answer.

Thanks in advance.


There is DBCC MEMORYSTATUS to get a ton of memory information. DBCC statements in general are full with useful information about your SQL Server.

SO Answer on how you can "build" your own taskmon for SQL Server. Another great source for information about server state are Dynamic Management Views.

Knock yourself out.


To get the sort of info you want, you'll need to use SQL Server's performance/system monitor counters. See the MSDN article Monitoring Resource Usage (System Monitor) for details:

If you are running Microsoft Windows server operating system, use the System Monitor graphical tool to measure the performance of SQL Server. You can view SQL Server objects, performance counters, and the behavior of other objects, such as processors, memory, cache, threads, and processes. Each of these objects has an associated set of counters that measure device usage, queue lengths, delays, and other indicators of throughput and internal congestion.

[And yes...you can access peformance counters remotely (assuming you have the requisite permissions]

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜