1. What is IMU? What is the main role of IMU, that is, to solve the problem?
IMU--->in Memory undo,10g new features, the database will open up separate memory areas in shared pool to store the Undo information.
Each new transaction is assigned a IMU buffer (private), a buffer with many node, one node equivalent to a block (rollback).
IMU Features:
IMU, as its name implies, is in-memory undo, and now every time you change the data block,oracle do not have to change the undo block (and will not generate the corresponding redo), but the undo information is cached into the IMU, only the last commit or flush When Imu, the Undo information is updated in batches to the undo block and generates Redo. Can avoid the undo information previously in the buffer cache read and write operations, so that you can further reduce redo generation, while significantly reducing the previous undo segment operations. In Imu, the data can be written to the rollback segment after staging, sorting and shrinking, which provides an orderly, batch-written performance improvement.
IMU Main function:
Reduce CR block--> when constructing CR blocks, instead of retrieving the undo record from the Undo box as before, it constructs CR chunks using information from the shared pool's private imu area, reducing the competition in the buffer Caceh CBC latch.
Reduce the number of REDO log entries--> is no longer a REDO records for each DML statement, but a REDO Records--redo record generation of each transaction will be uploaded to log BUFFER and will apply for latch.
Reducing latch--> first because of the reduction in the number of redo record, followed by a imu latch instead of redo allocation latch and redo copy latch These two, also reduced latch contention.
The number of IMU latch in the query system-that is, the number of private redo strand area.
IMU the internal table corresponding to the private redo: X$kcrfstrand IMU The undo zone corresponds to the internal table: X$KTIFP
bys@ bys3>select count (name) from V$latch_children where lower (name) like ' in mem% ';
COUNT (NAME)
-----------
84
bys@ bys3>select Count (*), name from V$latch_children where lower (name) like ' in mem% ' group by name;
COUNT (*) NAME
---------- ----------------------------------------------------------------
Latch in memory undo
The following statement can query IMU latch for access
Select Name,gets from V$latch_children where lower (name) like ' in mem% ';
2. In which scenarios does the IMU feature not be used? (ORACLE 10g appears imu, default to open IMU)
IMU is not supported in RAC environments.
Opening the secondary log opens when the flashback database is turned on, and IMU is not available at this time.
Transactions are too large-it is said that each IMU buffer private redo Strand area size is approximately 64KB (64-bit Oracle version is 128KB), large transactions can not be used. A transaction, for example, is preceded by an update, where the redo private area is used, and other DML statements of this transaction are automatically used in IMU mode.
The shared pool is too small and Oracle will automatically not use IMU.
Non-IMU mode is automatically used when IMU latch cannot be obtained.
3. How to manually close and open IMU mode?
The IMU feature is turned on by default in 10G and 11G, and the turn off statement reads as follows:-After modification, it is best to reboot to take effect, or at least to switch the redo log.
Alter system set "_in_memory_undo" =FALSE;
Alter system set "_in_memory_undo" =true; --Use this statement to change back to use the IMU attribute after closing the IMU.
4, to talk about an UPDATE statement from the first to the nineth step of the entire process? Do a dump analysis of the redo log in IMU mode (shown in the figure above: the redo format of the IMU pattern).
The corresponding image from step one to step nineth of the UPDATE statement is:
Step one: Store the changed data in the PGA
Step two: Copy the old data from buffer cache to the private IMU buffer of the shared pool
The third step: the PGA in the modified data stored to private redo private redo--in IMU.
Step Fourth: Modify the data in the Buffre cache
After the commit operation:
Fifth step: From the IMU copy modified before the value of the buffer cache to build a CR block-----Even if not submitted smon every 3 seconds to do this work
Sixth step: The fourth step modifies modifies the Buffre cache the data produces redo log writes log Buffe
Seventh step: The fifth step operation constructs the CR block, produces the redo log writes logs Buffe
Eighth step: Write log buffer to redo log file from LGWR
Nineth step: DBWR to write dirty data to file
5.UPDATE operation dump REDO content experiment record:
INSERT and DELETE statements, see: Click to open the link
REDO Record-thread:1 rba:0x000141.00000027.0010 len:0x031c vld:0x0d
scn:0x0000.00719188 Subscn:1 01/07/2014 20:27:05
(LWN rba:0x000141.00000027.0010 len:0002 nst:0001 scn:0x0000.00719187)
### #一个REDO record:record head +change vector (one CV is an operation)
Above is the log header, thread:1 thread number, the RAC will have 1,2, etc.
RBA:0X000141.00000027.0010 converts 16 to decimal, respectively, log file number, log block number, Nth byte on block
vld:0x0d log type is this when--imu mode, not IMU: vld:0x05
scn:0x0000.00719188 subscn:1 01/07/2014 20:27:05----
bys@ bys3>select Scn_to_timestamp (to_number (' 719188 ', ' xxxxxxxx ')) from dual;
Scn_to_timestamp (To_number (' 719188 ', ' XXXXXXXX '))
---------------------------------------------------------------------------
07-jan-14 08.27.05.000000000 PM
--Is the SCN number when this redo entry is produced, and turns decimal to the time stamp: 08.27.05, the INSERT statement completion is in 20:27:00 bys@ bys3>commit;----This is after the INSERT statement completes 5 seconds, this SCN and change# 4 The SCN is consistent at the time of submission.
(LWN rba:0x000141.00000027.0010 len:0002 nst:0001 scn:0x0000.00719187)
The scn:0x0000.00719187 in parentheses is more than the previous line: scn:0x0000.00719187 1 SCN less.
####
Change #1 Typ:2 cls:1 afn:4 dba:0x010000fd obj:22327 scn:0x0000.007164a1 seq:1 op:11.5 enc:0 rbl:0
# # # # #AFN: 4, operation is the object_id of the object of the-dba_data_files.file_id;obj:22327--operation in document 4th. op:11.5-Some versions are op:11.19--update operations
KTB Redo
Op:0x11 ver:0x01
Compat Bit:4 (post-11) padding:1
Op:f Xid:0x0005.002.00000edc uba:0x00c041cd.02ea.01
Block cleanout record, scn:0x0000.0071917c ver:0x01 opt:0x02, entries follow ...
Itli:1 Flg:2 SCN:0X0000.007164A1
KDO Op code:urp row dependencies Disabled----urp=update row PIECE. Sometimes it will be: KDO Op code:21 Row Dependencies Disabled
Xtype:xa flags:0x00000000 bdba:0x010000fd HDBA:0X010000FA
Itli:2 ispac:0 maxfr:4858
tabn:0 Slot:8 (0x8) flag:0x2c lock:2 ckix:0
Ncol:3 nnew:1 size:2 --ncol:3 nnew:1 represents a table with 3 columns, operates a column , Size:2
--column character length increased 2:database minus Chedan---According to the log of multiple update and dump, the value of size here should be: The value in the current change minus the other.
Col 1: [8] The--set dname= ' database '--col 1: [8], second column, 8 characters
bys@ bys3>select dump (' database ', '), dump (' dataoracle ') from dual;
Dump (' DATABASE ', #) Dump (' dataoracle ', 16)
------------------------------------- --------------------------------------------
typ=96 len=8:64,61,74,61,62,61,73,65 typ=96 len=10:64,61,74,61,6f,72,61,63,6c,65
#########################
Change #2 typ:0 cls:25 afn:3 dba:0x00c000c0 obj:4294967295 scn:0x0000.00719153 seq:1 op:5.2 enc:0 rbl:0
Ktudh redo:slt:0x0002 Sqn:0x00000edc flg:0x000a siz:164 fbi:0
uba:0x00c041cd.02ea.01 pxid:0x0000.000.00000000
### #################### #事务信息
typ:0 Normal block, CLS:25 class greater than 16 is the undo block-incremented. Afn:3 Absolute File Number dba_data_files.file_id--is the undo file number
DBA:0X00C000C0 data block in in-memory address
obj:4294967295-Decimal, into the 16 is FFFFFFFF
scn:0x0000.00719153 conversion to 16 can be compared with operation
op:5.2-> Operation Code writes transaction information to the transaction table of the Undo segment header-Transaction start
uba:0x00c041cd.02ea.01 Undo Block Address
#######################