By using the query below, you can calculate and display the database uptime:
select 'Host Name : '||host_name||chr(10)|| 'Instance Name : '||instance_name||chr(10)|| 'Uptime : '||floor(xx)||'days '||floor((xx-floor(xx))*24)||'hours '||round(((xx-floor(xx )*24)-floor((xx-floor(xx)*24)))*60)||'minutes' "Database Uptime" from (select host_name,instance_name ,(sysdate-STARTUP_TIME) xx from v$instance)
For More Information
- What do you think about this tip? E-mail us at editor@searchDatabase.com with your feedback.
- The Best SQL Web Links: tips, tutorials, scripts, and more.
- The Best Web Links on Queries.
- Have an SQL tip to offer your fellow DBA's and developers? The best tips submitted will receive a cool prize--submit your tip today!
- Ask your technical SQL questions--or help out your peers by answering them--in our live discussion forums.
- Check out our Ask the Experts feature: Our SQL gurus are waiting to answer your toughest questions.