You can extend the size of a tablespace by increasing the size of an existing datafile by typing the following command
SQL> alter database ica datafile ‘/u01/oracle/data/icatbs01.dbf’ resize 100M;
This will increase the size from 50M to 100M
You can also extend the size of a tablespace by adding a new datafile to a tablespace. This is useful if the size of existing datafile is reached o/s file size limit or the drive where the file is existing does not have free space. To add a new datafile to an existing tablespace give the following command.
SQL> alter tablespace add datafile ‘/u02/oracle/ica/icatbs02.dbf’ size 50M;
You can also use auto extend feature of datafile. In this, Oracle will automatically increase the size of a datafile whenever space is required. You can specify by how much size the file should increase and Maximum size to which it should extend.
To make a existing datafile auto extendable give the following command
SQL> alter database datafile ‘/u01/oracle/ica/icatbs01.dbf’ auto extend ON next 5M maxsize 500M;
You can also make a datafile auto extendable while creating a new tablespace itself by giving the following command.
SQL> create tablespace ica datafile ‘/u01/oracle/ica/icatbs01.dbf’ size 50M auto extend ON next 5M maxsize 500M;
You can decrease the size of tablespace by decreasing the datafile associated with it. You decrease a datafile only up to size of empty space in it. To decrease the size of a datafile give the following command
SQL> alter database datafile ‘/u01/oracle/ica/icatbs01.dbf’ resize 30M;
A free extent in a dictionary-managed tablespace is made up of a collection of contiguous free blocks. When allocating new extents to a tablespace segment, the database uses the free extent closest in size to the required extent. In some cases, when segments are dropped, their extents are deallocated and marked as free, but adjacent free extents are not immediately recombined into larger free extents. The result is fragmentation that makes allocation of larger extents more difficult.
You should often use the ALTER TABLESPACE ... COALESCE statement to manually coalesce any adjacent free extents. To Coalesce a tablespace give the following command
SQL> alter tablespace ica coalesce;
Interface Computers Academy © 2007-2017 All Rights Reserved