Undo tablespace and redo logs
Differences between undo and redo and their respective functions
1. Features of undo data:
1. It is a backup before data modification, mainly to ensure the user's read consistency
2. generated when the transaction modifies data
3. save at least to the end of the transaction
Ii. Functions of undo data:
1. rollback operation
2. read consistency and flashback Query
3. Restore data from a failed transaction
4. instance recovery after abnormal Shutdown
Undo tablespace loss caused by rman backup and recovery
About Oracle releasing over-used undo tablespace
Oracle undo
Oracle undo image data exploration
Oracle ROLLBACK and undo)
Iii. Features of undo rollback segments:
1. rollback segments are dedicated segments automatically created by instances to support transaction operations. They are also composed of zones and blocks. rollback segments will automatically increase or contract as needed, is a storage buffer that can be used for a specified transaction loop.
2. Each transaction uses only one rollback segment. A rollback segment may serve multiple transactions at the same time.
3. When a transaction starts, a rollback segment is specified. During the transaction, when the data is modified, the original data is copied to the rollback segment.
4. In the rollback segment, the transaction will continuously fill the disk area until the transaction ends or all space is used up. If the current disk area is insufficient, the transaction requests the next disk partition in the segment. If all allocated disk partitions are used up, the transaction will overwrite the original disk partition or extend the new disk partition when the rollback segment permits.
5. rollback segments exist in the undo tablespace. multiple undo tablespaces can exist in the database, but only one undo tablespace can be used at the same time.
4. Data Types in rollback segments
The data types in the rollback segment are mainly divided into the following three types:
1. uncommitted undo information uncommitted rollback data is used to achieve read consistency. Therefore, this data cannot be overwritten by data of other transactions.
2. committed undo information: rollback data that has been submitted but has not expired. The transaction associated with the data has been committed, but it is still affected by the retention time of the undo retention parameter.
3. the expired undo information transaction has been committed, and the data retention time has exceeded the time specified by the undo retention parameter. It is an expired data.
When the rollback segment is full, expired undo information will be overwritten first. When the expired data space is used up, the area of committed undo information will be overwritten, at this time, the retention time specified by the undo retention parameter will be damaged, and the uncommitted undo information data cannot be overwritten, if the data to be submitted is not overwritten within the time specified by the undo retention parameter, you can specify retention guarantee on the undo tablespace. The syntax is as follows:
Alter tablespace undobs retention guarantee;
V. Differences between undo data and redo data:
1. Before undo records data modification, redo records the operations to be performed on disk data.
2. undo is used for data rollback and consistent read. redo is used for database rollback.
3. undo is stored in the rollback segment, and redo is stored in the redo log file.
4. undo is used to ensure consistent read in multi-user concurrent systems, and redo is used to prevent data loss.
6. undo-related parameters
Undo_management auto automatic undo tablespace Management
Undo_tablespace: Specifies the name of the undo tablespace. multiple undo tablespaces can exist, but only one
Undo_retention: Specifies the snapshot retention time. It may be overwritten during this period.
Alter tablespace undo_ts retention guarantee; therefore, the snapshot must be saved at the time specified by undo_retention.