<ul><li>Chapter 5 </li></ul><ul><li>The Redo Log Files </li></ul>
Objectives   <ul><li>Learn to describe redo log files, groups, and members </li></ul><ul><li>Manage redo log groups and me...
Introduction to Online  Redo Log Files   <ul><li>Online redo log files store details as the database is used including: </...
Oracle9 i  Architecture :  A Typical Server
Introduction to Online  Redo Log Files <ul><li>Components: </li></ul><ul><li>Redo log group </li></ul><ul><li>Online redo ...
Introduction to Online  Redo Log Files <ul><li>Components: </li></ul><ul><li>Redo log buffer </li></ul><ul><li>LGWR </li><...
Introduction to Online  Redo Log Files File 1 is written to File A by the ARCn process after the log switch is complete
Introduction to Online  Redo Log Files File 1 and File 3 are written to by the LGWR process simultaneously until both are ...
The Purpose of Redo Log Files  <ul><li>Redo log files aid in recovery from short term data loss such as brief power outage...
The Purpose of Redo Log Files  <ul><li>Recovery procedures (overview): </li></ul><ul><li>Prior to failure: </li></ul><ul><...
The Structure of Redo Log Files   <ul><li>Redo log buffer is flushed to the redo log file when: </li></ul><ul><ul><li>A tr...
The Structure of Redo Log Files   <ul><li>Redo log file components: </li></ul><ul><li>Redo record (also called redo entry)...
Managing Redo Log Files   The COMMIT command tells the database to log  the changes to the redo log file
Log Switches and Checkpoints   <ul><li>To manually signal a log switch: </li></ul><ul><ul><li>ALTER SYSTEM SWITCH LOGFILE;...
Log Switches and Checkpoints <ul><li>How the SCN is used: </li></ul><ul><ul><li>SCN is recorded in the redo log buffer  </...
Multiplexing and Other Maintenance   <ul><li>Multiplexed redo log files requires multiple members in each group </li></ul>...
Adding a Member to a Group  <ul><li>Add members to groups while the database is running </li></ul><ul><li>Do not specify S...
Adding a New Group  <ul><li>Add a new group while the database is running </li></ul><ul><li>Specify SIZE and group number ...
Renaming or Moving  a Redo Log File  <ul><li>Must be done while the group is not ACTIVE </li></ul><ul><li>Steps: </li></ul...
Renaming or Moving  a Redo Log File  <ul><li>Steps (continued): </li></ul><ul><ul><li>Inform database of changed file name...
Dropping Redo Log Members  or Groups  <ul><li>Reasons for dropping members or groups: </li></ul><ul><li>Bad disk, so must ...
Dropping Redo Log Members  or Groups <ul><li>Rules when dropping redo log members: </li></ul><ul><ul><li>Each group must h...
Dropping Redo Log Members or Groups  <ul><li>Steps to drop redo log member: </li></ul><ul><ul><li>Query V$LOG to confirm t...
Dropping Redo Log Members or Groups  <ul><li>Steps to drop redo log group: </li></ul><ul><ul><li>Query V$LOG to confirm th...
Dropping Redo Log Members or Groups   <ul><li>Additional notes: </li></ul><ul><li>If group is ACTIVE, force log switch: </...
Archiving a Redo Log Group   <ul><li>Advantages of archiving redo log groups: </li></ul><ul><ul><li>Point-in-time recovery...
Finding Redo Log Information in Data Dictionary Views   <ul><li>States of a redo log group: </li></ul><ul><ul><li>UNUSED <...
Viewing Control File Data
Chapter Summary <ul><li>Redo log files primarily contain information on database changes </li></ul><ul><li>A database has ...
Chapter Summary <ul><li>The SCN is incremented at a checkpoint </li></ul><ul><li>Maintenance you can do with redo log file...
Chapter Summary <ul><li>Placing a database in ARCHIVELOG mode causes redo log files to be archived after a log switch </li...
Upcoming SlideShare
Loading in...5
×

Redo Log Files

1,387

Published on

1 Comment
1 Like
Statistics
Notes
  • This is a nice info to understand about redo log files thanks a lot for the sharing the knowledge.
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
No Downloads
Views
Total Views
1,387
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
56
Comments
1
Likes
1
Embeds 0
No embeds

No notes for slide

Redo Log Files

  1. 1. <ul><li>Chapter 5 </li></ul><ul><li>The Redo Log Files </li></ul>
  2. 2. Objectives <ul><li>Learn to describe redo log files, groups, and members </li></ul><ul><li>Manage redo log groups and members </li></ul>
  3. 3. Introduction to Online Redo Log Files <ul><li>Online redo log files store details as the database is used including: </li></ul><ul><li>Checkpoints </li></ul><ul><li>Data Changes (DML) </li></ul><ul><li>Structural changes (DDL) </li></ul><ul><li>Data file changes </li></ul>
  4. 4. Oracle9 i Architecture : A Typical Server
  5. 5. Introduction to Online Redo Log Files <ul><li>Components: </li></ul><ul><li>Redo log group </li></ul><ul><li>Online redo log </li></ul><ul><li>file or member </li></ul><ul><li>Archived redo </li></ul><ul><li>log file </li></ul><ul><li>ARCn </li></ul>
  6. 6. Introduction to Online Redo Log Files <ul><li>Components: </li></ul><ul><li>Redo log buffer </li></ul><ul><li>LGWR </li></ul><ul><li>CKPT </li></ul>
  7. 7. Introduction to Online Redo Log Files File 1 is written to File A by the ARCn process after the log switch is complete
  8. 8. Introduction to Online Redo Log Files File 1 and File 3 are written to by the LGWR process simultaneously until both are full
  9. 9. The Purpose of Redo Log Files <ul><li>Redo log files aid in recovery from short term data loss such as brief power outage: </li></ul><ul><li>Store changes that may not be written to the data files yet </li></ul><ul><li>Store checkpoints to allow recovery to resynchronize data files with correct changes </li></ul><ul><li>Cannot completely handle recovery from major loss such as an entire data file </li></ul>
  10. 10. The Purpose of Redo Log Files <ul><li>Recovery procedures (overview): </li></ul><ul><li>Prior to failure: </li></ul><ul><ul><li>Perform full database backup regularly </li></ul></ul><ul><ul><li>Run database in ARCHIVELOG mode </li></ul></ul><ul><li>After failure: </li></ul><ul><ul><li>Restore from full backup </li></ul></ul><ul><ul><li>Apply archived redo log files (oldest to newest) </li></ul></ul><ul><ul><li>Apply online redo log file </li></ul></ul>
  11. 11. The Structure of Redo Log Files <ul><li>Redo log buffer is flushed to the redo log file when: </li></ul><ul><ul><li>A transaction COMMITS </li></ul></ul><ul><ul><li>The redo log buffer becomes 1/3 full </li></ul></ul><ul><ul><li>The redo log buffer contains >1 M of updated records </li></ul></ul><ul><ul><li>A checkpoint occurs </li></ul></ul>
  12. 12. The Structure of Redo Log Files <ul><li>Redo log file components: </li></ul><ul><li>Redo record (also called redo entry) </li></ul><ul><ul><li>Relates to one data block </li></ul></ul><ul><ul><li>Made up of one or more change vectors </li></ul></ul>
  13. 13. Managing Redo Log Files The COMMIT command tells the database to log the changes to the redo log file
  14. 14. Log Switches and Checkpoints <ul><li>To manually signal a log switch: </li></ul><ul><ul><li>ALTER SYSTEM SWITCH LOGFILE; </li></ul></ul><ul><li>A log switch triggers a checkpoint </li></ul><ul><li>Checkpoint is a signal to write all dirty buffers to the appropriate files </li></ul><ul><li>Checkpoint increments the System Change Number (SCN) </li></ul>
  15. 15. Log Switches and Checkpoints <ul><li>How the SCN is used: </li></ul><ul><ul><li>SCN is recorded in the redo log buffer </li></ul></ul><ul><ul><li>SCN is recorded in the header of each data file that was written to </li></ul></ul><ul><ul><li>During recovery, SCN of each datafile is compared to the SCN in the redo log file </li></ul></ul><ul><ul><ul><li>If a match, the data file is up to date </li></ul></ul></ul><ul><ul><ul><li>If redo log file has higher SCN, changes are reapplied to the data file from the redo log file </li></ul></ul></ul>
  16. 16. Multiplexing and Other Maintenance <ul><li>Multiplexed redo log files requires multiple members in each group </li></ul><ul><li>A log group continues to function as long as it has at least one good member </li></ul><ul><li>If all members of the current group become damaged, the database forces a log switch </li></ul><ul><li>The database shuts down immediately if a log switch fails </li></ul>
  17. 17. Adding a Member to a Group <ul><li>Add members to groups while the database is running </li></ul><ul><li>Do not specify SIZE because new members are automatically assigned the same size as other members in the group </li></ul><ul><li>Command syntax: </li></ul><ul><li>ALTER DATABASE ADD LOGFILE MEMBER '<X:xxx><filename>' </li></ul><ul><li>TO GROUP <n>; </li></ul>
  18. 18. Adding a New Group <ul><li>Add a new group while the database is running </li></ul><ul><li>Specify SIZE and group number </li></ul><ul><li>List all members to be created with the group (must be at least one) </li></ul><ul><li>Command syntax: </li></ul><ul><ul><li>ALTER DATABASE ADD LOGFILE GROUP <n> </li></ul></ul><ul><ul><li>( '<X:xxx><filename>', '<X:xxx><filename>') </li></ul></ul><ul><ul><li>SIZE <n>; </li></ul></ul>
  19. 19. Renaming or Moving a Redo Log File <ul><li>Must be done while the group is not ACTIVE </li></ul><ul><li>Steps: </li></ul><ul><ul><li>Shut down the database: </li></ul></ul><ul><ul><ul><li>SHUTDOWN IMMEDIATE </li></ul></ul></ul><ul><ul><li>Rename or relocate files using the operating system </li></ul></ul><ul><ul><li>Mount the database </li></ul></ul><ul><ul><ul><li>STARTUP MOUNT </li></ul></ul></ul>
  20. 20. Renaming or Moving a Redo Log File <ul><li>Steps (continued): </li></ul><ul><ul><li>Inform database of changed file name: </li></ul></ul><ul><ul><ul><li>ALTER DATABASE </li></ul></ul></ul><ul><ul><ul><li>RENAME FILE '<X:xxx><oldfilename1>', </li></ul></ul></ul><ul><ul><ul><li>'<X:xxx><oldfilename2>' </li></ul></ul></ul><ul><ul><ul><li>TO '<X:xxx><newfilename1>', </li></ul></ul></ul><ul><ul><ul><li>'<X:xxx><newfilename2>'; </li></ul></ul></ul><ul><ul><li>Open the database: </li></ul></ul><ul><ul><ul><li>ALTER DATABASE OPEN; </li></ul></ul></ul>
  21. 21. Dropping Redo Log Members or Groups <ul><li>Reasons for dropping members or groups: </li></ul><ul><li>Bad disk, so must recreate member </li></ul><ul><li>Tuning recommendation calls for reducing members or groups </li></ul><ul><li>Corrupted members can be deleted and replaced later </li></ul>
  22. 22. Dropping Redo Log Members or Groups <ul><li>Rules when dropping redo log members: </li></ul><ul><ul><li>Each group must have at least one member </li></ul></ul><ul><ul><li>The group affected must not be ACTIVE and (if in ARCHIVELOG mode) must be archived </li></ul></ul><ul><li>Rule when dropping groups: </li></ul><ul><ul><li>Database requires at least two groups </li></ul></ul><ul><ul><li>The group affected must not be ACTIVE and (if in ARCHIVELOG mode) must be archived </li></ul></ul>
  23. 23. Dropping Redo Log Members or Groups <ul><li>Steps to drop redo log member: </li></ul><ul><ul><li>Query V$LOG to confirm that group is inactive </li></ul></ul><ul><ul><li>Drop redo log member: </li></ul></ul><ul><ul><ul><li>ALTER DATABASE DROP LOGFILE MEMBER </li></ul></ul></ul><ul><ul><ul><li>'<X:xxx><filename>'; </li></ul></ul></ul><ul><ul><li>Delete associated file in the operating system </li></ul></ul>
  24. 24. Dropping Redo Log Members or Groups <ul><li>Steps to drop redo log group: </li></ul><ul><ul><li>Query V$LOG to confirm that group is inactive: SELECT * FROM V$LOG; </li></ul></ul><ul><ul><li>Drop redo log group: </li></ul></ul><ul><ul><ul><li>ALTER DATABASE DROP LOGFILE GROUP <n>; </li></ul></ul></ul><ul><ul><li>Delete associated file(s) in the operating system </li></ul></ul>
  25. 25. Dropping Redo Log Members or Groups <ul><li>Additional notes: </li></ul><ul><li>If group is ACTIVE, force log switch: </li></ul><ul><ul><li>ALTER SYSTEM SWITCH LOGFILE; </li></ul></ul><ul><li>If group still active, force checkpoint: </li></ul><ul><ul><li>ALTER SYSTEM CHECKPOINT; </li></ul></ul><ul><li>An alternative to dropping a corrupt group and recreating the members: </li></ul><ul><ul><li>ALTER DATABASE CLEAR UNARCHIVED LOGFILE GROUP <n>; </li></ul></ul>
  26. 26. Archiving a Redo Log Group <ul><li>Advantages of archiving redo log groups: </li></ul><ul><ul><li>Point-in-time recovery to a point earlier than online redo log files contain </li></ul></ul><ul><ul><li>The ability to query archived log files with LogMiner </li></ul></ul><ul><ul><li>The ability to set up and maintain a standby database </li></ul></ul>
  27. 27. Finding Redo Log Information in Data Dictionary Views <ul><li>States of a redo log group: </li></ul><ul><ul><li>UNUSED </li></ul></ul><ul><ul><li>CURRENT </li></ul></ul><ul><ul><li>ACTIVE </li></ul></ul><ul><ul><li>CLEARING </li></ul></ul><ul><ul><li>CLEARING_CURRENT </li></ul></ul><ul><ul><li>INACTIVE </li></ul></ul>
  28. 28. Viewing Control File Data
  29. 29. Chapter Summary <ul><li>Redo log files primarily contain information on database changes </li></ul><ul><li>A database has at least two redo log groups </li></ul><ul><li>A redo log group has at least one member </li></ul><ul><li>Redo log files support automatic recovery from minor failures </li></ul><ul><li>A redo log group with multiple files is multiplexed </li></ul>
  30. 30. Chapter Summary <ul><li>The SCN is incremented at a checkpoint </li></ul><ul><li>Maintenance you can do with redo log files and groups: </li></ul><ul><ul><li>Add a new file (member) to a group </li></ul></ul><ul><ul><li>Add a new group </li></ul></ul><ul><ul><li>Rename or relocate a member </li></ul></ul><ul><ul><li>Drop a member </li></ul></ul><ul><ul><li>Drop a group </li></ul></ul><ul><ul><li>Clear a group </li></ul></ul>
  31. 31. Chapter Summary <ul><li>Placing a database in ARCHIVELOG mode causes redo log files to be archived after a log switch </li></ul><ul><li>Many initialization parameters set the behavior of the archiving function </li></ul><ul><li>The V$LOG and V$LOGFILES dynamic performance views display information about redo log groups and members </li></ul>
  1. A particular slide catching your eye?

    Clipping is a handy way to collect important slides you want to go back to later.

×