Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Mailing Lists -> Oracle-L -> RE: Displaying V$SYSSTAT row values in columns... any better way?
Thanks Stephane,
> why the Unix format?
Actually it's to load data into RRD or ORCA.
Steve
-----Original Message-----
Sent: Thursday, March 07, 2002 1:54 PM
To: Multiple recipients of list ORACLE-L
way?
Importance: High
"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)
-- HTH, Stephane Faroult Oriole Ltd -- Please see the official ORACLE-L FAQ: http://www.orafaq.com -- Author: Orr, Steve INET: sorr_at_rightnow.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 Thu Mar 07 2002 - 15:43:45 CST
![]() |
![]() |