How to Find Files with Recovery Manager in Oracle 12c

By Chris Ruel, Michael Wessler

Recovery Manager (RMAN) is Oracle 12c’s backup and recovery solution to protect the files in your database. It can recover from things like lost rows or lost objects, but its primary purpose is to restore and recover lost files.

How to start RMAN in Oracle 12c

You have several ways to launch RMAN:

  • Launch the tool and then log in.

  • Launch the tool and login all at once.

  • Launch the tool and have all the output go to a log file. This option is typically used when running RMAN as a scheduled task.

Here is an example of probably the simplest way to start RMAN:

  1. Set your ORACLE_SID from the OS command line:

    Windows:

    <set ORACLE_SID=dev12c>

    Linux/UNIX:

    <. oraenv>
    <dev12c>

    This example uses dev12c for the ORACLE_SID. There will be no output for setting your ORACLE_SID.

  2. Launch RMAN:

    <rman>

    RMAN launches.

    image0.jpg

  3. Connect to the database you want to back up:

    RMAN> connect target /

    You see something like this:

connected to target database: DEV12C (DBID=3615982967)
RMAN>

How to configure RMAN in Oracle 12c

You can preconfigure some parameters for RMAN. These parameters are primarily for options that you want to use for all your backups and recoveries.

  1. Launch RMAN.

  2. View a list of these parameters by typing the following:

    <show all;>

    You see this:

using target database control file instead of recovery catalog
RMAN configuration parameters for database with db_unique_name DEV12C are:
CONFIGURE RETENTION POLICY TO REDUNDANCY 1; # default
CONFIGURE BACKUP OPTIMIZATION OFF; # default
CONFIGURE DEFAULT DEVICE TYPE TO DISK; # default
CONFIGURE CONTROLFILE AUTOBACKUP OFF; # default
CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '%F'; # default
CONFIGURE DEVICE TYPE DISK PARALLELISM 1 BACKUP TYPE TO BACKUPSET; # default
CONFIGURE DATAFILE BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default
CONFIGURE ARCHIVELOG BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default
CONFIGURE MAXSETSIZE TO UNLIMITED; # default
CONFIGURE ENCRYPTION FOR DATABASE OFF; # default
CONFIGURE ENCRYPTION ALGORITHM 'AES128'; # default
CONFIGURE COMPRESSION ALGORITHM 'BASIC' AS OF RELEASE 'DEFAULT' OPTIMIZE FOR LOAD TRUE ; # default
CONFIGURE RMAN OUTPUT TO KEEP FOR 7 DAYS; # default
CONFIGURE ARCHIVELOG DELETION POLICY TO NONE; # default
CONFIGURE SNAPSHOT CONTROLFILE NAME TO '/u01/app/oracle/product/12.1.0/dbhome_1/dbs/snapcf_dev12c.f'; # default

Sometimes you want to see only one parameter. If so, just choose one parameter name and type this:

<show retention policy;>

You see this:

RMAN configuration parameters for database with db_unique_name DEV12C are:
CONFIGURE RETENTION POLICY TO REDUNDANCY 1; # default

To change a parameter, copy what you see from the SHOW command and change the value accordingly. For example, type

<CONFIGURE RETENTION POLICY TO recovery window of 3 days;>

And you see this:

new RMAN configuration parameters:
CONFIGURE RETENTION POLICY TO RECOVERY WINDOW OF 3 DAYS;
new RMAN configuration parameters are successfully stored

Take a closer look at some of the configuration parameters:

  • Retention Policy: Configuring a retention policy tells RMAN how long you want to keep your backup information. For example, if you reuse your backup tapes every two weeks, you can set your retention policy to expire those backups after 14 days. Retention policies can be set two ways:

    • Recovery Window specifies that after so many days the backup information will expire.

    • Redundancy tells RMAN that after you get so many backups of your files, they will expire

  • Backup Optimization: If you turn on backup optimization and a backup fails halfway through, RMAN picks up where it left off when you restart the backup.

  • Default Device Type: You can have RMAN back up files to disk or tape. This parameter configures what the default method is when the option is omitted from the backup command.

  • Control File Autobackup: You can configure RMAN to take a backup of the control file and the spfile every time a backup runs. Also, if the database is in archive log mode, it will take a backup of the control file any time the database file structure changes, such as renaming or adding a data file.

  • Control File Autobackup Format: This feature tells RMAN the name and location you would like control file auto backups to take on.

  • Parallelism: On a machine with many backup devices, such as tapes or disks as well as multiple CPUs, you can set this parameter to use more resources in hopes of speeding up the backup.

  • Data File Backup Copies: This parameter tells RMAN how many copies to make when backing up files. The more you have the safer you are from losing a backup file.

  • Archive Log Backup Copies: This parameter is similar to data file backup copies, but it applies to archive logs.

  • Max Set Size: Use this parameter when backing up to tape to make sure that the backup files don’t span multiple tapes. This way, losing one tape won’t nullify an entire backup.

  • Encryption for Database: Typically, the backup files created will contain the character strings of data that reside in your data files. A clever hacker can extract this data and perhaps make sense out of it. By turning on this parameter, all the data in the backup file will be garbled.

  • Encryption Algorithm: You can choose the level of encryption in Oracle. The higher the encryption level, the longer it can take to back up the database. Here are your choices:

    • AES128 AES 128-bit key

    • AES192 AES 192-bit key

    • AES256 AES 256-bit key

  • Compression Algorithm: As of Oracle version 11g, you can choose the compression algorithm that RMAN uses to compress backups. You can choose between these two:

    • High compression (BZIP2)

    • CPU efficiency (ZLIB)

  • Snapshot Control File Name: Tell RMAN where to put the control file and what to name it when a snapshot of the control file is taken.