LLI Wiki — My Digital Knowledge Base

Oracle: instance startup time and uptime

Oracle queries to show the instance startup time and uptime.

Oracle queries to get the instance startup time and how long the instance has been running (uptime).

Instance uptime

The following query shows the host name, the instance name, the startup time and the elapsed time since then:

select
   'Hostname : ' || host_name
   ,'Instance Name : ' || instance_name
   ,'Started At : ' || to_char(startup_time,'DD-MON-YYYY HH24:MI:SS') stime
   ,'Uptime : ' || floor(sysdate - startup_time) || ' days(s) ' ||
   trunc( 24*((sysdate-startup_time) -
   trunc(sysdate-startup_time))) || ' hour(s) ' ||
   mod(trunc(1440*((sysdate-startup_time) -
   trunc(sysdate-startup_time))), 60) ||' minute(s) ' ||
   mod(trunc(86400*((sysdate-startup_time) -
   trunc(sysdate-startup_time))), 60) ||' seconds' uptime
from
   sys.v_$instance;

Startup time only

select to_char(startup_time, 'HH24:MI DD-MON-YY') "Startup time"
from v$instance;

Notes

Mastodon LLIMastodon SocialFosstodon