檢視“oracle”臨時表空間當前使用了多少空間,可按照以下程式。
SELECT d.tablespace_name "Name", d.status "Status",
TO_CHAR (NVL (a.BYTES / 1024 / 1024, 0), "99,999,990.90") "Size (M)",
TO_CHAR (NVL (a.BYTES - NVL (f.BYTES, 0), 0) / 1024 / 1024,
"99999999.99"
) USE,
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,
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
TO_CHAR (NVL (t.BYTES, 0) / 1024 / 1024, "99999999.99") USE,
TO_CHAR (NVL (t.BYTES / a.BYTES * 100, 0), "990.00") "Used %"
FROM dba_temp_files
(SELECT tablespace_name, SUM (bytes_cached) BYTES
FROM v$temp_extent_pool
GROUP BY tablespace_name) t
AND d.tablespace_name = t.tablespace_name(+)
AND d.extent_management LIKE "LOCAL"
AND d.CONTENTS LIKE "TEMPORARY";
檢視“oracle”臨時表空間當前使用了多少空間,可按照以下程式。
SELECT d.tablespace_name "Name", d.status "Status",
TO_CHAR (NVL (a.BYTES / 1024 / 1024, 0), "99,999,990.90") "Size (M)",
TO_CHAR (NVL (a.BYTES - NVL (f.BYTES, 0), 0) / 1024 / 1024,
"99999999.99"
) USE,
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.tablespace_name "Name", d.status "Status",
TO_CHAR (NVL (a.BYTES / 1024 / 1024, 0), "99,999,990.90") "Size (M)",
TO_CHAR (NVL (t.BYTES, 0) / 1024 / 1024, "99999999.99") USE,
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";