--Table Space usage Query
SELECT TBS table space name,
SUM (totalm) total size M,
SUM (USEDM) has used space m,
SUM (REMAINEDM) remaining space m,
SUM (USEDM)/sum (Totalm) *100 percent used,
SUM (REMAINEDM)/sum (totalm) *100 remaining percentage
From (
SELECT b.file_id ID,
B.tablespace_name TBS,
B.file_name name,
b.bytes/1024/1024 Totalm,
(B.bytes-sum (NVL (a.bytes,0)))/1024/1024 usedm,
Sum (NVL (a.bytes,0)/1024/1024) remainedm,
Sum (NVL (a.bytes,0)/(b.bytes) *100),
(+-(SUM (NVL (a.bytes,0))/(b.bytes) *100))
From Dba_free_space A,dba_data_files b
WHERE a.file_id = b.file_id
GROUP by B.tablespace_name,b.file_name,b.file_id,b.bytes
ORDER by B.tablespace_name
)
GROUP by TBS
--Querying the Tablespace file path
SELECT T.tablespace_name,d.file_name,d.autoextensible,round (D.bytes/(1024x768), 2) Bytes_mb,round (d.maxbytes/( * 1024x768), 2) Maxbytes_mb,d.status
From Dba_tablespaces t,dba_data_files D
WHERE T.tablespace_name =d.tablespace_name
ORDER by Tablespace_name,file_name;
--Extended size
ALTER DATABASE datafile ' C:\APP\ADMINISTRATOR\PRODUCT\11.2.0\DBHOME_1\DATABASE\SDE ' autoextend on next 50M MAXSIZE UNLIMITED;
Expansion of Oracle Tablespace