Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: Instance up time

Re: Instance up time

From: James Lorenzen <james_lorenzen_at_allianzlife.com>
Date: Thu, 15 Jul 1999 12:57:33 GMT
Message-ID: <7mklro$f0i$1@nnrp1.deja.com>


An easier method is:

    select logon_time from v$session where SID = 1 ;

SID = 1 is pmon and it will reflect the startup time of the database.

I have used the following to get the startup time from v$instance: (This snippet of code is from a report I use.) SELECT 'System Statistics for ORACLE database ' || name || ' started '

     || TO_CHAR(TO_DATE(a.value,'J'),'dd-Mon-yyyy')
     || ' at ' || TO_CHAR(TRUNC(SYSDATE)+(b.value/86400),'hh24:mi:ss')
  FROM v$instance a, v$instance b, v$database c   WHERE b.key LIKE 'STARTUP TIME - S%'

     AND a.key LIKE 'STARTUP TIME - J%' ;

The "b.value" is in seconds and I divide by 86400 (number of seconds in a day) to get a fraction that is added to the starting date. HTH
    James
In article <Ofa1qulz#GA.352_at_cpmsnbbsa03>,   "peasland" <peasland_at_email.msn.com> wrote:
> I am trying to figure out how long an instance has been running. In
Oracle8,
> this is pretty easy since the V$INSTANCE view has a column called
> 'startup_time'. This is different in Oracle7. If I query the
V$INSTANCE
> view, I get the following information:
>
> SQL> select * from v$instance;
>
> KEY

VALUE
> ----------------------------------------------------------------



> RESTRICTED MODE

0
> SHUTDOWN PENDING

0
> STARTUP TIME - JULIAN

2451339
> STARTUP TIME - SECONDS

13688
>
> How can I use the two 'startup time' values to determine the length of
time
> the instance has been running? The 'startup time-julian' value does
not
> correspond to any julian date. Any information would be greatly
appreciated.
>
> Thanks in advance,
> Brian Peasland
> peasland_at_msn.com
>
>

Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't. Received on Thu Jul 15 1999 - 07:57:33 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US