July 21, 2006 at 11:58 am
What's the best way of determining time of last server reboot from within a stored procedure?
Thanks
July 21, 2006 at 2:41 pm
select
dateadd(ss, -1*ms_ticks/1000, getdate()) "Last server reboot time"
from
sys.dm_os_sys_info
July 21, 2006 at 3:07 pm
Unfortunately we're on SQL Server 2000, not 2005.
July 21, 2006 at 7:01 pm
TempDb is rebuilt from the ground up on a reboot... this does the trick...
SELECT CrDate AS LastRebootDate
FROM Master.dbo.SysDatabases
WHERE Name = 'TempDB'
--Jeff Moden
Change is inevitable... Change for the better is not.
July 21, 2006 at 7:19 pm
Thanks, but would this be the time of the last restart of SQL Server? I'm looking for the Windows Server reboot.
July 22, 2006 at 7:52 am
Ack... my fault... I'm so data-centric that I sometimes forget that SQL Server has to live on a Windows server (except for MSDE, Development Edition, etc).
Nope, I don't know how to do this one without using some undocumented feature (not usually a good idea) like xp_GetFileDetails or xp_RegRead or maybe a trip through xp_CmdShell (with the DIR cmd) to check a file date that is created during Windows Server bootup.
--Jeff Moden
Change is inevitable... Change for the better is not.
Viewing 6 posts - 1 through 6 (of 6 total)
You must be logged in to reply to this topic. Login to reply