[ owner @ 17.07.2007. 16:53 ] @
Pozdrav,

da li mozda vec neko ima "select" pomocu kojeg se moze videti procentualna zauzetost tablespace_ova
ili da mi napise iz koje tabele ili view_a mogu to izracunati.
[ _simma_ @ 18.07.2007. 06:28 ] @
Ajde prvo probaj sam pa ako ne uradiš ništa ti javi:

dba_tablespaces
dba_data_files
dba_free_space
[ owner @ 18.07.2007. 08:06 ] @
Evo ja sam pokusao preko druge tabele, mislim da je ok.
Ako mozes posalji mi svoj predlog.

select TAB.*
,round(TAB.SUM_BYTES / (sum(TAB.SUM_BYTES)
over (partition by TAB.TABLESPACE_NAME)) * 100) PROCENT
from
(
select s.tablespace_name, sum(s.bytes) sum_bytes, sum(s.blocks) sum_blocks, 'Zauzeto' status
from dba_segments s
where s.tablespace_name like 'SW_%'
group by s.tablespace_name
UNION
select fs.tablespace_name, sum(fs.bytes) sum_bytes, sum(fs.blocks) sum_blocks, 'Slobodno' status
from dba_free_space fs
where fs.tablespace_name like 'SW_%'
group by fs.tablespace_name
) TAB
order by TAB.tablespace_name, TAB.status;

pozdrav
[ _simma_ @ 18.07.2007. 13:17 ] @
Da izvineš - ovo ti ne radi ;-)
Pogledaću posle ako ti se ne žuri mnogo.
[ Raspucin @ 19.07.2007. 07:54 ] @
Nadam se da koristis SQL*Plus, ako ne koristis isti izbaci formatiranje kolona i iskoristi samo upit.


Code:


column dummy noprint
column  pct_used format 999.9       heading "%|Used"
column  name    format a16      heading "Tablespace Name"
column  Kbytes   format 999,999,999    heading "KBytes"
column  used    format 999,999,999   heading "Used"
column  free    format 999,999,999  heading "Free"
column  largest    format 999,999,999  heading "Largest"
break   on report
compute sum of kbytes on report
compute sum of free on report
compute sum of used on report

select nvl(b.tablespace_name,
             nvl(a.tablespace_name,'UNKOWN')) name,
       kbytes_alloc kbytes,
       kbytes_alloc-nvl(kbytes_free,0) used,
       nvl(kbytes_free,0) free,
       ((kbytes_alloc-nvl(kbytes_free,0))/
                          kbytes_alloc)*100 pct_used,
       nvl(largest,0) largest
from ( select sum(bytes)/1024 Kbytes_free,
              max(bytes)/1024 largest,
              tablespace_name
       from  sys.dba_free_space
       group by tablespace_name ) a,
     ( select sum(bytes)/1024 Kbytes_alloc,
              tablespace_name
       from sys.dba_data_files
       group by tablespace_name )b
where a.tablespace_name (+) = b.tablespace_name
order by 1



Pozdrav.
[ owner @ 19.07.2007. 08:10 ] @
Raspucin, hvala na odgovoru!!
[ _simma_ @ 19.07.2007. 11:20 ] @
Ajd da ne bude bez nas ;-)

Code:

COL 'Size (M)' for a20
COL 'Used (M)' for a30
COL 'Used %' for a10
SELECT d.status "Status", d.tablespace_name "Name", d.CONTENTS "Type",
       d.extent_management "Extent Management",
       TO_CHAR (NVL (a.BYTES / 1024 / 1024, 0), '99,999,990.900') "Size (M)",
          TO_CHAR (NVL (a.BYTES - NVL (f.BYTES, 0), 0) / 1024 / 1024,
                   '99999999.999'
                  )
       || '/'
       || TO_CHAR (NVL (a.BYTES / 1024 / 1024, 0), '99999999.999') "Used (M)",
       TO_CHAR (NVL ((a.BYTES - NVL (f.BYTES, 0)) / a.BYTES * 100, 0),
                '990.00'
               ) "Used %"
  FROM SYS.dba_tablespaces d,
       (SELECT   tablespace_name, SUM (BYTES) BYTES
            FROM dba_data_files
        GROUP BY tablespace_name) a,
       (SELECT   tablespace_name, SUM (BYTES) BYTES
            FROM dba_free_space
        GROUP BY tablespace_name) f
 WHERE d.tablespace_name = a.tablespace_name(+)
   AND d.tablespace_name = f.tablespace_name(+)
   AND NOT (d.extent_management LIKE 'LOCAL' AND d.CONTENTS LIKE 'TEMPORARY')
UNION ALL
SELECT d.status "Status", d.tablespace_name "Name", d.CONTENTS "Type",
       d.extent_management "Extent Management",
       TO_CHAR (NVL (a.BYTES / 1024 / 1024, 0), '99,999,990.900') "Size (M)",
          TO_CHAR (NVL (t.BYTES, 0) / 1024 / 1024, '99999999.999')
       || '/'
       || TO_CHAR (NVL (a.BYTES / 1024 / 1024, 0), '99999999.999') "Used (M)",
       TO_CHAR (NVL (t.BYTES / a.BYTES * 100, 0), '990.00') "Used %"
  FROM SYS.dba_tablespaces d,
       (SELECT   tablespace_name, SUM (BYTES) BYTES
            FROM dba_temp_files
        GROUP BY tablespace_name) a,
       (SELECT   tablespace_name, SUM (bytes_cached) BYTES
            FROM v$temp_extent_pool
        GROUP BY tablespace_name) t
 WHERE d.tablespace_name = a.tablespace_name(+)
   AND d.tablespace_name = t.tablespace_name(+)
   AND d.extent_management LIKE 'LOCAL'
   AND d.CONTENTS LIKE 'TEMPORARY'
/