RECOVERY MANAGER - PowerPoint PPT Presentation

1 / 38
About This Presentation
Title:

RECOVERY MANAGER

Description:

RMAN is a stand-alone application that makes. a client connection to the Oracle DB to access ... Media manager retention policies can cause havoc if they ... – PowerPoint PPT presentation

Number of Views:175
Avg rating:3.0/5.0
Slides: 39
Provided by: uniroyal
Category:

less

Transcript and Presenter's Notes

Title: RECOVERY MANAGER


1
RECOVERY MANAGER
  • Presenter
  • STEPHEN SIEW

2
WHAT IS RMAN ?
  • RMAN is a stand-alone application that makes
  • a client connection to the Oracle DB to access
  • internal backup and recovery packages. It is, at
  • its core, nothing more than a command
  • Interpreter that takes simplified commands you
  • type and turns those commands into remote
  • calls (RPCs) that are executed at the DB.

3
NEW FEATURES OF RMANPART I
  • Automation of backup, restore and recovery
    operations
  • Block media recovery
  • Whole database backups or backups of any
    logical unit control file, datafile, tablespace
    or archive log
  • Offline and Online backups
  • Integrated with 3rd Party Media Management
    Vendors to backup to tape
  • Two types of backup image copies to disk or
    Recovery Manager backup sets
  • Intelligent management of the archived redo
    logs for both backup and recovery
  • Proxy Copy Backup Accelerator for fast copy
    technology at the storage subsystem level
  • Integration with Oracle Enterprise Managers
    Backup Manager GUI

4
NEW FEATURES OF RMANPART II
  • Incremental backups at the Oracle block level
    for high performance backup and recovery
  • Omission of empty blocks during backup for
    optimization
  • Recoverability redundancy when both
    incrementals and archiving are used
  • No extra redo is generated during online
    database backup
  • Intelligent buffering with multiplexing of
    multiple input files for high speed tape
    streaming
  • Support for Oracle Real Application Clusters
    backup and recovery
  • Ability to recover through unrecoverable
    operations, when using incremental backups
  • O/S-independent scripting language

5
What does RMAN do?
  • It does very little. The backing up and the
  • recovery of the DB is done by the processes.
  • The Oracle DB has internal packages that
  • Actually take the pl/sql blocks passed from
  • RMAN and turn them into system calls to
  • read from, write to, the disk subsystem of
  • your DB server.

6
Who carry the weight?
  • The RMAN is make up of two pieces
  • The executable file
  • The recover.bsq file
  • The recover.bsq file is the brains of the whole
  • operation. It is essentially the library file
    from which the
  • executable file extracts code for creating pl/sql
    calls to
  • the target. These two files are invariably
    linked, and
  • logically make up the RMAN client utility. These
    two
  • must be the same version to work.

7
How does the RMAN utility works ?
  • RMAN utility interprets commands you provide
  • into pl/sql calls that are remotely executed at
    the
  • target. These commands are interpreted by the
  • executable translator, and then matched to pl/sql
  • blocks in the recover.bsq file. RMAN then passes
  • These RPCs to the DB to gather info based on
  • what you have requested.

8
RMAN ProcessStarting the Backup
  • RMAN makes the bequeath connection to the
  • target DB . It checks the the variable
  • ORACLE_SID for an instance name, spawns
  • a server process at that instance, logging in as
    a
  • SYSDBA user. This connects as the internal DB
  • user SYS. RMAN immediately spawns the
  • channel processes that will perform the backup.

9
RMAN Compilation Call to sys.dbms_rcvman
  • It request DB schematic info from the target DB
  • controlfile, starting with the determinations of
  • Target DB version version info from the
  • controlfile What type of controlfile? What
  • is the current sequence number? When was
  • it created? Requesting info for each datafile
    in the
  • DB and whether it is offline. It gathers which
    disk each
  • file is on and how to dole out work.

10
RMAN Creating the Backupsetdbms_backup_restore
  • After the list is compiled, it begin the backup
  • process itself. To guarantee consistency, it then
  • builds the snapshot controlfile. If one already
  • exists, it overwrites it with a new one. Then
  • RMAN creates the call to the package to create
  • the backup piece. The backup piece will be built
  • in the default file location unless specified
    otherwise.
  • Unix ORACLE_HOME/dbs Win in database dir.

11
RMAN Allocating the memory
  • After it is allocated, it initiates the backup
    piece.
  • The backup piece will be given a default name
  • that guarantees uniqueness. It determines if
    there
  • will be enough space for the backup. In 8i it
    preallocates
  • space for backups but not in 9i. Once the backup
    piece is
  • initiated, then the channel process can begin the
    DB
  • backup process. It determines if you are using
    spfile, it
  • then backs it up and if has automatic controlfile
    backup
  • is set, it will backup the controlfile.

12
RMAN The Backup
  • It backed up the spfile and controlfile, and it
    is
  • time to begin the datafile reads to pull data
    blocks
  • into memory. The channel process does this by
  • doing a read-ahead on the disk and pulling
  • several blocks into memory at the same time.
  • Then, memory-to-memory write from input
  • buffer to output buffer occurs. During this write,

13
RMAN Writing in Memory
  • RMAN determines if the block has ever initialized
    or if the
  • block header information is zeroed out. If it is
    an unused
  • block, the write to the output buffer never
    occurs. If the
  • block has been used, RMAN performs a checksum on
    the
  • block. If the header and footer of the block do
    not match,
  • RMAN indicates a corrupt block and aborts the
    backup. If
  • It matches, the block is written to the output
    buffer. Once
  • the output buffer is filled to capacity, it dump
    the buffers to the
  • backup file location. There is no order to the
    blocks in the dump file.

14
RMAN START UP DB
  • To start the database using RMAN, at the RMAN
  • prompt (assuming you are already in RMAN),
  • RMANgt startup
  • RMAN-06196 Oracle instance started
  • RMAN-06199 database mounted
  • RMAN-06400 database opened
  • Total System Global Area 94525468
    bytes
  • Fixed Size 75804
    bytes
  • Variable Size 27262976
    bytes
  • Database Buffers 67108864
    bytes
  • Redo Buffers 77824
    bytes

15
RMAN Different Startup Mode
  • To start the database in nomount mode.
  • RMANgt startup nomount
  • To start the database in mount mode.
  • RMANgt startup moun

16
RMAN SHUTDOWN THE DB
  • To shut down the database using RMAN
  • RMANgt shutdown
  • RMAN-06405 database closed
  • RMAN-06404 database dismounted
  • RMAN-06402 Oracle instance shut down
  • To exit RMAN, just type in 'exit" at the prompt.
  • RMANgt exit

17
RMAN Shutdown Mode
  • To shutdown immediate.
  • RMANgt shutdown immediate
  • To shutdown abort.
  • RMANgt shutdown abort

18
Oracle9i RMAN Improvements
  • Streamlined syntax
  • Configurable persistent channel settings
  • Automatic backup of control files
  • Backup optimization
  • Restore optimization
  • Block-level recovery
  • Enhancement to archived redo log backups

19
RMAN - CONFIGURATIONS
  • The channel configuration settings are stored
  • in the target database control file, so you don't
  • have to re-issue channel configuration
  • commands each time you perform a backup,
  • restore, or copy operation. This reduces the
  • amount of code required to perform an RMAN
  • command, which in turn lessens the possibility
  • of human error.

20
RMAN SHOW ALL PART I
  • RMANgt show all 
  • using target database controlfile instead of
    recovery catalog
  • RMAN configuration parameters are
  • CONFIGURE RETENTION POLICY TO REDUNDANCY 1
    default
  • CONFIGURE BACKUP OPTIMIZATION OFF
  • CONFIGURE DEFAULT DEVICE TYPE TO DISK default
  • CONFIGURE CONTROLFILE AUTOBACKUP OFF
  • CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR
    DEVICE TYPE DISK TO F'

21
RMAN SHOW ALLPART II
  • CONFIGURE DEVICE TYPE DISK PARALLELISM 1
  • CONFIGURE DATAFILE BACKUP COPIES FOR DEVICE TYPE
    DISK
  • TO 1 default
  • CONFIGURE ARCHIVELOG BACKUP COPIES FOR DEVICE
    TYPE
  • DISK TO 1 default
  • CONFIGURE CHANNEL DEVICE TYPE DISK RATE 5 M
    FORMAT
  • 'D\ORACLE\DEMO\ADMIN\RMAN_BKUP\dDBFs.BKUP'
  • CONFIGURE MAXSETSIZE TO UNLIMITED default
  • CONFIGURE SNAPSHOT CONTROLFILE NAME TO
  • 'D\ORACLE\ORA92\DATABASE\SNCFDEMO.ORA' default

22
RETENTION POLICYPART I
  • There are two types of retention policies
    available in
  • RMAN
  • Recovery Window
  • Redundancy
  • RMANgt configure retention policy to redundancy 2
  • RMANgt configure retention policy to recovery
  • window of 7 days

23
RETENTION POLICY PART II
  • NOTE
  • Media manager retention policies can cause havoc
    if they
  • are not properly synchronized with RMAN
    retention policies! For instance, when using
    optimization ,y ou could have your media manager
    software remove a backup, and RMAN would not know
    about it. This might cause the DB to be
    unrecoverable.
  • - If the control_file_record_keep_time DB
    parameter value is less than the time set for the
    retention policy, you will need to use a recovery
    catalog.

24
DELETE OBSOLETE
  • RMANgt report obsolete redundancy2
  • RMANgt delete obsolete redundancy 2
  • RMANgt delete obsolete recovery window of 7 days
  • To remove orphaned backups that were
  • created from a different incarnation of the DB.
  • RMANgt delete obsolete orphan

25
BACKUP FILE OPTIMIZATION
  • With BFO, if RMAN is about to backup a file,
  • and the file has already been backed up by the
  • same device type, RMAN will skip the
  • backup of that file. This includes both data
  • files and archived redo logs backed up by
  • RMAN. Oracle will determines whether the
  • file has changed by comparing the datafile to the
  • header of the backed up datafile.

26
AUTO BACKUP OF CONTROL FILE
  • It provides the capability to configure
  • automated control file backups. When
  • enabled, these automated control file backups
  • Will occur any time a backup or copy
  • command is issued either from the RMAN
  • Command or within a run command block. Within
  • the run block, the controlfile backup will occur
    only
  • after the last backup command in the block has
  • completed. You can also use the OS copy command.

27
HOW TO RECOVER A CONTROLFILE?
  • When you turn the controlfile autobackup
  • on, it gives you the ability to recover the
  • controlfile backup that was made as the
  • result of an auto backup. You can use the
  • restore controlfile from autobackup
  • command. This allows you to restore the
  • controlfile without repository.

28
SNAPSHOT CONTROLFILE PART I
  • The controlfile is a busy little file. It is
    responsible for schematic
  • information about the DB, which includes
    checkpoint SCN info
  • for recovery. The constant SCN and file
    management is critical
  • to the livelihood of your DB, so the controlfile
    must be available
  • for usage by the RDBMS on a constant basis.
  • This poses a problem for RMAN. RMAN needs to get
    a
  • consistent view of the controlfile when it sets
    out to make a
  • backup of every datafile. It only needs to know
    the most recent
  • checkpoint information and file schematic info at
    the time the
  • backup begins.

29
SNAPSHOT CONTROLFILE PART II
  • After the backup starts, it needs this info to
    stay consistent for
  • the duration of the backup operation in other
    words, it needs a
  • read consistent view of the controlfile. With the
    constant updates
  • from the DB, this is impossible unless RMAN
    were to lock the
  • control file for the duration of the backup.
    That would mean the
  • DB could not advance the checkpoint or switch
    logs or produce
  • new archive logs. Impossible!
  • To get around this, RMAN uses the snapshot
    controlfile, an exact

30
SNAPSHOT CONTROLFILE PART III
  • Copy of your controlfile that is only used by
    RMAN during
  • backup and resync operations. At the beginning of
    these
  • operations, RMAN refreshes the snapshot
    controlfile from the
  • actual controlfile, thus putting a momentary lock
    on the
  • controlfile. Then, RMAN switches to the snapshot
    and uses it for
  • the duration of the backup in this way, it has
    read consistency
  • without holding up DB activity.
  • By default, it exists in the ORACLE_HOME/dbs
    UNIX and
  • database on W2K.

31
COLD DB BACKUP
  • Cgt rman target /
  • RMANgt shutdown immediate
  • RMANgt startup mount
  • RMANgt backup database
  • RMANgt alter database open

32
RECOVER FROM COLD DB BACKUP
  • C\gt rman target /
  • RMANgt startup
  • Example It complain about it is missing a
    datafile(s).
  • RMANgt shutdown immediate
  • RMANgt startup nomount
  • RMANgt set DBID ltenter the DBID of the DB heregt
  • RMANgt restore controlfile from autobackup
  • RMANgt alter database mount
  • RMANgt restore database
  • RMANgt recover database
  • RMANgt alter database open

33
ONLINE DATABASE BACKUP RECOVERY
  • C\gt rman target /
  • RMANgt backup database plus archivelog
  • RMANgt restore database
  • RMANgt recover database
  • RMANgt alter database open

34
BACKUP TABLESPACE DATAFILE PART I
  • C\gt rman target /
  • RMANgt backup tablespace users plus archivelog
  • If the tablespace was dropped accidentally.  
  • RMANgt startup mount
  • RMANgt sql "alter tablespace users offline"
  • RMANgt restore tablespace users
  • RMANgt recover tablespace users
  • RMANgt sql "alter tablespace users online"
  • RMANgt alter database open

35
BACKUP TABLESPACE DATAFILE PART II
  • C\gt rman target /
  • RMANgt sql "alter database datafile 3 offline'
  • or
  • RMANgt sql "alter database datafile
    d\oracle\oradata\rman_bkup\users01.dbf
    offline"
  • RMANgt restore datafile 3
  • or
  • RMANgt restore datafile d\oracle\oradata\rman_bku
    p\users01.dbf
  • RMANgt recover datafile 3
  • or
  • RMANgtrecover datafile d\oracle\oradata\rman_bkup
    \users01.dbf
  • RMANgt sql "alter database datafile 3 online"
  • or
  • RMANgt sql " alter database datafile
  • d\oracle\oradata\rman_bkup\users01.
    dbf onfline'

36
RECOVER MISSING ARCHIVED LOG THAT WERE MISSING
PART I
  • You accidentally deleted the archived logs that
    were restored by a DBA
  • for disaster recovery. You go to the archive
    directory and see which
  • archived logs (3,5,6 and 9)are missing.
  • RMANgt startup mount
  • RMANgt restore archivelog from logseq 2
  • Starting restore at 16-APRIL-04
  • using channel ORA_DISK_1
  • archive log thread 1 sequence 2 is already on
    disk as file
  • D\ORACLE\DEMO\ARCH\SSTT_2.ARCH

37
RECOVER MISSING ARCHIVED LOG THAT WERE MISSING _
PART II
  • Starting restore at 16-APRIL-04
  • using channel ORA_DISK_1
  • archive log thread 1 sequence 2 is already on
    disk as file
  • D\ORACLE\DEMO\ARCH\SSTT_2.ARCH
  • archive log thread 1 sequence 4 is already on
    disk as file
  • D\ORACLE\SST\ARCH\SSTT_4.ARCH
  • Piece handleD\ORACLE\DEMO\ADMIN\RMAN_BKUP\SSTDBF
    28.BKUP
  • tagnull paramsNULL
  • channel ORA_DISK_1 restore complete
  • Finished restore at 16-DEC-02
  • RMANgt

38
BLOCK MEDIA RECOVERY
Assuming you got the following error
message ORA-01578 ORACLE data block corrupted
(file 19, block 44) ORA-01110 data file 19
d\oracle\DEMO\oradata\users01.dbf BMR applies
only to complete recovery because incomplete
recovery would leave the database in an
inconsistent state. RMANgt blockrecover datafile
19 block 44 RMANgt blockrecover datafile 19 block
44,66,127 RMANgt blockrecover datafile 19 block
44 datafile 22 block 203
Write a Comment
User Comments (0)
About PowerShow.com