1 2 Previous Next 15 Replies Latest reply: Jan 2, 2013 4:49 PM by 982587 RSS

    REDO LOGS

    Oracle Maniac
      hello friends ...Merry Christmas to every one.


      Uncommitted records are kept in the UNDO tablespace .The moment we issue a commit , the committed records get written to online redo log files. From there the DBWn process keeps on writing these committed records to the datafiles based on the occurence of checkpoints . In case any failure occurs before the committed records are written to the datafiles , those records can be updated from the redo logs. This is what i know .


      The lines from docs.oracle.com "Theonline redo logis a set of two or moreonline redo log filesthat record all changes made to the database, including both uncommitted and committed changes. Redo entries are temporarily stored in redo log buffers of the system global area, and the background process LGWR writes the redo entries sequentially to an online redo log file. LGWR writes redo entries continually, and it also writes a commit record every time a user process commits a transaction."


      Now i need to know ..

      1) Why does oracle bother about uncommitted changes ? Uncommitted changes are already in undo tablespace so why does it need to write it to the redo logs.

      2) what do we mean by " it also writes a commit record every time a user process commits a transaction."


      3) Also , is it a fact that the UNDO tablespace data survives even if the database is restarted ?
        • 1. Re: REDO LOGS
          yoonas
          Hi,


          http://asktom.oracle.com/pls/apex/z?p_url=ASKTOM%2Edownload_file%3Fp_file%3D1435150530862588762&p_cat=undo_redo.pdf&p_company=822925097021874


          Regards
          Yoonas
          • 2. Re: REDO LOGS
            Aman....
            Rahul  K wrote:
            hello friends ...Merry Christmas to every one.


            Uncommitted records are kept in the UNDO tablespace .The moment we issue a commit , the committed records get written to online redo log files. From there the DBWn process keeps on writing these committed records to the datafiles based on the occurence of checkpoints . In case any failure occurs before the committed records are written to the datafiles , those records can be updated from the redo logs. This is what i know .
            You got it wrong . DBWR never reads from the log files. In fact, no one reads from the log files but they are applied automatically in the case of the recovery over the data fieles. Second, in case, there is no explicit or implicit commit issued, there is no update about that transaction done next time except that it's rolled back.
            The lines from docs.oracle.com "Theonline redo logis a set of two or moreonline redo log filesthat record all changes made to the database, including both uncommitted and committed changes. Redo entries are temporarily stored in redo log buffers of the system global area, and the background process LGWR writes the redo entries sequentially to an online redo log file. LGWR writes redo entries continually, and it also writes a commit record every time a user process commits a transaction."


            Now i need to know ..

            1) Why does oracle bother about uncommitted changes ? Uncommitted changes are already in undo tablespace so why does it need to write it to the redo logs.
            You must understand that undo data is not a magically stored data but it's stored in Undo Segments which , like any other segment, are made up of extents and blocks only. So your undo data is actually going to be stored in a block in the undo tablespace. This is not any different from the normal insert/update that you would do to a segment that you would make. So this means, any change done on to an undo block would also generate it's own redo and that information would be also written to the redo logs, as it's just like a user transaction only. And why do you think Oracle shoudn't be bothered about it? What you would do if there is no change recorded in the redo logs for the undo tablespace and it's crashed? How would you recover it?
            2) what do we mean by " it also writes a commit record every time a user process commits a transaction."
            A commit marker is marked to mention that the transaction is over and is committed. What is wrongly mentioned is that LGWR writes it, there is nothing that LGWR does do this marking.
            3) Also , is it a fact that the UNDO tablespace data survives even if the database is restarted ?
            The data is kept in the undo segments and they are going to keep the data as long as the next transaction won't come and overwrite it.

            Aman....
            • 3. Re: REDO LOGS
              Oracle Maniac
              Hi Aman ,


              Apart from the docs.oracle.com and the various blogs , can you please suggest us some free oracle books . By us I mean aspiring oracle developers .
              • 4. Re: REDO LOGS
                Aman....
                Rahul  K wrote:
                Hi Aman ,


                Apart from the docs.oracle.com and the various blogs , can you please suggest us some free oracle books . By us I mean aspiring oracle developers .
                For which topic you want the suggestions about the book? If you can be specific, it would be easy to mention a few titles.

                Aman....
                • 5. Re: REDO LOGS
                  Vedant..
                  Rahul  K wrote:
                  Hi Aman ,


                  Apart from the docs.oracle.com and the various blogs , can you please suggest us some free oracle books . By us I mean aspiring oracle developers .
                  Refer floll links
                  http://tahiti.oracle.com/
                  http://www.oracle.com/technetwork/indexes/documentation/index.html

                  Edited by: Vedant.. on Dec 27, 2012 3:00 PM
                  • 6. Re: REDO LOGS
                    Oracle Maniac
                    .

                    Edited by: Rahul K on Dec 28, 2012 4:56 AM
                    • 7. Re: REDO LOGS
                      yoonas
                      Hi,

                      see what an expert has to say on this
                      http://tkyte.blogspot.com/

                      http://asktom.oracle.com/pls/apex/f?p=100:1:0::NO

                      Regards
                      Yoonas
                      • 8. Re: REDO LOGS
                        Jonathan Lewis
                        Rahul  K wrote:

                        Apart from the docs.oracle.com and the various blogs , can you please suggest us some free oracle books . By us I mean aspiring oracle developers .
                        Free books (apart from the manuals) tend to be worth what you paid for them.

                        One of the problems of the manuals and the tiny fraction of the internet material that is worth reading is that you have to collate and assimilate a number of fractions to get the full picture of how the core mechanisms hang together. This, in part, is why I wrote "Oracle Core" - it is an attempt to turn a large number of small pieces of information into a narrative that will allow you to build a proper picture of how the critical bits of Oracle work.

                        Regards
                        Jonathan Lewis
                        • 9. Re: REDO LOGS
                          Oracle Maniac
                          Often good things are not for free...Is oracle core for free ?
                          • 10. Re: REDO LOGS
                            Aman....
                            Rahul  K wrote:
                            Often good things are not for free...Is oracle core for free ?
                            http://www.amazon.com/gp/product/1430239549/ref=s9_psimh_gw_p14_d2_i2?pf_rd_m=ATVPDKIKX0DER&pf_rd_s=center-2&pf_rd_r=0FYHJ1TNRJH9HCS5XDHN&pf_rd_t=101&pf_rd_p=1389517282&pf_rd_i=507846


                            Aman....
                            • 11. Re: REDO LOGS
                              927578
                              Uncommitted records are kept in the UNDO tablespace .The moment we issue a commit , the committed records get written to online redo log files. From there the DBWn process keeps on writing these committed records to the datafiles based on the occurence of checkpoints . In case any failure occurs before the committed records are written to the datafiles , those records can be updated from the redo logs. This is what i know .
                              You got it wrong . DBWR never reads from the log files. In fact, no one reads from the log files but they are applied automatically in the case of the recovery over the data fieles. Second, in case, there is no explicit or implicit commit issued, there is no update about that transaction done next time except that it's rolled back.
                              Hi Aman,


                              in this link http://ss64.com/ora/syntax-redo.html
                              Commit
                              After a commit, the log writer process (LGWR) will write redo log entries from the SGA (Log Buffer) into the online redo log file. The background process DBWr will then copy the 'new' data from the redo log file into the datafile.
                              . it says like DBWr read(copy) from redo log file !!!. i'm totally confused.. Please explain when & Where DBWr writs the data into Datafile ?
                              • 12. Re: REDO LOGS
                                Jonathan Lewis
                                924575 wrote:
                                Commit
                                After a commit, the log writer process (LGWR) will write redo log entries from the SGA (Log Buffer) into the online redo log file. The background process DBWr will then copy the 'new' data from the redo log file into the datafile.
                                . it says like DBWr read(copy) from redo log file !!!. i'm totally confused.. Please explain when & Where DBWr writs the data into Datafile ?
                                I'm not surprised you're confused - the second sentence is completely wrong.

                                There are two mechanisms that could come into play during the transaction, the new version changes the timing of when redo change vectors get into the redo log buffer and get applied to data buffers, but otherwise they are very similar, so I'll describe a simplified version of the old method.

                                <blockquote>
                                To change data your session generates some redo change vectors and records them in the redo log buffer.
                                As it records the redo change vectors it applies the changes to the data blocks (including the undo blocks)
                                On the commit, your session posts a message to lgwr to write the log buffer to disc up to the point that includes the last redo change vector created by the session
                                The session waits for the log writer to confirm that it has written the log before continuing
                                </blockquote>

                                It is possible that the session will revisit some of the blocks and mark them with the SCN at which the commit took place.
                                At no point does the commit FORCE the database writer to write the changed blocks to disc - a moment will come when dbwr just happens to wake up and decide that it's about time that they need to be written to disc.

                                Regards
                                Jonathan Lewis
                                • 13. Re: REDO LOGS
                                  927578
                                  Jonathan Lewis wrote:
                                  924575 wrote:
                                  Commit
                                  After a commit, the log writer process (LGWR) will write redo log entries from the SGA (Log Buffer) into the online redo log file. The background process DBWr will then copy the 'new' data from the redo log file into the datafile.
                                  . it says like DBWr read(copy) from redo log file !!!. i'm totally confused.. Please explain when & Where DBWr writs the data into Datafile ?
                                  I'm not surprised you're confused - the second sentence is completely wrong.

                                  There are two mechanisms that could come into play during the transaction, the new version changes the timing of when redo change vectors get into the redo log buffer and get applied to data buffers, but otherwise they are very similar, so I'll describe a simplified version of the old method.

                                  <blockquote>
                                  To change data your session generates some redo change vectors and records them in the redo log buffer.
                                  As it records the redo change vectors it applies the changes to the data blocks (including the undo blocks)
                                  On the commit, your session posts a message to lgwr to write the log buffer to disc up to the point that includes the last redo change vector created by the session
                                  The session waits for the log writer to confirm that it has written the log before continuing
                                  </blockquote>

                                  It is possible that the session will revisit some of the blocks and mark them with the SCN at which the commit took place.
                                  At no point does the commit FORCE the database writer to write the changed blocks to disc - a moment will come when dbwr just happens to wake up and decide that it's about time that they need to be written to disc.

                                  Regards
                                  Jonathan Lewis
                                  Thanks much Jonathan..

                                  Got it..So DBWr gets the data from database buffer cache NOT REDO LOG BUFFER right ?
                                  • 14. Re: REDO LOGS
                                    Aman....
                                    So DBWr gets the data from database buffer cache NOT REDO LOG BUFFER right ?
                                    For such questions, documentation is an excellent source of information!
                                    http://docs.oracle.com/cd/E11882_01/server.112/e25513/bgprocesses.htm#sthref4496
                                    DBWn Database Writer Process Writes modified blocks from the database buffer cache to the data files
                                    Aman....
                                    1 2 Previous Next