日期:2014-05-16  浏览次数:20479 次

等待事件“inactive session”剖析过程。

    今天是2014-03-21,应用侧发过信息来说undo表空间不足,需要扩展undo表空间,可是目前undo表空间在我接手该数据库之前就已经被调整为30GB,且数据库处理的数据事务并不是很多很大,因此仅仅增加undo表空间那将不是最佳选择。应用反馈信息如下:

 首先暂且不说“inactive session”该等待事件吧。如下摘录oracle 联机手册 concept:

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 tablespace. Oracle Database provides a fully automated mechanism, known as automatic undo management mode, for managing undo segments and space in an undo tablespace.

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 tablespace. In rare circumstances, if the database instance does not have a designated undo tablespace, then the transaction binds to the system undo segment.

Multiple active transactions can write concurrently to the same undo segment or to different segments. For example, transactions T1 and T2 can both write to undo segment U1, or T1 can write to U1 while T2 writes to undo segment U2.

Conceptually, the extents in an undo segment form a ring. Transactions write to one undo extent, and then to the next extent in the ring, and so on in cyclical fashion. Figure 12-20 shows two transactions, T1 and T2, which begin writing in the third extent (E3) of an undo segment and continue writing to the fourth extent (E4).

Figure 12-20 Ring of Allocated Extents in an Undo Segment

Description of Figure 12-20 follows
Description of "Figure 12-20 Ring of Allocated Extents in an Undo Segment "

At any given time, a transaction writes sequentially to only one extent in an undo segment, known as the current extent for the transaction. Multiple active transactions can write simultaneously to the same current extent or to different current extents. Figure 12-20 shows transactions T1 and T2 writing simultaneously to extent E3. Within an undo extent, a data block contains data for only one transaction.