Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 SQL Server Administration (2005)
 Get CPU/Memory usage in real time

Author  Topic 

chih
Posting Yak Master

154 Posts

Posted - 2009-09-02 : 19:53:44
Hi everyone,

Is that possible using sql get db server CPU/Memory % usage in the real time?

thanks

jezemine
Master Smack Fu Yak Hacker

2886 Posts

Posted - 2009-09-02 : 19:55:47
normally would use perfmon for that.


elsasoft.org
Go to Top of Page

chih
Posting Yak Master

154 Posts

Posted - 2009-09-02 : 19:57:08
As I am developing a SQL monitoring tool in .net, I am thinking if there is a way to get those information by T-SQL.

quote:
Originally posted by jezemine

normally would use perfmon for that.


elsasoft.org

Go to Top of Page

ScottWhigham
Starting Member

49 Posts

Posted - 2009-09-03 : 07:31:24
I assume we're talking about SQL 2005/2008?

SELECT * FROM sys.dm_os_performance_counters

And BTW - here's a plug for elsasoft.org: I love, love, love SqlSpec :)

========================================================

I have about 1,000 video tutorials on SQL Server 2008, 2005, and 2000 over at http://www.learnitfirst.com/Database-Professionals.aspx
Go to Top of Page

jezemine
Master Smack Fu Yak Hacker

2886 Posts

Posted - 2009-09-03 : 12:26:14
you can access all the perfmon stuff from C# or any other .net language, no need for SQL here.

http://msdn.microsoft.com/en-us/library/system.diagnostics.performancecounter.aspx


elsasoft.org
Go to Top of Page

chih
Posting Yak Master

154 Posts

Posted - 2009-09-07 : 20:33:02
I finally find the simple way to get cpu data by using @@CPU_BUSY and @@IDLE.

But when it can cause Arithmetic overflow after the server is running for certain period.

Is there a way to reset the value instead of restaring the service?

Thank you in advance
Go to Top of Page

ahmad.osama
Posting Yak Master

183 Posts

Posted - 2009-09-09 : 01:53:52
quote:
Originally posted by chih

I finally find the simple way to get cpu data by using @@CPU_BUSY and @@IDLE.

But when it can cause Arithmetic overflow after the server is running for certain period.

Is there a way to reset the value instead of restaring the service?

Thank you in advance




why do you want to use t-sql, if you have more powerful programming languages to the stuff...??
Go to Top of Page

Sitka
Aged Yak Warrior

571 Posts

Posted - 2009-09-10 : 16:58:43
quote:
Originally posted by chih

I finally find the simple way to get cpu data by using @@CPU_BUSY and @@IDLE.

But when it can cause Arithmetic overflow after the server is running for certain period.

Is there a way to reset the value instead of restaring the service?

Thank you in advance




restarting the service seems like a real bad idea for a monitoring tool, use a suitable datatype or Parse, CONVERT, CAST.

"it's definitely useless and maybe harmful".
Go to Top of Page
   

- Advertisement -