Return-Path: <root@fatcity.cts.com>
Received: from newsfeed.cts.com (newsfeed.cts.com [209.68.248.164])
 by naude.co.za (8.11.2/8.11.2) with SMTP id g2DNCXR13854
 for <oracle-l@naude.co.za>; Wed, 13 Mar 2002 18:12:33 -0500
Received: from fatcity.UUCP (uucp@localhost)
 by newsfeed.cts.com (8.9.3/8.9.3) with UUCP id OAA42146;
 Wed, 13 Mar 2002 14:53:44 -0800 (PST)
Received: by fatcity.com (26-Feb-2001/v1.0g-b70/bab) via UUCP id 004282C8; Wed, 13 Mar 2002 14:04:52 -0800
Message-ID: <F001.004282C8.20020313140452@fatcity.com>
Date: Wed, 13 Mar 2002 14:04:52 -0800
To: Multiple recipients of list ORACLE-L <ORACLE-L@fatcity.com>
X-Comment: Oracle RDBMS Community Forum
X-Sender: "Stephane Faroult" <sfaroult@oriole.com>
Sender: root@fatcity.com
Reply-To: ORACLE-L@fatcity.com
Errors-To: ML-ERRORS@fatcity.com
From: "Stephane Faroult" <sfaroult@oriole.com>
Subject: Re: Displaying V$SYSSTAT row values in columns... any better way?
Organization: Fat City Network Services, San Diego, California
X-ListServer: v1.0g, build 70; ListGuru (c) 1996-2001 Bruce A. Bergman
Precedence: bulk
Mime-Version: 1.0
Content-Type: multipart/mixed;	boundary="----_=_NextPart_001_01C1C75D.6F85A500"
------_=_NextPart_001_01C1C75D.6F85A500
Content-Type: text/plain;
 charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

"Orr, Steve" wrote:
>=20
> I want to display V$SYSSTAT row values in columns. The current query:
> ---------------------------------------------------------------------
> select  to_char(trunc(86400*(sysdate-to_date(
>                 '01/01/70','mm/dd/rr hh24:mi:ss')))),
>         'stat38:stat39:stat40:stat41:stat44:stat105:'||
>         'stat106:stat158:stat159:stat188:stat189:stat190',
>         max(decode(se.statistic#, 38,se.value,0))||':'||
>         max(decode(se.statistic#, 39,se.value,0))||':'||
>         max(decode(se.statistic#, 40,se.value,0))||':'||
>         max(decode(se.statistic#, 41,se.value,0))||':'||
>         max(decode(se.statistic#, 44,se.value,0))||':'||
>         max(decode(se.statistic#,105,se.value,0))||':'||
>         max(decode(se.statistic#,106,se.value,0))||':'||
>         max(decode(se.statistic#,158,se.value,0))||':'||
>         max(decode(se.statistic#,159,se.value,0))||':'||
>         max(decode(se.statistic#,188,se.value,0))||':'||
>         max(decode(se.statistic#,189,se.value,0))||':'||
>         max(decode(se.statistic#,190,se.value,0))
> from    V$sysstat se
> where   se.statistic# in(0,38,39,40,41,44,105,106,158,159,188,189,190)
> group by to_char(trunc(86400*(sysdate-to_date(
>                 '01/01/70','mm/dd/rr hh24:mi:ss')))),
>         'stat38:stat39:stat40:stat41:stat44:stat105:'||
>         'stat106:stat158:stat159:stat188:stat189:stat190';
> ---------------------------------------------------------------------
>=20
> Is there a better way to do this?
>=20
> This Best SQL Contest sponsored by...
> Steve Orr,
> Bozeman, MT

  1  select sum(decode(statistic#, 38, value, 0)) stat38,
  2	    sum(decode(statistic#, 39, value, 0)) stat39
  3* from v$sysstat
SQL> /

    STAT38     STAT39
---------- ----------
       454	 7567

 Since I suspect you of wanting the date (why the Unix format?) at the
beginning of the line to load everything into
your-favourite-spreadsheet-here and impress higher levels of the food
chain with dazzling graphics, something like this might better suit your
needs :

  1  select sysdate, stat38, stat39
  2  from (select sum(decode(statistic#, 38, value, 0)) stat38,
  3		  sum(decode(statistic#, 39, value, 0)) stat39
  4*	   from v$sysstat)
SQL> /

SYSDATE       STAT38	 STAT39
--------- ---------- ----------
07-MAR-02	 474	   7633


--=20
HTH,

Stephane Faroult
Oriole Ltd
--=20
Please see the official ORACLE-L FAQ: http://www.orafaq.com
--=20
Author: Stephane Faroult
  INET: sfaroult@oriole.com

Fat City Network Services    -- (858) 538-5051  FAX: (858) 538-5051
San Diego, California        -- Public Internet access / Mailing Lists
--------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message
to: ListGuru@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).

------_=_NextPart_001_01C1C75D.6F85A500
Content-Type: application/ms-tnef;
 name="winmail.dat"
Content-Transfer-Encoding: 7bit

<encoded content removed -- binaries not allowed by ListGuru>

------_=_NextPart_001_01C1C75D.6F85A500--
Content-Type: text/plain; name="ReadMe.txt"; charset="us-ascii"
Content-Transfer-Encoding: 7bit

The previous attachment was filtered out by the ListGuru mailing
software at fatcity.com because binary attachments are not appropriate
for mailing lists.  If you want a copy of the attachment which was
removed, contact the sender directly and ask for it to be sent to
you by private E-mail.

This warning is inserted into all messages containing binary
attachments which have been removed by ListGuru.  If you have questions
about this message, contact Postmaster@fatcity.com for clarification.

------_=_NextPart_001_01C1C75D.6F85A500--
-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.com
-- 
Author: Stephane Faroult
  INET: sfaroult@oriole.com

Fat City Network Services    -- (858) 538-5051  FAX: (858) 538-5051
San Diego, California        -- Public Internet access / Mailing Lists
--------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message
to: ListGuru@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).

