Oracle

ID #1063

Informations sur les tablespaces de l'instance

Un select pour voir les informations sur les tablespaces de l'instance oracle:

Select t.tablespace_name  AS TXTABLESPACE,
       'Datafile'         AS TXFILETYPE,
       t.status           AS TXSTATUS,
       ROUND((MAX(d.bytes)/1024/1024) - (SUM(decode(f.bytes, NULL,0, f.bytes))/1024/1024),2) AS NBUSEDMB,
       ROUND(SUM(decode(f.bytes, NULL,0, f.bytes))/1024/1024,2)                              AS NBFREEMB,
       t.initial_extent   AS NBINITIALEXTENT,
       t.next_extent      AS NBNEXTEXTENT,
       t.min_extents      AS NBMINEXTENTS,
       t.max_extents      AS NBMAXEXTENTS,
       t.pct_increase     AS PCPCTINCREASE,
       SUBSTR(d.file_name,1,80) AS TXDATAFILENAME
FROM   DBA_FREE_SPACE f,
       DBA_DATA_FILES d,
       DBA_TABLESPACES t
WHERE  t.tablespace_name = d.tablespace_name
AND    f.tablespace_name(+) = d.tablespace_name
AND    f.file_id(+) = d.file_id
GROUP BY t.tablespace_name, d.file_name, t.initial_extent,
         t.next_extent, t.min_extents, t.max_extents,
         t.pct_increase, t.status  
UNION ALL
SELECT h.tablespace_name,
       'Tempfile',
       t.status,
       ROUND(SUM(NVL(p.bytes_used, 0))/ 1048576, 2),
       ROUND(SUM((h.bytes_free + h.bytes_used) - NVL(p.bytes_used, 0)) / 1048576, 2),
       -1, -- initial extent
       -1, -- initial extent
       -1, -- min extents
       -1, -- max extents
       -1, -- pct increase
       t.file_name
FROM   sys.V_$TEMP_SPACE_HEADER h,
       sys.V_$TEMP_EXTENT_POOL p,
       sys.DBA_TEMP_FILES t
WHERE  p.file_id(+) = h.file_id
AND    p.tablespace_name(+) = h.tablespace_name
AND    h.file_id = t.file_id
AND    h.tablespace_name = t.tablespace_name
GROUP BY h.tablespace_name, t.status, t.file_name
ORDER BY 1, 4 DESC;


Tags: -

Related entries:

Dernière mise à jour: 2007-12-29 20:15
Auteur: Michel Preti
Révision: 1.0

Digg it! Imprimer cet article Envoyer à un ami version PDF
Propose a translation for Propose a translation for
Merci de noter cette entrée:

Moyenne des notes: 5 sur 5 (1 Votes)

complètement inutile 1 2 3 4 5 indispensable

Vous ne pouvez pas commenter cet enregistrement