Analysis of Oracle redo undo commit rollback

2011-05-18  来源:本站原创  分类:Database  人气:114 

redo -> undo -> datafile
insert a record, the table will put the information with the undo redo, in the commit or before, redo information will be put in the hard disk. Failure, redo will return to those who have commit the data.

redo->

Each operation are first recorded in the redo log, when there is an instance failure (like power), resulting in failure to update the data to the data file, restart the database to be redo, re-update the data to the data file.

undo->

Recorded before the change of a copy, but when your system rollback to the back cover copy to the original data

redo-> record of all operations for the recovery (redo records all the database transaction used for recovery)
undo-> record all of the former impression, used to roll back (undo is used to store uncommited data infor used for rollback)

redo-> transaction has been submitted, the instance data file recovery going to be written
undo-> did not submit the transaction.

redo reason: each commit, data will be immediately written to online redo changes, but not necessarily at the same time writes the data to modify the data file. Because the data has been submitted, but only in the online log file, so you need to restore data from the online log file to find out, re-application, so as to change the data in the data file has also changed over!

undo the reason is: oracle normal operation, in order to improve efficiency, add user does not commit, but the free memory is limited, by the DBWR process to write dirty blocks to the data file in order to free precious memory for other processes use. This reason is the need to UNDO. Because it has not issued a commit statement, but the oracle of dbwr process has not submitted the data to write data files go.

undo is also a datafile, probably dirty buffer is not written back to disk to go inside.
Only the first redo apply successful, to ensure undo datafile things that are right there before you can rollback.

The purpose is to do redo the system back to a system crash before (before shutdown) state, then the undo is to ensure system consistency.
Not to redo, the system will not know the state before, undo impossible.

So instance crash recovery time is always the first rollforward, and then rollback

undo
Rollback segment data is based on "fallback entry" stored.
Item = back block information (change occurred in the affairs of the number of blocks) + before submitting the transaction data stored in the block

In each rollback segment in oracle for its maintenance are a "transaction table"
Recorded in the transaction table, rollback segment and the rollback entries for all matters related to the number (SCN & Services back items)

redo
Redo log by a group of "change vector" component.
Change the variables recorded for each transaction in a database block changes.
When a user submits a commit statement, LGWR process will immediately submit a written record to the redo log file, and then began to write and redo information related to the transaction.

After the success of a transaction is committed, Oracle will be prepared for things to change a system generated code (SCN). Transactions recorded in the SCN will also submit its records, and redo records.

commit overhead there are two factors:

A. obviously will increase the round-trip communication with the database. If each record submitted, and from the traffic generated would be much larger.

B. Each submission must wait for redo is written to disk. This will lead to "wait." In this case, waiting for a "log file sync" (log file sysnc)

Commit the transaction (COMMIT) to complete the work:
# Back in the SGA buffer zone to generate the transaction rollback entries. Back entry in the preservation of the firm to modify the original version of the data.
# In the SGA redo log buffer zone to generate the transaction redo records. Redo records in the records of the transaction conducted on the data block changes, and also recorded on the rollback segment data block of the modifications. Redo records in the cache may be written before the transaction commits the hard disk.
# Slow in the SGA area abundance recorded in the database transaction carried out the database changes. These changes may also be submitted in the transaction to write to the hard drive before.

Commit the transaction (COMMIT) completed at work:
# Specified in the transaction rollback segment in the internal affairs of the table records the transaction has been committed, and generates a unique SCN recorded in the internal affairs of the table, used to uniquely identify the transaction.
# LGWR process of backward areas will be SGA redo log buffer is written in the redo records online redo log files. Redo log writing will also write to the transaction SCN.
# Oracle server process with the release of all records office lock and table lock.
# Oracle notifies the user to complete the transaction commits.
# Oracle marks the transaction as completed.

Note

During the oracle, LGWR is not cached all the work you do; In fact, with the conduct of your work, LGWR amount of style in the background had to refresh the contents of the output redo log buffer to an online redo log files in COMMIT This is done to avoid a long wait to flush the output once all the redo. Until commit implementation, LGWR until all remaining redo log entries to write cache to disk, and records of the SCN to the online redo log files. This part is the real COMMIT, then transaction entries will be removed from the V $ TRANSACTION, indicating that we have submitted.

rollback transaction rollback the work done:
· Oracle by using the rollback segment back in the entry to remove all the SQL statements in the transaction to the database changes.
· Oracle server process the release of Office to use Oracle informed of all matters back lock successful.
· Oracle has completed the transaction is marked as

For example:
insert into a (id) values ​​(1); (redo)
This record is the need to roll back.
Rollback statement is delete from a where id = 1; (undo)

Just want to see. If you do not do insert into a (id) values ​​(1); (redo)
Then delete from a where id = 1; (undo) this sentence does not make sense.

Now have a look right recovery:
The first insert into a (id) values ​​(1); (redo)
Then delete from a where id = 1; (undo)
System returned to its original state, without this record.

相关文章
  • Analysis of Oracle redo undo commit rollback 2011-05-18

    redo -> undo -> datafile insert a record, the table will put the information with the undo redo, in the commit or before, redo information will be put in the hard disk. Failure, redo will return to those who have commit the data. redo-> Each oper

  • Oracle redo undo commit rollback 2010-07-06

    Original Address: http://blog.csdn.net/wh62592855/archive/2009/10/26/4730722.aspx redo -> undo -> datafile insert a record, the table will put the information with the undo redo, in the commit or before, redo the information will be placed on your h

  • Oracle Redo log parallelism Detailed 2011-04-20

    Reproduced: http://database.51cto.com/art/201001/175898_1.htm Oracle's database log is called Redo log, all data changes are recorded Redo log, can be used to repair damaged database. Redo log is used for recovery and an advanced feature of important

  • eclipse of the redo undo function operation history of the dispose function analysis 2010-08-03

    Turned out to be a function similar to empty the Recycle Bin. That is a node in the recycle bin and must remove the node corresponding to redo undo operation removed the stack from the operating history and will delete the corresponding record. Began

  • ORACLE 9I UNDO Tablespace 2010-05-13

    (9i formerly known as the Rollback segment; 9i as Undo segment / Undo Tablespace; 10g and later only Undo Tablespace.) 1, UNDO data role. 1 rollback transaction When the implementation of the DML operations modify data, UNDO UNDO segment data is stor

  • oracle of undo mechanisms 2010-05-22

    UNDO Oracle absolute prohibition of a user to view another user has not submitted the transaction data. Start a DML transaction has modified the data as in previous version is cached in the database buffer cache, then a copy of a buffer is written to

  • Principles of in-depth analysis of Oracle data blocks 2010-12-27

    Turn http://www.bitscn.com/pdb/oracle/200904/160356.html Principles of in-depth analysis of Oracle data blocks data blocks (Oracle Data Blocks), the paper referred to as the "block" is the smallest unit of storage Oracle, Oracle data is stored i

  • Principle of in-depth analysis of Oracle data blocks 2010-12-27

    Turn http://www.bitscn.com/pdb/oracle/200904/160356.html Principle of in-depth analysis of Oracle data blocks data blocks (Oracle Data Blocks), article referred to as "block" is the smallest unit of storage in Oracle, Oracle data is stored in &q

  • oracle database stored procedure, with commit, rollback 2010-09-29

    First, the database stored procedure (1) the establishment of package create or replace package t_allpackage is type mycursor is ref cursor; end t_allpackage; (2) the stored procedure body create or replace procedure tuser_all(user_no in varchar2,myc

  • oracle database stored procedures, with commit, rollback 2010-09-29

    First, the database stored procedures (1) the establishment of package create or replace package t_allpackage is type mycursor is ref cursor; end t_allpackage; (2) stored procedure body create or replace procedure tuser_all(user_no in varchar2,mycur

  • Analysis using Oracle LogMiner redo and archive logs 2011-04-17

    http://yangzb.iteye.com/blog/534258

  • Mysql redo&&undo学习 2013-08-25

    mysql通过锁机制来实现事务的隔离性,用redo log实现事务的原子性和持久性,用undo log实现事务的一致性.undo并不是redo的逆过程,redo和undo都可以看做一种恢复过程,redo恢复事务修改的页操作,redo记录的是物理日志,记录的是页的物理修改操作,redo log基本上都是顺序写的,在数据库运行时不需要对redo log的文件进行读取操作.undo回滚行记录到某个版本,undo记录的是逻辑日志,根据每行记录进行记录,undo log是需要进行随机读取的. redo l

  • Oracle In-Memory Undo 2014-12-11

    在无聊的售前演示中看完了一篇技术文档 All About Oracle"s In-Memory Undo,关于 Oracle 的 In-Memory Undo (IMU),记得几年前讨论过,大部分基于猜测,这算是看到的第一篇比较细致的东西. Oracle 公司在 10g 推出 IMU 这个特性(已经申请了专利).Undo 作为最重要的组成部分之一,其高效与否直接关系到整个 DB 的能力.Undo 旧有的基于 Block 的段(Segment,指存储层的概念)管理模式方式,UNDO 本身的变化要记

  • Increase the size of oracle redo logs 2010-03-26

    Redo log (redo log) is to be controlled by the LGWR. Oracle DML operation data for the time and not immediately to modify the data block, but the output of redo records, and records to the online redo log, when the redo Log with full, or start the gl

  • Analysis of Oracle in the hard and soft analysis 2010-09-03

    http://space.itpub.net/12985663/viewspace-672440 Oracle SQL in the implementation of the resolution before, a hard analysis, including the following steps: 1. Loaded into the shared pool - SQL source code is loaded into memory. 2. Parser - Oracle che

  • The analysis of oracle rac 2010-10-11

    With the development of IT technology, grid computing has become a hot spot, it brings low-cost, high performance and to facilitate sharing of computing resources is the number of companies are looking for. In this tide, the database technology where

  • In-depth analysis of Oracle database checkpoint_change # 2011-10-18

    This address: http://wallimn.iteye.com/blog/1199561, reproduced leave. 1, the system checks points (recorded in the control file) SQL> select checkpoint_change # from v $ database; CHECKPOINT_CHANGE # ------------------ 539 625 2, the data file check

  • Oracle Form中COMMIT的概述及使用技巧 2014-11-26

    针对form上面的数据变动提交到后台数据库,同时数据库提交数据,接下来将详细介绍下Form中COMMIT的使用,感兴趣的你可以参考下本文 1. COMMIT_FORM和COMMIT 都对form和数据库进行提交.针对form上面的数据变动提交到后台数据库,同时数据库提交数据. 2. DO_KEY('COMMIT_FORM') 它会首先执行KEY-COMMIT触发器里面的代码,如果没有这个触发器,则会做COMMIT_FORM一样的操作. 3. FORMS_DLL('COMMIT') 只针对代码中i

  • Oracle重建Undo表空间 2013-03-28

    一台开发机的空间不够了,想挪也没地方挪,检查了一下,UNDOTBS01.DBF文件比较大了,有8个多G,决定重建一下回收. 原来的UNDO表空间名字是UNDOTBS1,DB版本是10G 1.新建一个新的UNDO表空间 C:\Documents and Settings\Administrator>sqlplus "/as sysdba" SQL*Plus: Release 10.2.0.1.0 - Production on 星期四 3月 28 14:59:37 2013 Cop

  • 深入浅出Oracle:Redo的作用 2014-12-19

    深入浅出Oracle:Redo的作用 Oracle通过Redo来保证数据库的事务可以被重演,从而使得在故障之后,数据可以被恢复.Redo对于Oracle数据库来说至关重要. 在数据库中,Redo的功能主要通过3个组件来实现:Redo Log Buffer.LGWR后台进程和Redo Log File(在归档模式下,Redo Log File最终会写出为归档日志文件). 在Oracle的SGA中,存在一块共享内存,称为Redo Log Buffer,如图6-1所示. 图6-1 Oracle Ins