Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.server -> Re: Redo Logs and Rollback Segments Relationships ?
Rollback segments are internal tables that contain 'Before Images' of rows that are inserted, updated, or deleted. Because the rollback segment is stored in a tablespace on disk, every change to the rollback segment is logged into the redo log. The 'Before Image' of an insert is just a rowid. The 'Before Image' of an update is just the initial values of the columns being changed. The 'Before Image' of a delete is the full row contents.
The insert, update, or delete then does the actual work on the tables. These 'After Images' are also recorded in the redo log. The 'After Image' of an insert is the full row contents. The 'After Image' of an update is just the new values of the columns being changed. The 'After Image' of a delete is just the rowid.
So the redo log contains a 'Before Image' and an 'After Image' of every row of every transaction. This is never erased.
If you decide to commit your transaction, your 'Before Images' in the rollback segment are freed. If you decide to rollback your transaction, the 'Before Images' are retrieved from the rollback segment and used to restore the rows to their original state.
When (not if) you have a disk failure and need to restore from a backup, the 'After Images' in the redo log give you the ability to recover the transactions that committed since your backup. The log contains un-commited data, but never fear -- it also contains the 'Before Images', so it can roll them back.
Oracle provides the means to archive the redo log files so you can be sure to have all logs since the backup.
Jonathan B. Joseph wrote:
>
> I'm an Oracle newbie and I was recently reviewing a database creation
> script
> and noticed that there were entries for creating both redo logs and
> rollback segments.
> Since I thought that rollback segments were the physical components of
> the redo logs,
> I need to understand how they are related. So I have the following
> questions:
>
> Are rollback segments related to redo logs ?
>
> When I execute an update, insert , or delete statement , does it
> get written to the redo log or rollback segment for the tablespace
> that I'm working in ? (ie., what happens to the redo log and/or
> rollback segment ?)
>
> Do rollback segements compose the physical parts of a redo log ?
>
> And what happens to the redo log and/or rollback segment, when I
> issue a commit ? Do do all the inserts, updates, deletes get removed
> from the rollback segment and redo log and the inserts, updates,
> deletes get written to the tablespace of the database that I'm working
> in?
>
> When I do a rollback , does the rollback segment and/or redo log
> get erased (and the inserts, updates etc. not get applied to the
> database) ?
>
> Thank you very much for any help,
> Jonathan Joseph
> ----------------
> jon.joseph_at_jbjnet.com
Received on Thu Feb 26 1998 - 00:00:00 CST
![]() |
![]() |