After dropping large number of tables or users the space occupied by tables/users will not be released in oracle.
As the allocation happened for the first time the space is occupied and it may be required in future, thus the space occupied remain reserved for future requirements.
The space occupied by data-files remain reserved unless an explicit way to resize has been performed.
One of the ways to reduce the data-file size is to know the free-size of the data-files, so as to reduce the data-file size based on the free-size.
SQL> select a.file_name,round(a.bytes/1024/1024) totalsize,b.freesize from dba_data_files a, (select file_id,round(sum(bytes/1024/1024)) freesize from dba_free_space group by file_id) b where a.file_id=b.file_id(+);
FILE_NAME
--------------------------------------------------------------------------------
TOTALSIZE FREESIZE
---------- ----------
/oracle/dbs/DBORA/system01.dbf
800 1
/oracle/dbs/DBORA/DBORAINDEX.dbf
6274 3283
/oracle/dbs/DBORA/sysaux01.dbf
550 36
From the above result the freesize of the datafiles for the database are listed. The free-size is listed in MB, relating with that the data-file sizes can be resized as like below.
SQL> alter database datafile '/oracle/dbs/DBORA/DBORAINDEX.dbf' RESIZE 5G;
Database altered.
SQL> select a.file_name,round(a.bytes/1024/1024) totalsize,b.freesize from dba_data_files a, (select file_id,round(sum(bytes/1
024/1024)) freesize from dba_free_space group by file_id) b where a.file_id=b.file_id(+);
FILE_NAME
--------------------------------------------------------------------------------
TOTALSIZE FREESIZE
---------- ----------
/oracle/dbs/DBORA/system01.dbf
800 1
/oracle/dbs/DBORA/DBORAINDEX.dbf
5120 2129
/oracle/dbs/DBORA/sysaux01.dbf
550 36
No comments:
Post a Comment