日期:2014-05-16  浏览次数:20425 次

理解redo(8)redo和undo的一点关系及删除联机日志文件组的注意事项

   

    1) redo和undo的“藕断丝连”
        前滚redo
        回滚undo
        undo受到redo的保护,以便历经前滚后在buffer cache中得到undo,并将这些undo运用到buffer cache里的数据块和索引块上,使那些数据文件能“赶上”数据库的其余部分,从而保持数据库的一致性。
        二者是DBA和开发人员的桥梁
        回滚过程绝不涉及重做日志,只有恢复和归档时会读取重做日志。因为,重做日志是用来写的,而不是用来读!

 

    2) 删除联机重做日志文件组的注意事项


         ①日志组为active和current状态时不可以删除
         ②日志组在数据库级别删除后操作系统上的文件不会被级链删除
         ③对于一个Oracle数据库实例,至少要包含两个联机重做日志组

 

   

    3) redo buffer由谁来写入?


        > redo buffer的写入 也是 lgwr吗?

            No. Server (shadow) processes write to log buffer. LGWR writes redo records from the log buffer to the log file.

        > 而undo buffer因为就是在db cache buffer,所以也是DBWR读入的吗?

            Not quite sure what you mean. "Undo buffer" is just a buffer in buffer cache that corresponds to a block in an undo tablespace.
            Treat it like any other data block. It's written into buffer cache by a server process and written out to datafiles by DBWn.

        > 涉及IO(特别是异步),就需要一个专门的进程来完成

 

            A server process can always read datafiles. But normally only DBWn can write to them. Also remember a server process can read and write a tempfile