— dbuptime.sql
set serveroutput on
set wrap off
set pages 300
set lines 200
col hostname for a25
col instance for a25
col stime for a38
col uptime for a53
select
‘Hostname : ‘ || host_name as hostname
,’Instance Name : ‘ || instance_name as instance
,’Started At : ‘ || to_char(startup_time,’DD-MON-YYYY HH24:MI:SS’) as 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’ as uptime
from
sys.v_$instance; |
Oilevia
Very useful query to check Oracle Database Uptime. Thanks for sharing.