Objectives
After completing this lesson, you should be able to do the following:
• Describe the RMAN repository and recovery catalog
• Describe the Media Management Library interface
• Configure database parameters that affect RMAN operations
• Connect to the three different types of databases by using RMAN
• Configure two types of retention policies
• Change RMAN default settings with CONFIGURE
Steps for Configuring RMAN
1. Determine the repository location: control file or recovery catalog.
2. Define database and environment variables.
3. Start RMAN and connect to the target and, optionally, the recovery catalog databases.
4. Configure persistent settings.
RMAN Repository Data Storage: Comparison of Options
RMAN repository data is always stored in the control file of the target database. But it can also be stored in a separate database, called a recovery catalog.
How to Set Up a Recovery Catalog
1. Create the database to be used as the recovery catalog. Alternatively, identify an already existing database and use that. Because a single recovery catalog can serve more than one database, you may choose to create a single recovery catalog that services all your databases that are being backed up.
2. In the recovery catalog database, create the user that will own the recovery catalog data.
For example, assume that catdb is the name of the catalog database, and rcat_ts is the name of a tablespace you have created where the catalog data is to be stored.
$ sqlplus sys/password@catdb as sysdba
SQL> CREATE USER rman IDENTIFIED BY cat
2 TEMPORARY TABLESPACE temp
3 DEFAULT TABLESPACE rcat_ts
4 QUOTA UNLIMITED ON rcat_ts;
SQL> GRANT UNLIMITED ON rcat_ts TO rman;
3. Grant the RECOVERY_CATALOG_OWNER role to the catalog owner. This role provides
the user with all privileges required to maintain and query the recovery catalog.
GRANT RECOVERY_CATALOG_OWNER TO rman;
4. Start RMAN and log in as the catalog owner.
$ rman catalog rman/cat@catdb
RMAN> CREATE CATALOG TABLESPACE rcat_ts;
5. Connect to the target database by using RMAN, and register it in the newly created recovery catalog.
$ rman target sys/oracle@orcl catalog rman/cat@catdb
RMAN> register database;
Backup Destinations
Backups can be written to:
• Disk directory
• Media Management Library (tape device)
– Typically used for disaster recovery, when disk
backups are lost
• Flash recovery area
– This is a disk area set aside for backup and
recovery and flashback database purposes.
– You define the location and the size.
– Files are automatically named by using Oracle
Managed Files.
– Files are automatically retained and deleted as
necessary.
Media Management
First Step:
1. Install and configure the media management software on the target host or production network. No RMAN integration is required at this stage.
2. Ensure that you can make non-RMAN backups of operating system files on the target database host. This step makes it easier to troubleshoot problems at a later time. Refer to your media management documentation to learn how to back up files to the media manager.
3. Obtain and install the third-party media management module for integration with the Oracle database. This module must contain the library loaded by the Oracle database when accessing the media manager.
When you restore a file, the following steps occur:
1. The Oracle database requests the restoration of a particular file.
2. The media manager identifies the tape containing the file and reads the tape.
3. The media manager passes the information back to the Oracle database session.
4. The Oracle database writes the file to disk.
Using a Flash Recovery Area with RMAN
Each time RMAN creates a file in the flash recovery area, the Oracle database updates the list of files that are no longer required on disk. When a file needs to be written into the flash recovery area and space is not available for that file, the Oracle database deletes a file that is on the obsolete files list and writes a notification to the alert log.
A warning is issued when the flash recovery area experiences space pressure or is low on free space because there are no files that can be deleted from the flash recovery area. To resolve the problem, you can add disk space, back up your files to a tertiary device, delete the files from the flash recovery area using RMAN, or change the RMAN retention policy.
Flash Recovery Area Space Usage
To avoid running out of space in the flash recovery area, you should never store usermanaged files in this area. You should also perform the following steps as needed or appropriate:
• Delete unnecessary files from the recovery area by using RMAN.
• Take frequent backups of the recovery area by using RMAN.
• Change the RMAN retention policy to retain backups for a smaller period of time.
• Change the RMAN archived log deletion policy.
• Add disk space and increase the value of the DB_RECOVERY_FILE_DEST_SIZE database initialization parameter if you are frequently running out of space.
For example, to back up the archived log files in the recovery area and then delete the files after they have been successfully backed up, you would use the RMAN command:
BACKUP ARCHIVELOG ALL DELETE ALL INPUT;
If you use a backup solution other than RMAN, you still have to use RMAN to remove the files from the flash recovery area. After the archived log files have been backed up and removed from disk, use the RMAN CROSSCHECK and DELETE commands to reclaim the archived log space from the flash recovery area. You should do this on a regular basis, or after every backup.
crosscheck archivelog all;
DELETE NOPROMPT EXPIRED BACKUP;
DELETE NOPROMPT EXPIRED COPY;
You can query V$FLASH_RECOVERY_AREA_USAGE to view the flash recovery area disk space usage.
Backing Up the Flash Recovery Area
• RMAN> BACKUP RECOVERY AREA;
This command backs up all flash recovery files created in the current flash recovery area destinations that have not previously been backed up. Files that fall into this category are full and incremental backup sets, control file autobackups, archive logs, and data file copies. Other files such as flashback logs, incremental bitmaps, current control file, and online redo log files are not backed up.
• RMAN> BACKUP RECOVERY FILES;
This command backs up all recovery files on disk that have not previously been backed up. The files that fall into this category are full and incremental backup sets, control file autobackups, archive logs, and data file copies.
Benefits of Using a Flash Recovery Area
• Simplifies the location of database backups
• Automatically manages the disk space allocated for recovery files
• Does not require changes to existing scripts
• Puts database backups, archive logs, and control file backups in the flash recovery area
Setting Parameters That Affect RMAN
• Database initialization parameters
– CONTROL_FILE_RECORD_KEEP_TIME
– DB_RECOVERY_FILE_DEST and DB_RECOVERY_FILE_DEST_SIZE, if using the flash recovery area
• Environment variables
– NLS_DATE_FORMAT
– NLS_LANG
RMAN Usage Considerations
• Resources: Shared memory, more processes
• Privileges given to users:
– Database: SYSDBA
– Operating system: Access to devices
• Remote operations:
– Set up the password file
– Ensure that the password file is backed up
Connection Types with RMAN
You can use Recovery Manager to connect to the following types of databases:
• Target database: RMAN connects you to the target database with the SYSDBA privilege. You must have this privilege for the connection to succeed. The target database is the instance where you want to perform typical RMAN operations.
• Recovery catalog database: This is an optional database that is configured for the RMAN repository. You connect to the recovery catalog database when you want to retrieve information stored within it, such as backup information or stored scripts.
• Auxiliary database: An auxiliary database can be a database that is:
- Created using the RMAN DUPLICATE command
- A temporary database that is used during tablespace point-in-time recovery (TSPITR)
- A standby database, or a copy of your production database that can be used for disaster recovery
Starting RMAN
Local Connection
For a local RMAN connection, at an operating system prompt, enter the following:
UNIX: $ ORACLE_SID=DB01; export ORACLE_SID
$ rman target /
Windows: C:\> SET ORACLE_SID=DB01
C:\> rman target /
Remote Connection
To connect from another server, use the Oracle Net service name for the target database:
$ rman target sys/target_pwd@DB01
Configuring Persistent Settings for RMAN
• RMAN is preset with default configuration settings
• Use the CONFIGURE command to:
– Configure automatic channels
– Specify the backup retention policy
– Specify the number of backup copies to be created
– Set the default backup type to BACKUPSET or COPY
– Limit the size of backup sets
– Exempt a tablespace from backup
– Enable and disable backup optimization
– Configure automatic backups of control files
Control File Autobackups
RMAN> CONFIGURE CONTROLFILE AUTOBACKUP ON;
Retention Policies
• A retention policy describes which backups will be kept and for how long.
• There are two types of retention policies:
– Recovery window: Establishes a period of time within which point-in-time recovery must be possible
– Redundancy: Establishes a fixed number of backups that must be kept
• These policies are mutually exclusive and can be
set with the CONFIGURE command.
Managing Persistent Settings
• Use the SHOW command to list current settings:
RMAN> SHOW CONTROLFILE AUTOBACKUP FORMAT;
RMAN> SHOW EXCLUDE;
RMAN> SHOW ALL;
• Use the CLEAR command to reset any persistent setting to its default value:
RMAN> CONFIGURE BACKUP OPTIMIZATION CLEAR;
RMAN> CONFIGURE MAXSETSIZE CLEAR;
RMAN> CONFIGURE DEFAULT DEVICE TYPE CLEAR;
Channel Allocation
A channel represents one stream of data to a device type. A channel must be allocated before you execute backup and recovery commands.
You can query the V$BACKUP_DEVICE view to determine supported device types.
Automatic and Manual Channel Allocation
• An automatic channel is one that is preconfigured and used for subsequent commands. To change the
default device type for automatic channel allocation, use:
RMAN> CONFIGURE DEFAULT DEVICE TYPE TO sbt;
• A manually allocated channel is one that overrides the automatic channel setting. This channel overrides the automatic channel for this run block:
RMAN> RUN {
2> ALLOCATE CHANNEL c1 DEVICE TYPE disk;
3> BACKUP DATAFILE '/u01/oradata/user01.dbf';
4> }
Channel Control Options
You can specify control options for the allocated channel to change its default behavior. The configurable control options for manually and automatically allocated channels are:
• CONNECT: The connect string for the target instance
• FORMAT: The format to use for backup piece names created on this channel
• MAXOPENFILES: The maximum number of input files that a BACKUP command can have open at any given time (the default is 8)
• MAXPIECESIZE: The maximum size of each backup piece created on this channel, specified in bytes (default), kilobytes (K), megabytes (M), or gigabytes (G)
• DURATION: The amount of time to run the backup job, defined in hours and minutes.
The duration can be further specified as:
- PARTIAL: No error is signaled if the backup is not complete at the end of the
specified duration.
- MINIMIZE TIME: The backup runs at full speed, possibly completing within the
allotted time.
- MINIMIZE LOAD: RMAN monitors the backup speed and automatically reduces the processing speed if it detects that the backup will complete in less than the allotted time. This option is not allowed when writing to tape because it is desirable to drive the tapes as fast as possible.
If the channel device type is SBT or SBT_TAPE, you can also specify:
• PARMS="ENV(…)": Set environment variables for the server session corresponding to this RMAN client.
• PARMS="SBT_LIBRARY=…": Specify the location of the MML to be used by the channel.
For automatic channels, you can also configure the default parallelism level and the default backup type for disk or tape backups to BACKUPSET, COMPRESSED BACKUPSET, or COPY.
-- EOF --
This work is licensed under a CC A-S 4.0 International License.