DOYENSYS Knowledge Portal




We Welcome you to visit our DOYENSYS KNOWLEDGE PORTAL : Doyensys Knowledge Portal




Saturday, September 5, 2015

Find the Database uptime in terms of Days, Hours and Minutes.


Find the Database uptime in terms of Days, Hours and Minutes.


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;

No comments: