Pages

Showing posts with label oracle rman. Show all posts
Showing posts with label oracle rman. Show all posts

Friday, July 6, 2012

RMAN Interview Questions


1. What is RMAN ?

Recovery Manager (RMAN) is a utility that can manage your entire Oracle backup and recovery activities.

Which Files can be backed up using rman? 

Database Files (with RMAN)
Control Files (with RMAN)
Offline Redolog Files (with RMAN)
INIT.ORA (manually)
Password Files (manually)


 2.   When you take a hot backup putting Tablespace in begin backup mode, Oracle records SCN # from header of a database file.  What happens when you issue hot backup database in RMAN at block level backup? How does RMAN mark the record that the block has been backed up ?  How does RMAN know what blocks were backed up so that it doesn't have to scan them again?


In 11g, there is Oracle Block Change Tracking feature.  Once enabled; this new 10g feature records the modified since last backup and stores the log of it in a block change tracking file. During backups RMAN uses the log file to identify the specific blocks that must be backed up. This improves RMAN's performance as it does not have to scan whole datafiles to detect changed blocks.
Logging of changed blocks is performed by the CTRW process which is also responsible for writing data to the block change tracking file. RMAN uses SCNs on the block level and the archived redo logs to resolve any inconsistencies in the datafiles from a hot backup. What RMAN does not require is to put the tablespace in BACKUP mode, thus freezing the SCN in the header. Rather, RMAN keeps this information in either your control files or in the RMAN repository (i.e., Recovery Catalog). 



3.  What are the Architectural components of RMAN?


1.RMAN executable
2.Server processes
3.Channels
4.Target database
5.Recovery catalog database (optional)
6.Media management layer (optional)
7.Backups, backup sets, and backup pieces

4.  What are Channels?

A channel is an RMAN server process started when there is a need to communicate with an I/O device, such as a disk or a tape. A channel is what reads and writes RMAN backup files. It is through the allocation of channels that you govern I/O characteristics such as:
  • Type of I/O device being read or written to, either a disk or an sbt_tape
  • Number of processes simultaneously accessing an I/O device
  • Maximum size of files created on I/O devices
  • Maximum rate at which database files are read
  • Maximum number of files open at a time
5.  Why is the catalog optional?


Because RMAN manages backup and recovery operations, it requires a place to store necessary information about the database. RMAN always stores this information in the target database control file. You can also store RMAN metadata in a recovery catalog schema contained in a separate database. The recovery catalog
schema must be stored in a database other than the target database.

6.  What does complete RMAN backup consist of ?



A backup of all or part of your database. This results from issuing an RMAN backup command. A backup consists of one or more backup sets.

7.  What is a Backup set?

A logical grouping of backup files -- the backup pieces -- that are created when you issue an RMAN backup command. A backup set is RMAN's name for a collection of files associated with a backup. A backup set is composed of one or more backup pieces.

8.  What is a Backup piece?

A physical binary file created by RMAN during a backup. Backup pieces are written to your backup medium, whether to disk or tape. They contain blocks from the target database's datafiles, archived redo log files, and control files. When RMAN constructs a backup piece from datafiles, there are a several rules that it follows:
  • A datafile cannot span backup sets
  • A datafile can span backup pieces as long as it stays within one backup set
  • Datafiles and control files can coexist in the same backup sets
  • Archived redo log files are never in the same backup set as datafiles or control files RMAN is the only tool that can operate on backup pieces. If you need to restore a file from an RMAN backup, you must use RMAN to do it. There's no way for you to manually reconstruct database files from the backup pieces. You must use RMAN to restore files from a backup piece.
  • 9.  What are the benefits of using RMAN?


    1. Incremental backups that only copy data blocks that have changed since the last backup.
    2. Tablespaces are not put in backup mode, thus there is noextra redo log generation during online backups.
    3. Detection of corrupt blocks during backups.
    4. Parallelization of I/O operations.
    5. Automatic logging of all backup and recovery operations.
    6. Built-in reporting and listing commands.

    Thursday, May 24, 2012

    Recovery Manager (RMAN)


    Introduction:
    This document explains the basic operation of SMR & RMAN. Because of the
    enormous flexibility of RMAN only the most basic features will be covered
    here. For more information, please read the Oracle8 Server Backup & Recovery
    Guide or Oracle8i Recovery Manager User's Guide. For comprehensive examples,
    please view the online case*.rcv scripts in $ORACLE_HOME/rdbms/demo.
    For the sake of clarity, I have excluded RMAN error messages and return
    codes unless necessary. It is usually obvious when an error occurs!
     
    See also :
    Note 120084.1 RMAN 8.0 to 8i - Getting Started
    Note.360416.1 Oracle10g - Getting Started with Recovery Manager (RMAN)
     
    1. What is RMAN?
    RMAN can be used to backup and restore database files, archive logs, and
    control files. It can also be used to perform complete or incomplete
    database recovery. Note that RMAN cannot be used to backup initialization
    files or password files.
     
    RMAN starts Oracle server processes on the database to be backed up or
    restored. The backup, restore, and recovery is driven through these processes
    hence the term 'server-managed recovery'.
    Note that SMR can also be controlled from OEM's Backup Manager GUI. This
    article will not discuss Backup Manager.
     
    2. Terminology
    2.1. Backup sets
     A backup set is characterised by the following:
           - Contains one or more datafiles or archivelogs
           - Stored in an Oracle proprietary format
           - Comprises a complete set of backup pieces
           - Constitutes a full or incremental backup
     
    2.2. Backup pieces
    A backup set is comprised of a number of backup pieces. Each backup piece
    is a single output file. The size of a backup piece can be restricted;
    if the size is not restricted, the backup set will comprise one backup
    piece. Backup piece size should be restricted to no larger than the
    maximum file size that your filsystem will support.
    2.3. Image copies
    An image copy is a copy of a single file (datafile, archivelog, or
    controlfile). It is very similar to an O/S copy of the file. It is not
    a backupset or a backup piece. No compression is performed.
    2.4. Full backup sets
    A full backup is a backup of one or more datafiles that contains all used
    blocks in the datafile. Blocks that have never been used are not backed up
    i.e. oracle performs backup set compression.
    2.5. Incremental backup sets
    An incremental backup is a backup of one or more datafiles that contains
    only those blocks that have been modified since a previous backup at the
    same or lower level. As with full backups, compression is performed.
    2.6. File multiplexing
    Datablocks from multiple datafiles can be multiplexed in the same
    backupset.
    2.7. Recovery catalog resyncing
    Resyncing the recovery catalog involves synchronising the recovery
    catalog with the target database controlfile. Certain operations perform
    this implicitly. To resync manually, issue the 'resync catalog;' command
    from RMAN. The catalog should be resynced frequently, especially if
    the target database generates many archive logs. It should also be
    resynced after making any structural changes to the target database.
    Although the target database's controlfile is automatically updated
    whenever new controlfile records are created (for example, creation of
    new archived logs or new datafiles), if the target is not resync'd
    and a backup controlfile is restored, the new records must be cataloged
    manually (catalog archivelog '';).
    2.8. Snapshot Controlfile
    When RMAN needs to resynchronize from a read-consistent version
    of the control file, it creates a temporary snapshot control file. The default
    name for the snapshot control file is port-specific. Use the 'set snapshot
    controlfile name to file_name' command to change the name of the snapshot
    control file; subsequent snapshot control files that RMAN creates use the
    name specified in the command. The snapshot control file name can also
    be set to a raw device. This operation is important for OPS databases in
    which more than one instance in the cluster use RMAN because server sessions
    on each node must be able to create a snaphost control file with the same name
    and location.
    2.9. Resetlogs Operation
    Whenever you open the database with the RESETLOGS option, all datafiles
    get a new RESETLOGS SCN and timestamp. Archived redo logs also have
    these two values in their header. Because Oracle will not apply an archived
    redo log to a datafile unless the RESETLOGS SCN and timestamps match,
    the RESETLOGS operations prevents you from corrupting your datafiles with
    old archived logs.
    2.1.0 Database Incarnation
    Whenever you perform incomplete recovery or perform recovery using a
    backup control file, you must reset the online redo logs when you open the
    database. The new version of the reset database is called a new incarnation.
    All archived redo logs generated after the point of the RESETLOGS on the
    old incarnation are invalid in the new incarnation.
    2.1.1. Resetting the Recovery Catalog
    Before you can use RMAN again with a target database that you have
    opened with the RESETLOGS option, notify RMAN that you have reset
    the database incarnation. The reset database command directs RMAN
    to create a new database incarnation record in the recovery catalog.
    This new incarnation record indicates the current incarnation. RMAN
    associates all subsequent backups and log archiving done by the target
    database with the new database incarnation. If you issue the ALTER
    DATABASE OPEN RESETLOGS statement but do not reset the
    database, then RMAN cannot access the recovery catalog because it
    cannot distinguish between a RESETLOGS command and an accidental
    restore of an old control file. By resetting the database, you inform
    RMAN that the database has been opened with the RESETLOGS option.
    In the rare situation in which you wish to undo the effects of opening
    with the RESETLOGS option by restoring backups of a prior incarnation
    of the database, use the 'reset database to incarnation key' command to
    change the current incarnation to an older incarnation.