search
HomeDatabaseMysql Tutorialundo系列学习之Oracle IMU及Redo Private Strands技术

在传统的undo管理模式中,oracle对undo和data block是一视同仁。这样大致会有三种弊端:1)事务开始时,存放事务表的段头不在内存

在传统的undo管理模式中,Oracle对undo和data block是一视同仁。这样大致会有三种弊端:

1)事务开始时,存放事务表的段头不在内存,server process需要将此i/o上来

2)存放旧值的回滚块不在内存

3)rollback或者CR读的时候,所需的回滚块被DBWn写到磁盘,oracle也需将此i/o,可能会产生大量的consistent gets和physical reads

由此,我们知道,undo会产生redo,又会写undo segment,进而可能产生大量的I/O。undo也是expensive的。

10g新特性:IMU机制

IMU在shared pool里面分配一片IMU pool,用来缓存回滚块。每个新事务都会分配一个IMU buffer(私有的),一个buffer里有很多node,一个node相当于一个block(回滚块)。好处大致有二:

1)提高CR读的速度

2)减少I/O

我们可以借助v$sysstat查询oracle是否启用了IMU:

我们还可以借助v$sgastat查询系统当前分配的IMU内存:

如果IMU commits和IMU Flushes一直在增长,则表明oracle正在使用IMU。

undo系列学习之Oracle IMU及Redo Private Strands技术

传统的undo管理图如下:

undo系列学习之Oracle IMU及Redo Private Strands技术

IMU模式下,undo信息依然会被redo保护,因为instance recovery需要undo信息去回滚未提交的事务,使数据库处于一致性状态,如果redo没有保护好undo,那么一旦instance crash,数据库有可能处于不一致状态。

事务开始时,依旧会在数据块头部分配ITL,并且,,他依然会指向undo segment header的事务表,但是回滚块的信息不需要马上写入。这时,undo数据是被记录在IMU buffer里面,这个行为不被redo保护。在以下两种情况,undo数据会被写到回滚块:

1)IMU buffer空间不足时,会发生IMU flush,将undo flush到database_buffer_cache里的回滚块中

2)LGWR将redo写到redo log file时,会发生IMU commit,将private redo strands写到redo log file,将IMU buffer写到回滚块

当IMU buffer flush到回滚块时,oracle会进行合并处理,减少回滚块的消耗以及redo的产生。

在10g开始,同时会在shared pool里,分配一个private redo buffer,每个事务产生的redo都会放在这里

undo系列学习之Oracle IMU及Redo Private Strands技术

有了private redo strands机制,针对IMU buffer产生的日志,就直接在shared pool里面记录。

注意了,在RAC和streams里面,IMU缺省是false的!

IMU及Redo Private Strands技术,其实,是参考了redo log buffer和database_buffer_cache的关系模拟出来的。他最大的关注点,就在于对回滚块的处理。

linux

Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
MySQL: BLOB and other no-sql storage, what are the differences?MySQL: BLOB and other no-sql storage, what are the differences?May 13, 2025 am 12:14 AM

MySQL'sBLOBissuitableforstoringbinarydatawithinarelationaldatabase,whileNoSQLoptionslikeMongoDB,Redis,andCassandraofferflexible,scalablesolutionsforunstructureddata.BLOBissimplerbutcanslowdownperformancewithlargedata;NoSQLprovidesbetterscalabilityand

MySQL Add User: Syntax, Options, and Security Best PracticesMySQL Add User: Syntax, Options, and Security Best PracticesMay 13, 2025 am 12:12 AM

ToaddauserinMySQL,use:CREATEUSER'username'@'host'IDENTIFIEDBY'password';Here'showtodoitsecurely:1)Choosethehostcarefullytocontrolaccess.2)SetresourcelimitswithoptionslikeMAX_QUERIES_PER_HOUR.3)Usestrong,uniquepasswords.4)EnforceSSL/TLSconnectionswith

MySQL: How to avoid String Data Types common mistakes?MySQL: How to avoid String Data Types common mistakes?May 13, 2025 am 12:09 AM

ToavoidcommonmistakeswithstringdatatypesinMySQL,understandstringtypenuances,choosetherighttype,andmanageencodingandcollationsettingseffectively.1)UseCHARforfixed-lengthstrings,VARCHARforvariable-length,andTEXT/BLOBforlargerdata.2)Setcorrectcharacters

MySQL: String Data Types and ENUMs?MySQL: String Data Types and ENUMs?May 13, 2025 am 12:05 AM

MySQloffersechar, Varchar, text, Anddenumforstringdata.usecharforfixed-Lengthstrings, VarcharerForvariable-Length, text forlarger text, AndenumforenforcingdataAntegritywithaetofvalues.

MySQL BLOB: how to optimize BLOBs requestsMySQL BLOB: how to optimize BLOBs requestsMay 13, 2025 am 12:03 AM

Optimizing MySQLBLOB requests can be done through the following strategies: 1. Reduce the frequency of BLOB query, use independent requests or delay loading; 2. Select the appropriate BLOB type (such as TINYBLOB); 3. Separate the BLOB data into separate tables; 4. Compress the BLOB data at the application layer; 5. Index the BLOB metadata. These methods can effectively improve performance by combining monitoring, caching and data sharding in actual applications.

Adding Users to MySQL: The Complete TutorialAdding Users to MySQL: The Complete TutorialMay 12, 2025 am 12:14 AM

Mastering the method of adding MySQL users is crucial for database administrators and developers because it ensures the security and access control of the database. 1) Create a new user using the CREATEUSER command, 2) Assign permissions through the GRANT command, 3) Use FLUSHPRIVILEGES to ensure permissions take effect, 4) Regularly audit and clean user accounts to maintain performance and security.

Mastering MySQL String Data Types: VARCHAR vs. TEXT vs. CHARMastering MySQL String Data Types: VARCHAR vs. TEXT vs. CHARMay 12, 2025 am 12:12 AM

ChooseCHARforfixed-lengthdata,VARCHARforvariable-lengthdata,andTEXTforlargetextfields.1)CHARisefficientforconsistent-lengthdatalikecodes.2)VARCHARsuitsvariable-lengthdatalikenames,balancingflexibilityandperformance.3)TEXTisidealforlargetextslikeartic

MySQL: String Data Types and Indexing: Best PracticesMySQL: String Data Types and Indexing: Best PracticesMay 12, 2025 am 12:11 AM

Best practices for handling string data types and indexes in MySQL include: 1) Selecting the appropriate string type, such as CHAR for fixed length, VARCHAR for variable length, and TEXT for large text; 2) Be cautious in indexing, avoid over-indexing, and create indexes for common queries; 3) Use prefix indexes and full-text indexes to optimize long string searches; 4) Regularly monitor and optimize indexes to keep indexes small and efficient. Through these methods, we can balance read and write performance and improve database efficiency.

See all articles

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

VSCode Windows 64-bit Download

VSCode Windows 64-bit Download

A free and powerful IDE editor launched by Microsoft

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

WebStorm Mac version

WebStorm Mac version

Useful JavaScript development tools

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

SAP NetWeaver Server Adapter for Eclipse

SAP NetWeaver Server Adapter for Eclipse

Integrate Eclipse with SAP NetWeaver application server.