Re: How to select time since last database startup ?

From: Venkateswara R Polisetti <vrao_at_sctcorp.com>
Date: 1996/08/16
Message-ID: <1996Aug16.093125.8487_at_mcrcr6>#1/1


Danny Roosens <roosens_at_ibm.net> wrote:

>Hi,
 

>How to select time since last database startup ?

Hi Danny,

        The following is a query that gives you the elapsed time in days, hours, minutes and seconds since the datase instance started. To run this query you need to have previlleges granted to you to acces the v$instance.

select trunc(sysdate - to_date(to_char(a.value)||b.value,'jsssss')) DAYS,
       trunc(mod(sysdate -
to_date(to_char(a.value)||b.value,'jsssss'),1) * 24) HOURS,

       trunc(mod(mod(sysdate -
to_date(to_char(a.value)||b.value,'jsssss'),1) * 24,1) * 60) MINUTES,

       round(mod(mod(mod(sysdate -
to_date(to_char(a.value)||b.value,'jsssss'),1) * 24,1) * 60,1) * 60) SECONDS
from v$instance a, v$instance b
where a.key like '%JULI%'
  and b.key like '%SECOND%';

Venkateswara Rao

/-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-\

| Venkateswara R.Polisetti                 Email: vrao_at_sctcorp.com  |
| SCT Utility Systems, Inc.                  Phone(O): (803) 935-8160     |
| 9 Science Court                                                (R): (803) 736-1609     |
| Columbia, SC  29203-9344                                                                     |
\-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-/ Received on Fri Aug 16 1996 - 00:00:00 CEST

Original text of this message