les07_rev2

Upload: breno-coelho

Post on 05-Jul-2018

215 views

Category:

Documents


0 download

TRANSCRIPT

  • 8/16/2019 les07_Rev2

    1/19

    Maintaining Online Redo LogFiles

  • 8/16/2019 les07_Rev2

    2/19

    Objectives

    •After completing this lesson, you should be able to do the

    following

    •!"plain the purpose of online redo log files

    •Outline the structure of online redo log files•#ontrol log switches and chec$points

    •Multiple" and maintain online redo log files

    •Manage online redo logs files with OMF

    •Obtain online redo log file information

  • 8/16/2019 les07_Rev2

    3/19

    %sing Online Redo Log Files

    Online Redo log files have the following

    characteristics

    •Record all changes made to data

    •&rovide a recovery mechanism

    •#an be organi'ed into groups

    •At least two groups re(uired

    Redologfiles

  • 8/16/2019 les07_Rev2

    4/19

  • 8/16/2019 les07_Rev2

    5/19

    )ow Online Redo Log Files

    *or$ •Online Redo log files are used in a cyclic fashion+•*hen a online redo log file is full, L*R will move to the ne"t log

    group+

    •#alled a log switch

    •#hec$point operation also occurs

    •-nformation written to the control file

  • 8/16/2019 les07_Rev2

    6/19

    Forcing Log .witches and

    #hec$points

    •Forcing a log switch

    •#hec$points can be forced by

    •.etting FAST_START_MTTR_TARGET parameter 

    •ALTER SYSTEM CHECKPOINT command

     ALTER SYSTEM CHECKPOINT;

     ALTER SYSTEM SWITCH LOGFILE;

    FAST_START_MTTR_TARGET = 600

  • 8/16/2019 les07_Rev2

    7/19

    Adding Online Redo Log File

    roups

    Group

    1

    Group

    2

    Group

    3

     ALTER DATABASE ADD LOGFILE GROUP 3('$HOMEORADATA!0"#%3&)'* '$HOMEORADATA!0+#%3,)'-SI.E "M;

    #%3,)

    #%3&)#%"&)

    #%",)

    #%+&)

    #%+,)

  • 8/16/2019 les07_Rev2

    8/19

    Adding Online Redo Log File

    Members ALTER DATABASE ADD LOGFILE MEMBER '$HOMEORADATA!0/#%")' TO GROUP "*'$HOMEORADATA!0/#%+)' TO GROUP +*'$HOMEORADATA!0/#%3)' TO GROUP 3;

    Group

    1

    Group

    2

    Group

    3

    #%"&)

    #%",)

    #%+&)

    #%+,)

    #%") #%+)

    #%3&)

    #%3,)

    #%3)

  • 8/16/2019 les07_Rev2

    9/19

    /ropping Online Redo

    Log File roups

     ALTER DATABASE DROP LOGFILE GROUP 3;

    #%"&) #%+&) #%3&)

    Group

    1

    Group

    2

    Group

    3

  • 8/16/2019 les07_Rev2

    10/19

    /ropping Online Redo

    Log File Members

     ALTER DATABASE DROP LOGFILE MEMBER'$HOMEORADATA!0/#%3)';

    Group

    1

    Group

    2

    #%",)

    #%")

    #%"&)

    #%",)

    #%+)

    #%"&)

  • 8/16/2019 les07_Rev2

    11/19

    Relocating or Renaming

    Online Redo Log Files•Relocate or rename online redo log files in one of the twofollowing ways

    •ALTER DATABASE RENAME FILE command

    •.hut down the database+•#opy the online redo log files to the new location+

    •&lace the database in MOUNT mode+

    •!"ecute the command+

    •Open database for normal operation+

    •Add new members and drop old members+

     ALTER DATABASE RENAME FILE'$HOMEORADATA!0"#%+&)'TO '$HOMEORADATA!0+#%")';

  • 8/16/2019 les07_Rev2

    12/19

    #learing Online Redo Log

    Files•ALTER DATABASE CLEAR LOGFILE commandcan be used to reinitiali'e an online redo log file+

    •%se the UNARCHIVED $eyword to avoid archiving the

    corrupted online redo log file+ ALTER DATABASE CLEAR UNARCHI1ED

    LOGFILE GROUP +;

     ALTER DATABASE CLEAR LOGFILE GROUP +;

  • 8/16/2019 les07_Rev2

    13/19

  • 8/16/2019 les07_Rev2

    14/19

    Managing Online Redo Log

    Files with OMF•/efine the DB_CREATE_ONLINE_LOG_DEST_n 

     parameter

    •A group can be added with no file specification

    •/ropping a group

    DB_CREATE_ONLINE_LOG_DEST_"

    DB_CREATE_ONLINE_LOG_DEST_+

     ALTER DATABASE DROP LOGFILE GROUP 3;

     ALTER DATABASE ADD LOGFILE;

  • 8/16/2019 les07_Rev2

    15/19

    Obtaining roup and Member

    -nformation•-nformation about a group and its members can be obtained by(uerying the following views

    •V$LOG

    •V$LOGFILE

  • 8/16/2019 les07_Rev2

    16/19

  • 8/16/2019 les07_Rev2

    17/19

    Archived Redo Log Files

    •Accomplished automatically by AR#n

    •Accomplished manually through .2L statements

    •*hen successfully archived

    •An entry in the control file is made•Records archive log name, log se(uence number, and high and low

    system change number 3.#45

    •Filled online redo log files cannot be reused until

    •A chec$point has ta$en place

    •File has been archived by ARCn 

    •#an be multiple"ed

    •Maintained by the /1A

  • 8/16/2019 les07_Rev2

    18/19

    .ummary

    •-n this lesson, you should have learned how to

    •!"plain the use of online redo log files

    •Obtain online redo log file information

    •#ontrol log switches and chec$points•Multiple" and maintain online redo log files

    •Manage online redo log files with OMF

  • 8/16/2019 les07_Rev2

    19/19

    &ractice 6 Overview

    •0his practice covers the following topics

    •#reating online redo log file groups and members

    •Maintaining online redo log file groups and members

    •Managing online redo log files using OMF