Oracle extents are sets of logically contiguous blocks allocated in an Oracle database. Extents are units of database space distribution made up of data blocks.
In the Oracle database architecture, the first set of contiguous blocks, set up automatically when a database segment is created, is called the initial extent. After the initial extent has been filled, the Oracle Database software allocates more extents to the segment automatically. These are known as next extents. The total number of Oracle extents that can be allocated in a database is limited by the amount of storage space available or, in some cases, by the program used.
The term extent is also sometimes used in reference to any contiguous space -- for example, a set of sectors -- on a hard drive that is reserved for a particular file, folder or application.
Data blocks and extents
Oracle Database stores data in data blocks, which can also be called logical blocks. A data block is the smallest unit of data within a database. One data block can correspond to a certain number of bytes of physical database space on a disk.
Extents are made up of groups of data blocks. The amount of logical database storage that is greater than an extent is a database segment.
Extent allocation and deallocation
Oracle allocates extents depending on whether they are locally managed or dictionary managed. When there is free space within a tablespace, an extent can be allocated by first determining a candidate datafile and then searching the datafile's bitmap for a certain number of free data blocks. If it does not have enough free space, the database looks to another datafile.
Oracle's database provides a segment advisor for IT pros to determine if an object has any space available for deallocation based on the amount of space fragmentation within the subject. The extents of a segment do not return to the tablespace unless the schema object within the segment is dropped.
Extents and database segments
A database segment is a set of extents that contains all of the data necessary for a logical storage structure within a tablespace.
For every table that is created, Oracle Database allocates extents to form the table's data segment. Oracle provides space for segments within extents, so when a segment's existing extents are full, the software provides another extent for that segment.