Advertisement
saleks28

Untitled

Sep 26th, 2020
337
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
SQL 1.09 KB | None | 0 0
  1. SELECT a.tablespace_name                           Tablespace,
  2.        ROUND(( 1 - ( fbytes / tbytes ) ) * 100, 1) Percent_Used,
  3.        ROUND(tbytes / 1024 / 1024, 1)              MB_Total,
  4.        ROUND(fbytes / 1024 / 1024, 1)              MB_Free,
  5.        ROUND(( tbytes - fbytes ) / 1024 / 1024, 1) MB_Used
  6. FROM   (SELECT tablespace_name,
  7.                SUM(bytes) tbytes
  8.         FROM   dba_data_files
  9.         GROUP  BY tablespace_name
  10.         UNION ALL
  11.         SELECT tablespace_name,
  12.                SUM(bytes) tbytes
  13.         FROM   dba_temp_files
  14.         GROUP  BY tablespace_name) a
  15.        LEFT OUTER JOIN (SELECT tablespace_name,
  16.                                SUM(bytes) fbytes
  17.                         FROM   dba_free_space
  18.                         GROUP  BY tablespace_name
  19.                         UNION ALL
  20.                         SELECT tablespace_name,
  21.                                SUM(user_bytes) fbytes
  22.                         FROM   dba_temp_files
  23.                         GROUP  BY tablespace_name) b
  24.                     ON a.tablespace_name = b.tablespace_name
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement