Tips_23 Getting Started with Oracle Recovery Manager (RMAN)
■RMAN
・can back up are whole databases, or individual tablespaces and datafiles;
The controlfile and the spfile can also be included, as can the archive logs
・The only part of the database that is not backed up is the online redo log files
■
・image copies
・backup sets
■
・incremental backups
*the granularity of an RMAN restore and recover can be just one corrupted datafile block.
・the whole backup
■■Recovery Manager Components
1.The RMAN Executable:
RMAN is implemented with the package DBMS_BACKUP_RESTORE
・This package is kernelized, meaning that it is part of the instance itself.
This is a very significant feature: you do not need to have an open database in order to use RMAN.
・Normal PL/SQL stored procedures are stored within the data dictionary, so if the database isn’t open, you can’t get to them.
*This means that even if the database is so severely damaged that you cannot even mount it—because you have lost all your controlfiles—the RMAN executable will still have access to the procedures it needs to carry out a restore operation.
2.The Target Databases
・The RMAN executable can connect to only one target at a time;
・The controlfile of the target stores information that RMAN needs. RMAN reads the controlfile to determine the physical structure of the database: the location of the datafiles to be backed up. Also stored in the controlfile are details of archived logs, which RMAN must also back up.
・If the target database is completely destroyed, including all copies of the controlfile, it will still be possible for RMAN to restore it, provided that RMAN has been configured appropriately.
3.Server Processes and Channels
・A channel is a server process that does the work of copying files.
At least one channel must be allocated before a backup or restore command can be executed.
By launching multiple channels, backup and restore operations can be parallelized.
Channels can be launched manually using the ALLOCATE CHANNEL command,or RMAN can launch channels automatically according to preconfigured defaults.
・Channels are of Two types:
①disk channels that are capable of backing up to (or restoring from) disk destinations.
②System Backup to Tape (known as SBT) channels that are capable of working with tape devices, such as an automated tape library.
・polling process
This is launched automatically whenever a backup or restore operation is running.
The polling process monitors and reports on the progress of the operation.
4.The RMAN Repository
The repository is a store of metadata about the target database and its backups.
It contains details of the physical structure of the database: the locations of the datafiles;
details of all the backups that have been made; and RMAN’s persistent configuration settings.
5.The Recovery Catalog
RMAN’s repository is always written to the target database’s controlfile, but it can also be written out to a separate Oracle database.This database is known as the Recovery Catalog.
①, and perhaps most important, with a Recovery Catalog you are no longer dependent upon the target database controlfile.
②, the Recovery Catalog can store RMAN scripts.
③, if you are supporting many databases, one Recovery Catalog can be used to store metadata about all of them.
④, there is no limit to the length of time for which a Recovery Catalog can retain this metadata.The controlfile-based repository will retain data for only the time specified by the instance parameter CONTROL_FILE_RECORD_KEEP_TIME.
6.Media Management Library
The full power of RMAN can be exploited only if you associate it with an automated tape robot, which can manage your library of tape cartridges. Given such a library, RMAN can automate completely the backup and restore cycle.
7.The Auxiliary Database
An auxiliary database is a new database created by RMAN, from a backup of the target database.
・An auxiliary database could be created in order to copy the target, for example,to create a test or development database identical to the production system. Such a database would be a complete restore.
・It is also possible to create an auxiliary that is a subset of the target
・Finally, an auxiliary database can be created to be used as a standby database.
8.The Flash Recovery Area
The flash recovery area is a disk destination that is used by Oracle as a storage location for all recovery- and fault tolerance–related files.
・RMAN will use it as a default location for backups. Remember that the flash recovery area is not intended for RMAN’s exclusive use; it is also, typically, used for multiplexed online logfiles, for a controlfile copy, and as an archive log destination.
・The advantage of directing RMAN backups to the flash recovery area is that Oracle can manage space in the recovery area very effectively
■■Configuring RMAN
Eg:
$ rman
RMAN> connect target
RMAN> backup database;
RMAN> exit
1.Environment Variables and Instance Parameters
①nls_date_format
・The date is from the operating system “11-NOV-04”
$ export nls_date_format=dd-mm-yy hh24:mi:ss
②NLS_LANG
・RMAN will read the controlfile to find out what the character set is.But if the database is only in nomount mode, then RMAN will assume the default of US7ASCII。
$ export NLS_LANG=american_america.we8iso8859p15
on Unix, or
C:> set NLS_LANG=american_america.we8iso8859p15
on Windows.
③CONTROL_FILE_RECORD_KEEP_TIME The default of seven days
will limit the number of days that the target database’s controlfile will “remember” information about archive logs generated and RMAN backups made.
④DB_RECOVERY_FILE_DEST
⑤DB_RECOVERY_FILE_DEST_SIZE
control the location and maximum size of the flash recovery area.
The flash recovery area must be monitored to make sure that it does not fill up
2.Connecting to Databases
$ rman target sys/oracle@ocp10g catalog rman/rman@catdb
$ rman target / nocatalog
$ rman target / log /logs/rman.log append cmdfile=/scripts/rman_script.rcv
3.Configuring Persistent Settings
Each target has its own set of persistent settings: they are stored in the target database repository: in the target’s controlfile and (optionally) in the Recovery Catalog.
・To see the current default settings for a target, use the SHOW command:
RMAN> SHOW ALL
・To change a default, use the CONFIGURE command:
RMAN> CONFIGURE DEFAULT DEVICE TYPE TO sbt_tape;
RMAN> configure retention policy to recovery window of 30 days;
4.Channel Allocation
The channel control options are as follows:
• CONNECT
• DURATION
• FORMAT
• MAXOPENFILES
• MAXPIECESIZE
• PARMS
■■Overriding Configured Defaults
You can use the default configuration to back up with command :BACKUP DATABASE
Or
Set your own rules like below:
RMAN> run{
allocate channel d1 type disk format '/u06/backups/example1.bkp';
allocate channel d2 type disk format '/u06/backups/example2.bkp';
backup as compressed backupset
tablespace example include current controlfile;}