Hi,
I have some databases on servers with limited disk space. Some of the tablespaces are alerting that they are near full, however when I compare the size of the tablepsace using 'dba_data_files' and the acutal data file on disk using OS commands they are very different. For Example:
SQL> column dummy noprint
compute sum of "Size MB" on dummy
break on dummy
select null dummy, TABLESPACE_NAME, file_name, sum(bytes)/1024/1024 "Size MB"
from dba_data_files
where TABLESPACE_NAME in ('KPM_DATA','KPM_INDEX')
group by TABLESPACE_NAME, file_name;SQL> SQL> SQL> 2 3 4
TABLESPACE_NAME FILE_NAME Size MB
------------------------------ ------------------------------------------------------------ ----------
KPM_INDEX /oracle/d01/oradata/AEJS/KPM_INDEX.dbf 13500
KPM_DATA /oracle/d01/oradata/AEJS/KPM_DATA01.dbf 17500
----------
<b>31000</b>
SQL> ! du -shc /oracle/d01/oradata/AEJS/KPM_*.dbf
5.6G /oracle/d01/oradata/AEJS/KPM_DATA01.dbf
5.5G /oracle/d01/oradata/AEJS/KPM_INDEX.dbf
<b>11G total</b>
SQL>
Can you please explain why there is such a large difference between what size the database thinks the tablespace is and what the OS says the data files are?
I have even expdp/impdp the tablespaces in an attempt to defragment the tables but there is no change.
Thanks
Kelvin
Hi,
Thanks for the fast response. Below is what you requested:
1 select tablespace_name, file_name, bytes
2 from dba_data_files
3* where TABLESPACE_NAME in ('KPM_DATA','KPM_INDEX')
4 /
TABLESPACE_N FILE_NAME BYTES
------------ ---------------------------------------- --------------------
KPM_DATA /oracle/d01/oradata/AEJS/KPM_DATA01.dbf 18,350,080,000
KPM_INDEX /oracle/d01/oradata/AEJS/KPM_INDEX.dbf 14,155,776,000
SQL> ! ls -l /oracle/d01/oradata/AEJS/KPM_*.dbf
-rw-r-----. 1 oracle oinstall 18350088192 Feb 17 12:56 /oracle/d01/oradata/AEJS/KPM_DATA01.dbf
-rw-r-----. 1 oracle oinstall 14155784192 Feb 17 12:56 /oracle/d01/oradata/AEJS/KPM_INDEX.dbf
I can now see that they are stored as sparse files. What I dont understand is why? I thought only temporary tablespaces are stored as sparse files.
thanks
Kelvin