Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: [beginner] Why Oracle needs both redo logs and rollbacksegments ?

Re: [beginner] Why Oracle needs both redo logs and rollbacksegments ?

From: Mark D Powell <Mark.Powell_at_eds.com>
Date: 5 Jun 2003 07:12:35 -0700
Message-ID: <2687bb95.0306050612.396f944e@posting.google.com>


"Jan Gelbrich" <j_gelbrich_at_westfalen-blatt.de> wrote in message news:<bbmu76$b9886$1_at_ID-152732.news.dfncis.de>...
> "F.Marchioni" <NOSPAMfmarchioni_at_libero.it> schrieb im Newsbeitrag
> news:AoCDa.61980$Ny5.1875602_at_twister2.libero.it...
> > Hi all,
> > please forgive the beginner's question, I'm just studying something
> > about Oracle architecture. I'm just wondering why Oracle needs
> > both redo logs and rollback segments to keep track of transactions...
> > reading the manual they seem to pursue a quite similar job....anybody
> > can give me an explanation ?
> > Thanks a lot
> > Francesco
> >
> >
> Hi Francesco,
>
> redo logs and rollback segments have _opposite_ pursposes:
>
> redo log: _re_do, e.g. in the case of a disk crash (that is why redo logs
> should be mirrored on different disks)
> rollback: _un_do transactions that You do not want to commit;
>
> Do not worry; when I was a newbee, I was confused just the same ;-)
>
> hth, Jan

Oracle could have chosen to perform rollback using the online redo logs but that would create a conflict from the log writer wanting to write sequentially to the end of the file and the need to do random IO for rollback. So there is a performance benefit from separating the rollback and logging activities.

And while rollback segments do provide the necessary information to roll transactions back their most commonly used functionality in Oracle is that it is from the rollback segments that Oracle builds read consistent views of data. Whenever you issue a SQL statement in Oracle all the data returned to that cursor is from the same point in time. So if your query starts at exactly 9 AM and takes 5 minutes to complete all the rows returned to your query look as they were at 9 AM. Changes applied between 9 and 9:05 to the rows your query select are "rolled back" to provide your query a time consistent view of the data. Using rollback segments this way allows Oracle to never show the user uncommited changes in response to a query while avoiding the necessity to use read locks to protect the data. Performing this activity using the online redo logs would have really created an IO contflict between the tasks, hence the wise decision to keep these function separate.

Jan noted the following in his post but because these are often confused
Online logs => redo
rollback segments => undo

I hope this additional information helps your understanding. The Concepts manual does a pretty good job covering on these features so you may want to review them there.

HTH -- Mark D Powell -- Received on Thu Jun 05 2003 - 09:12:35 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US