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

Home -> Community -> Mailing Lists -> Oracle-L -> Re: Database up longer that host?

Re: Database up longer that host?

From: Meg Crocker <crocker_at_monstertrak.com>
Date: Mon, 02 Dec 2002 17:33:45 -0800
Message-ID: <F001.00510545.20021202173345@fatcity.com>

On Mon, 2 Dec 2002, Stephane Faroult wrote:

> Stephen Andert wrote:
> >
> > I use a script named db_uptime.sql (I think I got it from the list here)
> > to calculate how long the database has been up. The output compares
> > nicely to the unix uptime command.
>
> I hope that the query doesn't come from the list, because it is
> wrong. The error is to apply floor() before multiplying by 24 or 60 -
> you have tremendous rounding errors.
> My own database has not been up long enough to be 100% sure about it but
> I believe the following to be correct :

Hi:

    Neither of the scripts works for me. Try this?

select

    'Host Name : '||host_name|| chr(10)||
    'Instance Name : '||instance_name|| chr(10)||
    'Uptime : '     ||floor(xx)||'days '
                    || floor( 24 * (xx - floor(xx)) ) || 'hours '
                    || round( 60 * (24 * xx - floor(24 * xx))) || 'minutes '
    from (
             select host_name,instance_name ,(sysdate-STARTUP_TIME) xx
             from v$instance
         )

/

Meg Crocker

-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.com
-- 
Author: Meg Crocker
  INET: crocker_at_monstertrak.com

Fat City Network Services    -- 858-538-5051 http://www.fatcity.com
San Diego, California        -- Mailing list and web hosting services
---------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message
to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from).  You may
also send the HELP command for other information (like subscribing).
Received on Mon Dec 02 2002 - 19:33:45 CST

Original text of this message

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