GremlinHunter said:
Is there a way to find out total uptime on a database?
Oracle does not increment and store any counter that totals how many days/hours/minutes/seconds a database runs.
You can, however, see the date and time that the most recent startup occurred with:
Code:
select to_char(startup_time,'yyyy-mm-dd hh24:mi:ss')startup
from v$instance;
STARTUP
-------------------
2007-12-04 00:13:43
For total uptime, about the best you can hope for is if you archive (or never overwrite) your ALERT_<sid>.log file (that resides in the path identified by BACKGROUND. You could then process that flat file as an Oracle EXTERNAL table and apply this logic:[ul][li]For each database-instance STARTUP, step back one line to obtain and store the DATE and TIME of that startup.[/li][li]Step backward in the ALERT_<sid>.log file from the STARTUP timestamp to the previous timestamp. Finding the difference between these two times represents
approximate "DOWNTIME" (since the previous timestamp might not be for a graceful shutdown, in which case the timestamp simply respresents when the previous message appeared in the alert log, not necessarity when the instance went down.)[/li][li]Total up the downtime values and subtract the downtime SUM from the total elapsed time between the current time and the first STARTUP. This yields approximate UPTIME.[/li][/ul]Let us know if any of this helps.
![[santa] [santa] [santa]](/data/assets/smilies/santa.gif)
Mufasa
(aka Dave of Sandy, Utah, USA)
[I provide low-cost, remote Database Administration services:
www.dasages.com]