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 2000 Forums
 SQL Server Administration (2000)
 When the server was last restarted

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2000-11-14 : 16:46:23
Akhilesh writes "How do i use @@CPU_BUSY, @@IDLE, @@IO_BUSY to calculate when the server was restarted last?
What unit is @@IDLE measured in ? ticks? milliseconds? seconds?

docs say milliseconds

if you take gettime() and subtract the sum of the three times (idle,io_idle& cpu_busy) you should get the time the server started by your logic. Butthis is not correct, the value seems to keep changing.

select dateadd(ms,-(@@cpu_busy + @@IDLE + @@IO_BUSY),getdate())

first param = ms (time is in milliseconds) - so you say
second param = -(total of three times)
third = is time now

this query should therefore tell you when the database was restarted last and be a constant value. but it keeps changing.

i think the values have something to do with clock ticks? cant figure it out yet.

either the docs are incorrect or MS SQL Server does something else other than

Server is idle
CPU does work
Server does input and output operations "

Glockenspiel
Yak Posting Veteran

50 Posts

Posted - 2002-06-25 : 11:29:36
See http://www.sqlteam.com/Forums/topic.asp?TOPIC_ID=17104

Go to Top of Page
   

- Advertisement -