LATEST TOPICS

Script to check Oracle Database Instance uptime

A simple sql query that can be used to find the uptime of a database in terms of Days, Hours and Minutes.

--------------------------------------------------
-- Description: Script to check Instance Uptime --
-- Name: instance_uptime.sql					--
-- Author: Abu Fazal Md Abbas					--
--------------------------------------------------
col instance_name for a15
col "Instance Up Time" for a30
SELECT instance_name,
floor(((sysdate-startup_time)*24*60*60)/3600/24) || ' DAYS '
|| floor ((floor(((sysdate-startup_time)*24*60*60)) -
floor(((sysdate-startup_time)*24*60*60)/3600/24)*24*60*60)/3600) || ' Hours '
|| floor(floor ((floor(((sysdate-startup_time)*24*60*60))
- floor(((sysdate-startup_time)*24*60*60)/3600/24)*24*60*60) -
( floor ((floor(((sysdate-startup_time)*24*60*60)) -
floor(((sysdate-startup_time)*24*60*60)/3600/24)*24*60*60)/3600))*60*60)/60) || ' MINUTES ' "Instance Up Time"
FROM v$instance;

 

%d bloggers like this:
Visit Us On LinkedinVisit Us On TwitterVisit Us On Google PlusCheck Our Feed