简体   繁体   中英

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 product 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]

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM