Monday, October 23, 2017

Query to get Table Space Details

SELECT dts.tablespace_name,
       (ddf.bytes / 1024 / 1024 / 1024) "AvailSpace",
       (ddf.bytes - (dfs.bytes)) / 1024 / 1024 / 1024 "UsedSpace",
       (dfs.bytes / 1024 / 1024 / 1024) "FreeSpace",
       TO_CHAR ( ( (ddf.bytes - (dfs.bytes)) / ddf.bytes * 100), '990.00')
          used
  FROM sys.dba_tablespaces dts,
       (  SELECT tablespace_name, SUM (bytes) bytes
            FROM dba_data_files
        GROUP BY tablespace_name) ddf,
       (  SELECT tablespace_name, SUM (bytes) bytes
            FROM dba_free_space
        GROUP BY tablespace_name) dfs
 WHERE     dts.tablespace_name = ddf.tablespace_name(+)
       AND dts.tablespace_name = dfs.tablespace_name(+)
       AND NOT (    dts.extent_management LIKE 'LOCAL'
                AND dts.contents LIKE 'TEMPORARY')
UNION ALL
SELECT dts.tablespace_name,
       (dtf.bytes / 1024 / 1024 / 1024) "AvailSpace",
       (t.bytes) / 1024 / 1024 / 1024 "UsedSpace",
       (dtf.bytes - (t.bytes)) / 1024 / 1024 / 1024 "FreeSpace",
       TO_CHAR ( (t.bytes / dtf.bytes * 100), '990.00') "Used %"
  FROM sys.dba_tablespaces dts,
       (  SELECT tablespace_name, SUM (bytes) bytes
            FROM dba_temp_files
        GROUP BY tablespace_name) dtf,
       (  SELECT tablespace_name, SUM (bytes_used) bytes
            FROM v$temp_space_header
        GROUP BY tablespace_name) t
 WHERE     dts.tablespace_name = dtf.tablespace_name(+)
       AND dts.tablespace_name = t.tablespace_name(+)
       AND dts.extent_management LIKE 'LOCAL'
       AND dts.contents LIKE 'TEMPORARY';

No comments:

Post a Comment

SupplierAddressImportTemplate.xlsm South Africa Suburb Field mapping in POZ_SUPPLIER_ADDRESSES_INT

Suburb mpping in Supplier Address Import Template will be mapped to Address Element Attribute2 (HZ_LOCATIONS. ADDR_ELEMENT_ATTRIBUTE2)