What is redo Redo record transaction logs, divided into online and archived. For the purpose of recovery.
For example, if the machine is out of power, then you need to go online redo logs to restore the system to the failure point after the reboot.
For example, the disk is out of date and needs to be recovered using the archived redo logs and online redo logs area.
For example, truncate a table or other operation, want to revert to the previous state, also need.
What is Undo
Redo is to recreate your operation, and Undo is to undo what you do, for example, if you have a transaction failure or you regret it, you need to use the rollback command to fall back to the operation. Rollback is implemented at the logical level rather than at the physical level, because in a multi-user system, data structures, blocks, and so on are constantly changing, such as we insert a data, the table is not enough space, extended a new extent, our data is stored in this new extent, Other users subsequently inserted the data in the extent, and I wanted to rollback it, so it was obviously physically impossible to undo this extent, because doing so would affect other users ' actions. So, rollback is the logical rollback, for example, for inserts, then rollback is the delete.
Prior to the commit, it was often assumed that a commit of a large transaction (such as a large number of inserts) would take longer than a short transaction. And the fact that there is no difference,
Because Oracle has written what should be written to disk before a commit,
We commit just
1, the creation of a SCN gives us a transaction,scn simple understanding is to queue for transaction in order to restore and maintain consistency.
2,redo Write REDO to disk (LGWR, this is log file sync), record SCN in online REDO log, when this step occurs, we can say that the fact has been submitted, the transaction has ended (in v$ Disappeared in the transaction)
The LOCK (V$lock) owned by 3,session is released.
4,block cleanout (This problem is the root cause of ora-01555:snapshot too old) Rollbackrollback and commit just the opposite, The rollback time is directly related to the size of the transaction. Because rollback must physically recover the data. A commit is quick because Oracle has done a lot of work before a commit (creating undo, modifying Block,redo,latch allocations), and rollback slow is based on the same reason.
1. The Undo table space is used to store the undo data. When the DML operation is performed, Oracle writes the old data for these operations to the undo segment. Managing undo data can be used not only with rollback segments, but also with the undo table space.
2. Undo data: When a user performs a DML operation to modify the data, the undo data is stored in the undo segment, and the new data is stored in the data segment, and if there is a problem with the transaction operation, the transaction needs to be rolled back to cancel the change of things.
For example, after performing the update emp SET sal=1000 WHERE empno=7788, it is found that the employee's 7963 salary should be modified instead of 7788. The rollback statement should be executed at this point.
3. Read consistency
When a user retrieves data, Oracle always makes the user see only the submitted data, which is automatically provided by Oracle. When a user modifies the data, but does not commit, another user finds the value using the SELECT statement, which is obtained from the undo table space.
4. Transaction recovery
Transaction recovery is part of routine recovery, which is done automatically by Oracle server. If the qualifying process fails while the database is running, the background process Smon automatically performs routine recovery when Oracleserver is started. When performing a routine recovery, Oracle will redo any records that are not applied. The database is then opened and the uncommitted transaction is rolled back.
5. Flashback Query
A flashback query is used to obtain database data at a particular point in time.
6.undo_management
Use initialization parameters to specify how the undo data is managed. If you use Automatic management mode, you must set this parameter to auto, and then use the Undo table space to manage the undo data; If you use manual management mode, you must set this value to manual, and then use the rollback segment to manage the undo data.
7.undo_tablespace
Used to specify the undo table space to use for the routine. When you use automatic undo management mode, you can configure this parameter to specify the undo table space that the routine will use.
When using the RAC structure, you must configure a separate undo table space for each routine.
8.undo_retention
This parameter is used to control the maximum retention time for the undo data, with a default value of 900 seconds, which is the earliest point in time that a flashback query can see.
No data object can be established on 9.UNDO tablespace.
Author: 51cto Oracle small-mixed son
See more highlights of this column: http://www.bianceng.cnhttp://www.bianceng.cn/database/Oracle/