Friday , July 21 2017
Home / Oracle DBA / Overview of Segments

Overview of Segments

Overview of Segments

A segment is a set of extents that contains all the data for a logical storage structure within a table space. As explained in “Logical Space Management”, Oracle Database manages segment
space automatically or manually. This section assumes the use of ASSM.
You can use the DBMS_SPACE_ADMIN package to manage segments for empty objects. Starting with Oracle Database 11g Release 2 (, you can use this PL/SQL package to do the following:
Manually materialize segments for empty tables or partitions that do not have segments created
Remove segments from empty tables or partitions that currently have an empty segment allocated
Temporary Segments
When processing a query, Oracle Database often requires temporary work space for intermediate stages of SQL statement execution. Typical operations that may require a temporary segment include sorting, hashing, and merging bitmaps. While creating an index, Oracle Database also places index segments into temporary segments and then converts them into permanent segments when the index is complete.
Oracle Database does not create a temporary segment if an operation can be performed in memory. However, if memory use is not possible, then the database automatically allocates a temporary segment on disk.
Undo Segments
Oracle Database maintains records of the actions of transactions, collectively known as undo data. Oracle Database uses undo to do the following:
Roll back an active transaction
Recover a terminated transaction
Provide read consistency
Perform some logical flashback operations
Oracle Database stores undo data inside the database rather than in external logs. Undo data is stored in blocks that are updated just like data blocks, with changes to these blocks generating redo. In this way, Oracle Database can efficiently access undo data without needing to read external logs.  Undo data is stored in an undo table space. Oracle Database provides a fully automated mechanism, known as automatic undo management mode, for managing undo segments and space in an undo table space.
Undo Segments and Transactions
When a transaction starts, the database binds (assigns) the transaction to an undo segment, and therefore to a transaction table, in the current undo table space. In rare circumstances, if the database instance does not have a designated undo table space, then the transaction binds to the system undo segment. Multiple active transactions can write concurrently to the same undo segment or to different segments.
Transaction Rollback
When a ROLLBACK statement is issued, the database uses undo records to roll back changes made to the database by the uncommitted transaction. During recovery, the database rolls back any uncommitted changes applied from the online redo log to the data files. Undo records provide read consistency by maintaining the before image of the data for users accessing data at the same time that another user is changing it.
Segment Space and the High Water Mark
To manage space, Oracle Database tracks the state of blocks in the segment. The high water mark (HWM) is the point in a segment beyond which data blocks are un formatted and have never been used.
MSSM uses free lists to manage segment space. At table creation, no blocks in the segment are formatted. When a session first inserts rows into the table, the database searches the free list for usable blocks. If the database finds no usable blocks, then it pre formats a group of blocks, places them on the free list, and begins inserting data into the blocks. In MSSM, a full table scan reads all blocks below the HWM.
ASSM does not use free lists and so must manage space differently. When a session first inserts data into a table, the database formats a single bitmap block instead of pre formatting a group of blocks as in MSSM. The bitmap tracks the state of blocks in the segment, taking the place of the free list. The database uses the bitmap to find free blocks and then formats each block before filling it with data. ASSM spread out inserts among blocks to avoid concurrency issues.
View More:
Overview of the Online Redo Log
Overview of Control Files
Overview of Data Files



Check Also


DATABASE LINKS: What are the db links? create a link from one database to another …

Leave a Reply

Your email address will not be published. Required fields are marked *