RSS Feed for This PostCurrent Article

Oracle: Detect Server Uptime

   1: SELECT to_char(startup_time,'DD-MON-YYYY HH24:MI:SS') "DB Startup Time"
   2: FROM sys.v_$instance;
   1: select
   2:    'Hostname : ' || host_name
   3:    ,'Instance Name : ' || instance_name
   4:    ,'Started At : ' || to_char(startup_time,'DD-MON-YYYY HH24:MI:SS') stime
   5:    ,'Uptime : ' || floor(sysdate - startup_time) || ' days(s) ' ||
   6:    trunc( 24*((sysdate-startup_time) -
   7:    trunc(sysdate-startup_time))) || ' hour(s) ' ||
   8:    mod(trunc(1440*((sysdate-startup_time) -
   9:    trunc(sysdate-startup_time))), 60) ||' minute(s) ' ||
  10:    mod(trunc(86400*((sysdate-startup_time) -
  11:    trunc(sysdate-startup_time))), 60) ||' seconds' uptime
  12: from
  13:    sys.v_$instance;
   1: select
   2:    to_char(logon_time,'DD/MM/YYYY HH24:MI:SS')
   3: from
   4:    v$session
   5: where
   6:    sid=1;


Trackback URL


Sorry, comments for this entry are closed at this time.