2007 RMOUG PAL Presentation

Embed Size (px)

Citation preview

  • 8/8/2019 2007 RMOUG PAL Presentation

    1/43

  • 8/8/2019 2007 RMOUG PAL Presentation

    2/43

  • 8/8/2019 2007 RMOUG PAL Presentation

    3/43

  • 8/8/2019 2007 RMOUG PAL Presentation

    4/43

  • 8/8/2019 2007 RMOUG PAL Presentation

    5/43

  • 8/8/2019 2007 RMOUG PAL Presentation

    6/43

  • 8/8/2019 2007 RMOUG PAL Presentation

    7/43

    7

    RMAN Disk

  • 8/8/2019 2007 RMOUG PAL Presentation

    8/43

    8

    S etupSeparate backup types on RMAN disk bydirectory (eg.)

    /RMAN /< SID>_ARCH /RMAN /< SID>_DATA /RMAN /< SID>_C O NTR OL

    Init parameters - dynamic (eg.)alter system set control_file_record_keep_time = 30;alter system set archive_lag_target = 900;Init.ora file too!

  • 8/8/2019 2007 RMOUG PAL Presentation

    9/43

    9

    E xample of a P OO R Setupcontrol_file_record_keep_time = 5

  • 8/8/2019 2007 RMOUG PAL Presentation

    10/43

    10

    Actions:

    Ensure other systems are not removing archived logs.Set environment. $ export O RAC LE _SID= $ export O RAC LE _H O ME = $ rman target / nocatalog

    Backup archived logs (temporary).run {

    allocate channel a1 type disk format'/RMAN /< SID>_ARCH /% d_arch_ % s_ % p_ % c_ % t.rmn';

    backupskip inaccessiblearchivelog alltag 'manual_arch'

    filesperset 4delete input;}

  • 8/8/2019 2007 RMOUG PAL Presentation

    11/43

  • 8/8/2019 2007 RMOUG PAL Presentation

    12/43

    12

    (Actions)

    Validate Archived logs.$ rman target / nocatalog

    run {allocate channel v1 type disk;allocate channel v2 type disk;

    allocate channel v type disk;change archivelog all validate;

    }

    Schedule archive backups.

    Set cron for regular level0 backups.Tape backup of RMAN disk .

  • 8/8/2019 2007 RMOUG PAL Presentation

    13/43

    13

    P ros All benefits of RMAN!!No need for O racle Agent from tape vendor!!Backups /Restores from disk are faster thantape!!

    No need for hot backup mode!!RMAN utility is included with all standard andE nterprise O racle licenses!!

    Cons

    Your controlfile has limited visibility into thehistory of its backups.Disk is more expensive than tape.

  • 8/8/2019 2007 RMOUG PAL Presentation

    14/43

    1414

    C orruption Management UsingC orruption Management Using

    RMAN With Neither Budget NorRMAN With Neither Budget NorSpace!Space!

  • 8/8/2019 2007 RMOUG PAL Presentation

    15/43

    15

    F ACTS

    Corruption can, and will, go undetected.Corruption can happen due to many reasons.Chance of corruption can never be eliminated.

    The longer corruption goes undetected, themore difficult and potentially costly it is tocorrect /overcome.

    D o You Know If You Have Corruption?Are you S ure?

  • 8/8/2019 2007 RMOUG PAL Presentation

    16/43

    16

    Wh at Are Your Options To F ind Corruption?select * from < table>;analyze validate structure cascade [online];exp /imp show=yDBVDBMS_R E PAIRInit parameters

    db_block_checkingdb_block_compute_checksumdb_block_checksumdb_block_cache_protect=true

    _db_block_cache_protect=true _check_block_after_checksum _db_always_check_system_ts

    Sum3 rd partyRMAN

  • 8/8/2019 2007 RMOUG PAL Presentation

    17/43

    17

    RMAN to find corruption wit h out $$ or spaceWrite Script

    $ vi /RMAN /SCRIPTS /level0_validate.ksh

    #! /bin/kshexport O RAC LE _SID= export O RAC LE _H O ME=echo "before_time: `date +" %Y% m% d% H% M% S"`"rman target / nocatalog level0_validate.log 2>&1

  • 8/8/2019 2007 RMOUG PAL Presentation

    18/43

    18

    NOTE: Log output will N O T indicate corruption found!

    Database must be queried after RMAN validate$ vi /RMAN /SCRIPTS /level0_validate.ksh

    $ sqlplus ' /as sysdba'

    SQ L> select distinct c.file# " F ile#",c.block# "Starting Block#", c.blocks "Range"from v $ backup_corruption c, v $backup_set swhere c.set_stamp = s.set_stampand c.set_count = s.set_countand s.start_time > to_date(&before_time', ' YYYYMMDDHH24MISS')order by 1,2;

    Get before_time variable from RMAN validate log$ grep before_time: level0_validate.log

  • 8/8/2019 2007 RMOUG PAL Presentation

    19/43

    19

    P ros

    You are backing up with RMAN!!Corruption checking as supported and designedby O racle!!

    Other than small log files, no additional spacewas used for this system!!No additional cost was incurred!!

    Cons

    RMAN uses host resources and can take time.This should be during low instance activity.

    You are not actually backing anything up!

  • 8/8/2019 2007 RMOUG PAL Presentation

    20/43

    2020

    C orrupt Block RecoveryC orrupt Block Recovery

    (No Downtime) Without Prior(No Downtime) Without PriorRMAN Backups!RMAN Backups!

  • 8/8/2019 2007 RMOUG PAL Presentation

    21/43

    21

    Wh at Are Your Options To Handle Corruption?

    DBMS_R E PAIR Full database recovery

    Individual datafile recovery

    create table as select ;drop table ; recreate from export.RMAN

  • 8/8/2019 2007 RMOUG PAL Presentation

    22/43

    22

    RMAN to Repair Corruption W ith out P rior RMAN Backups! W ith out D owntime! W ith out D ata Loss!

    Will this work?What is your present backup method?

    1. E xport- O nly2. Cold backup copies - noarchivelog3. Cold backup copies - archivelog

    4. Hot backup mode copies5 . Consistent snap (crash-consistent) copies

  • 8/8/2019 2007 RMOUG PAL Presentation

    23/43

    23

    Non-RMAN Backup Analysis:1. E xport- O nly

    Not possible to restore without downtime!Data loss is likely!Terrible choice for backup!

    2. Cold backup copies noarchivelogNot possible to restore without downtime!

    Data loss is likely!Awful choice of backup for a database with high uptime needs!

    3. Cold backup copies arc h ivelogRMAN can save the day!Why are you backing up cold with high uptime requirements?

    4. Hot backup mode copiesRMAN can save the day!

    5. Consistent snap (cras h -consistent) copiesRMAN can save the day!

  • 8/8/2019 2007 RMOUG PAL Presentation

    24/43

  • 8/8/2019 2007 RMOUG PAL Presentation

    25/43

    25

    Example:No corruption in database yet (run after RMAN validate procedure).

  • 8/8/2019 2007 RMOUG PAL Presentation

    26/43

    26

    (example)Hot backup mode copy Last good backup.

  • 8/8/2019 2007 RMOUG PAL Presentation

    27/43

  • 8/8/2019 2007 RMOUG PAL Presentation

    28/43

    28

    S tep #1Note file# and block# of corrupt block(s).

    O ptions: (after RMAN validate is run)

    Select from v $backup_corruptionselect distinct c.file# " F ile#",c.block# "Starting Block#", c.blocks "Range"from v $backup_corruption c, v $backup_set swhere c.set_stamp = s.set_stamp

    and c.set_count = s.set_countand s.start_time > to_date('&before_time', ' YYYYMMDDHH24MISS')

    order by 1,2;

    Alert log

    Trace fileDBVdbv file= blocksize=

  • 8/8/2019 2007 RMOUG PAL Presentation

    29/43

    29

    (example) S elect

  • 8/8/2019 2007 RMOUG PAL Presentation

    30/43

    30

    (example) Alert log

  • 8/8/2019 2007 RMOUG PAL Presentation

    31/43

    31

    (example) Trace file

  • 8/8/2019 2007 RMOUG PAL Presentation

    32/43

    32

    (example) D BV

  • 8/8/2019 2007 RMOUG PAL Presentation

    33/43

    33

    S tep #2:E nsure that the last good backup of the corrupted file is visible.

  • 8/8/2019 2007 RMOUG PAL Presentation

    34/43

    34

    (example)Proof that no RMAN backups exist & attempt block recover.

  • 8/8/2019 2007 RMOUG PAL Presentation

    35/43

    35

    S tep #3:Catalog the backup of the corrupt file in the controlfile using the RMAN utility.

  • 8/8/2019 2007 RMOUG PAL Presentation

    36/43

    36

    (example)O nly thing in controlfile.

  • 8/8/2019 2007 RMOUG PAL Presentation

    37/43

    37

    S tep #4:Recover the corrupt block(s) using the RMAN utility.

  • 8/8/2019 2007 RMOUG PAL Presentation

    38/43

    38

    (example) D BV (after fix)

  • 8/8/2019 2007 RMOUG PAL Presentation

    39/43

    39

    (example)But record of corruption remains in view.

  • 8/8/2019 2007 RMOUG PAL Presentation

    40/43

    40

    P rosRMAN just saved you from instance downtimefor a corruption recovery, without a prior RMANbackup and without data loss!!

    ConsIf your first corruption check identifies corruption,it will be difficult to find the last good, corruption-less backup. To be effective, regular corruptionchecks are highly recommended.If you wanted to make corruption sound like thebig deal that it is, you have just gone under theradar by maintaining uptime, so you will not getthe attention that you had hoped for

  • 8/8/2019 2007 RMOUG PAL Presentation

    41/43

  • 8/8/2019 2007 RMOUG PAL Presentation

    42/43

    4242

    CO NCL USI O NCO NCL USI O N

    There Is No GoodThere Is No GoodReason For NotReason For Not

    Using RMAN!Using RMAN!

  • 8/8/2019 2007 RMOUG PAL Presentation

    43/43

    4343

    Q UESTI O NS?Q UESTI O NS?

    C ontact Info:C ontact Info:Raj@Pal f oundation .ne t Raj@Pal f oundation .ne t