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: Displaying V$SYSSTAT row values in columns... any better way?

Re: Displaying V$SYSSTAT row values in columns... any better way?

From: Stephane Faroult <sfaroult_at_oriole.com>
Date: Wed, 13 Mar 2002 14:04:52 -0800
Message-ID: <F001.004282C8.20020313140452@fatcity.com>


"Orr, Steve" wrote:
>
> 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';
> ---------------------------------------------------------------------
>
> Is there a better way to do this?
>
> 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
-- 
HTH,

Stephane Faroult
Oriole Ltd
-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.com
-- 
Author: Stephane Faroult
  INET: sfaroult_at_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_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).


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_at_fatcity.com for clarification. ------_=_NextPart_001_01C1C75D.6F85A500-- -- Please see the official ORACLE-L FAQ: http://www.orafaq.com -- Author: Stephane Faroult INET: sfaroult_at_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_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 Wed Mar 13 2002 - 16:04:52 CST

Original text of this message

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