Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: How to tell how long an instance has been running
"Daniel A. Morgan" <dmorgan_at_exesolutions.com> wrote in message news:<3B304067.297121B9_at_exesolutions.com>...
> Peter Shankey wrote:
>
> > Is there a v$ which tells how long a instances has been running in both 7
> > and 8?
> >
> > Thanks
> > Pete
>
> v$instance.
>
> You can also run listener status to find out how long the listener has been
> up:
>
> lsnrctl status in ORACLE_HOME/bin
>
> Daniel A. Morgan
Here is the SQL for a version 7 database:
set echo off
rem
rem SQL*Plus script to display version 7 startup time
rem Note v$instance changed with version 8
rem
rem 19990903 Mark D Powell To answer Oracle newspgroup post
rem
select sysdate - to_date(a. value,'J') + (b.value / 60 / 60 / 24)
from v$instance a,
v$instance b
where a.key = 'STARTUP TIME - JULIAN'
and b.key = 'STARTUP TIME - SECONDS'
/
Obviously it is easier with ver 8+:
select startup_time, sysdate - startup_time as "Days Running"
from v$instance
/
STARTUP_T Days Running
--------- ------------
15-JUN-01 4.90270833