Wednesday, February 6, 2019

Tablespace with datafiles in tree view

SELECT DECODE(file_name, 'M', tablespace_name, LPAD(' --->',5) || file_name) tablespace_name
FROM
(SELECT * FROM
(SELECT tablespace_name, 'M' file_name
FROM dba_tablespaces
UNION
SELECT dba_tablespaces.tablespace_name, dba_data_files.file_name || '  ' ||
 '(Allocated:' || ROUND(bytes/(1024*1024),2) || 'MB)' FROM
dba_tablespaces, dba_data_files
WHERE dba_tablespaces.tablespace_name = dba_data_files.tablespace_name)
--WHERE tablespace_name = 'USER_DATA'
ORDER BY tablespace_name, file_name DESC);

No comments:

Post a Comment