Less14 BR Concepts MB3

download Less14 BR Concepts MB3

of 28

Transcript of Less14 BR Concepts MB3

  • 8/14/2019 Less14 BR Concepts MB3

    1/28

  • 8/14/2019 Less14 BR Concepts MB3

    2/28

    14-2 Copyright 2005, Oracle. All rights reserved.

    Objectives

    After completing this lesson, you should be able to dothe following: Identify the types of failure that may occur in an

    Oracle database Describe ways to tune instance recovery Identify the importance of checkpoints, redo log

    files, and archive log files Configure ARCHIVELOG mode

  • 8/14/2019 Less14 BR Concepts MB3

    3/28

    14-3 Copyright 2005, Oracle. All rights reserved.

    Part of Your Job

    The administrators duties are to: Protect the database from failure wherever

    possible

    Increase the Mean-Time-Between-Failures (MTBF) Decrease the Mean-Time-To-Recover (MTTR) Minimize the loss of data

  • 8/14/2019 Less14 BR Concepts MB3

    4/28

    14-4 Copyright 2005, Oracle. All rights reserved.

    Categories of Failures

    Failures can generally be divided into the followingcategories: Statement failure

    User process failure Network failure User error Instance failure

    Media failure

  • 8/14/2019 Less14 BR Concepts MB3

    5/28

    14-5 Copyright 2005, Oracle. All rights reserved.

    Statement Failure

    Possible SolutionsTypical Problems

    Work with developers to correctprogram errors.

    Logic errors in applications

    Enable resumable spaceallocation.

    Increase owner quota. Add space to tablespace.

    Attempts to allocate space thatfail

    Provide appropriate object or system privileges.

    Attempts to perform operationswith insufficient privileges

    Work with users to validate andcorrect data.

    Attempts to enter invalid datainto a table

  • 8/14/2019 Less14 BR Concepts MB3

    6/28

    14-6 Copyright 2005, Oracle. All rights reserved.

    User Process Failure

    Possible SolutionsTypical Problems

    A DBAs action is not usuallyneeded to resolve user processfailures. Instance backgroundprocesses roll back uncommitted

    changes and release locks.

    Watch for trends.

    A user performs an abnormaldisconnect.

    A users session is abnormallyterminated.

    A user experiences a programerror that terminates thesession.

  • 8/14/2019 Less14 BR Concepts MB3

    7/2814-7 Copyright 2005, Oracle. All rights reserved.

    Network Failure

    Possible SolutionsTypical Problems

    Configure a backup networkconnection.

    Network connection fails.

    Configure multiple network cards.Network Interface Card (NIC)fails.

    Configure a backup listener andconnect-time failover.

    Listener fails.

  • 8/14/2019 Less14 BR Concepts MB3

    8/2814-8 Copyright 2005, Oracle. All rights reserved.

    User Error

    Possible SolutionsTypical Causes

    Recover table from the recycle bin.A user drops a table.

    Roll back or use flashback query torecover.

    A user inadvertently deletesor modifies data.

    Oracle LogMiner

  • 8/14/2019 Less14 BR Concepts MB3

    9/2814-9 Copyright 2005, Oracle. All rights reserved.

    User Error Full Notes Page

  • 8/14/2019 Less14 BR Concepts MB3

    10/2814-10 Copyright 2005, Oracle. All rights reserved.

    Instance Failure

    Failure of one of thebackground processes

    Possible SolutionsTypical Causes

    Emergency shutdownprocedures

    Hardware failure

    Restart the instance by using thestartup command. Recovering frominstance failure is automatic,including rolling forward changes in

    the redo logs and then rolling backany uncommitted transactions.

    Investigate the causes of failure byusing the alert log, trace files, and

    Enterprise Manager.

    Power outage

  • 8/14/2019 Less14 BR Concepts MB3

    11/2814-11 Copyright 2005, Oracle. All rights reserved.

    Background Processes and Recovery:Checkpoint (CKPT)

    CKPT is responsible for: Signaling DBW n at checkpoints Updating data file headers with

    checkpoint information Updating control files with

    checkpoint information

    Checkpoint(CKPT)

    DatabaseWriter

    (DBW n )

    SGA

    Databasebuffer cache

    Control file

    Data files

  • 8/14/2019 Less14 BR Concepts MB3

    12/2814-12 Copyright 2005, Oracle. All rights reserved.

    Background Processes and Recovery:Redo Log Files and LogWriter

    Redo log files: Record changes to the

    database

    Should be multiplexed toprotect against lossLogWriter writes: At commit

    When one-third full Every three seconds Before DBW n writes

    Group 3

    LogWriter (LGWR)

    Redo loggroup 1

    Redo loggroup 2

    Redo logbuffer

    SGA

    Redo loggroup 3

  • 8/14/2019 Less14 BR Concepts MB3

    13/2814-13 Copyright 2005, Oracle. All rights reserved.

    Background Processes and Recovery:Archiver (ARC n )

    Archiver (ARC n ): Is an optional

    background process

    Automatically archivesonline redo log fileswhen ARCHIVELOG modeis set for the database

    Preserves the record of all changes made to thedatabase

    LogWriter (LGWR)

    Archiver (ARC n )

    Redo logbuffer

    SGA

    Onlineredo log

    Archive

    log files

  • 8/14/2019 Less14 BR Concepts MB3

    14/2814-14 Copyright 2005, Oracle. All rights reserved.

    Instance Recovery

    Instance or crash recovery: Is caused by attempts to open a database whose

    files are not synchronized on shutdown

    Is automatic Uses information stored in redo log groups to

    synchronize files Involves two distinct operations:

    Rolling forward: Data files are restored to their state before the instance failed.

    Rolling back: Changes made but not committed arereturned to their original state.

  • 8/14/2019 Less14 BR Concepts MB3

    15/2814-15 Copyright 2005, Oracle. All rights reserved.

    Phases of Instance Recovery

    1. Data files out of sync2. Roll forward (redo)3. Committed and

    noncommitted data in files4. Roll back (undo)5. Committed data in files

    Database

    Undo

    Instance

    Backgroundprocesses

    Data fileSCN: 99

    Data fileSCN: 129

    Data fileSCN: 140

    Control fileSCN: 143

    Control fileSCN: 143

    Redo loggroup

    SCN 74-101

    Redo loggroup

    SCN 102-143

    SGA

  • 8/14/2019 Less14 BR Concepts MB3

    16/2814-16 Copyright 2005, Oracle. All rights reserved.

    Tuning Instance Recovery

    During instance recovery, the transactionsbetween the checkpoint position and the end of redo log must be applied to data files.

    You tune instance recovery by controlling thedifference between the checkpoint position andthe end of redo log.

    End of redo logCheckpoint position

    Transactions

    Instance recovery

  • 8/14/2019 Less14 BR Concepts MB3

    17/2814-17 Copyright 2005, Oracle. All rights reserved.

    Using the MTTR Advisor

    Specify the desired time in seconds or minutes. The default value is 0 (disabled). The maximum value is 3,600 seconds (one hour).

  • 8/14/2019 Less14 BR Concepts MB3

    18/2814-18 Copyright 2005, Oracle. All rights reserved.

    Media Failure

    Failure of disk controller

    Deletion or corruption of database file

    Possible SolutionsTypical Causes1. Restore the affected file from

    backup.2. If necessary, inform the database

    about a new file location.3. If necessary, recover the file by

    applying redo information.

    Failure of disk drive

  • 8/14/2019 Less14 BR Concepts MB3

    19/2814-19 Copyright 2005, Oracle. All rights reserved.

    Configuring for Recoverability

    To configure your database for maximumrecoverability, you must: Schedule regular backups

    Multiplex control files Multiplex redo log groups Retain archived copies of redo logs

  • 8/14/2019 Less14 BR Concepts MB3

    20/2814-20 Copyright 2005, Oracle. All rights reserved.

    Control Files

    Protect against database failure by multiplexingcontrol files. It is suggested that your database has: At least two copies (Oracle recommends three) of

    the control file Each copy on a separate disk At least one copy on a separate disk controller

    Control files

  • 8/14/2019 Less14 BR Concepts MB3

    21/2814-21 Copyright 2005, Oracle. All rights reserved.

    Redo Log Files

    Multiplex redo log groups to protect against mediafailure and loss of data. It is suggested that redo loggroups have: At least two members (files) per group Each member on a separate disk drive Each member on a separate disk controller

    Note: Performanceis heavilyinfluencedby writing toredo logs.

    Group 1 Group 2 Group 3

    Disk 1

    Disk 2

    Member 1

    Member 2

    Member 1

    Member 2

    Member 1

    Member 2

  • 8/14/2019 Less14 BR Concepts MB3

    22/2814-22 Copyright 2005, Oracle. All rights reserved.

    Multiplexing the Redo Log

  • 8/14/2019 Less14 BR Concepts MB3

    23/2814-23 Copyright 2005, Oracle. All rights reserved.

    Archive Log Files

    To preserve redo information, create archived copiesof redo log files by performing the following steps.

    1. Specify archive log file naming convention.

    2. Specify one or more archive log file locations.3. Switch the database to ARCHIVELOG mode.

    Online redo log files Archive log files

  • 8/14/2019 Less14 BR Concepts MB3

    24/2814-24 Copyright 2005, Oracle. All rights reserved.

    Archive Log File: Naming and Destinations

  • 8/14/2019 Less14 BR Concepts MB3

    25/2814-25 Copyright 2005, Oracle. All rights reserved.

    Archiving Log File Naming andDestinations

    Full Notes Page

  • 8/14/2019 Less14 BR Concepts MB3

    26/2814-26 Copyright 2005, Oracle. All rights reserved.

    ARCHIVELOG Mode

    To place the database in ARCHIVELOG mode,perform the following steps:1. Select the ARCHIVELOG Mode check box.2. Click Apply. The database can be set to

    ARCHIVELOG mode only from the MOUNT state.3. Click Yes when asked whether you want to restart

    the database.4. Back up your database.

    Databases in ARCHIVELOG mode have access tothe full range of backup and recovery options.

  • 8/14/2019 Less14 BR Concepts MB3

    27/28

    14-27 Copyright 2005, Oracle. All rights reserved.

    Summary

    In this lesson, you should have learned how to: Identify the types of failure that may occur in an

    Oracle database

    Describe ways to tune instance recovery Identify the importance of checkpoints, redo log

    files, and archive log files Configure ARCHIVELOG mode

  • 8/14/2019 Less14 BR Concepts MB3

    28/28

    Practice Overview:Configuring for Recoverability

    This practice covers the following topics: Multiplexing control files Multiplexing redo log groups

    Placing your database in ARCHIVELOG mode Ensuring that redundant archive logs are created