RECOVERY MANAGER Recover Manager is introduced in Oracle 8. Recovery Manager (RMAN) is an Oracle utility that can back up, restore, and recover database files. The product is a feature of the Oracle database server and does not require separate installation. RMAN uses database server sessions to perform backup and recovery. It stores metadata about its operations in the control file of the target database and, optionally, in a recovery catalog schema in an Oracle database. The RMAN environment consists of the utilities and databases that play a role in a backup and recovery strategy. A typical environment uses the following: RMAN
executable Of these components, only the RMAN executable and target database are required. RMAN automatically stores its metadata in the target database control file, so the recovery catalog is optional RMAN backup of the datafiels, archived redo log files, online redo log files, controlfiles is done in a proprietary format. And the backup contains only the used blocks.
RMAN executables Compatibility matrix:
Compatibility Errors: RMAN
compatibility: errors RMAN
Recovery Catalog Tables:
RMAN Recovery Catalog Views:
Important Concepts and Vocabulary To be understood: RMAN Channels An RMAN channel represents one stream of data to a device type and corresponds to one server session. It is the channel that reads and writes RMAN backup files. The I/O device could be a disk or a tape. It needs to define the number of processes simultaneously accessing an I/O device, maximum size of file/s created on the I/O devices, maximum rate at which database files are read and maximum number of files open at a time are some the input parameters for the channel server process to perform backup/r3ecovery jobs for RMAN. Allocation of one or more RMAN channels is necessary to execute most backup and recovery commands. The server session performs the backup, restore, and recovery operations. Only one RMAN session communicates with the allocated server sessions. You can either allocate channels manually within a RUN block, or pre-configure channels for use in all RMAN sessions using automatic channel allocation. RMAN comes pre-configured with a DISK channel that you can use for backups and copies to disk. You can also run the CONFIGURE CHANNEL command RMAN to specify automatic channels to disk or tape. In this way, you do not have to allocate channels every time you perform a backup, restore, or recovery operation. When you run a command that requires a channel, and you do not allocate a channel manually, then RMAN automatically allocates the channels using the options specified in the CONFIGURE command. For the BACKUP command, RMAN allocates only a single type of channel, such as DISK or sbt_tape. For the RESTORE command and the various maintenance commands (for example, DELETE), RMAN determines which device types are required, and allocates all necessary channels. If you specify channels manually, then the ALLOCATE CHANNEL command (executed only within a RUN command) and ALLOCATE CHANNEL FOR MAINTENANCE command (executed only at the RMAN prompt) specify the type of I/O device that the server session will use to perform the backup, restore, or maintenance operation. Whether the ALLOCATE CHANNEL command or CONFIGURE CHANNEL causes the media manager to allocate resources is vendor-specific. Some media managers allocate resources when you issue the command; others do not allocate resources until you open a file for reading or writing. Proxy Copies A proxy copy is a special type of backup in which RMAN turns over control of the data transfer to a media manager that supports this feature. The PROXY option of the BACKUP command specifies that a backup should be a proxy copy. For each file that you attempt to back up using the BACKUP PROXY command, RMAN queries the media manager to determine whether it can perform a proxy copy. If the media manager cannot proxy copy the file, then RMAN uses conventional backup sets to perform the backup. An exception occurs when you use the PROXY ONLY option, which causes Oracle to issue an error message when it cannot proxy copy. Oracle records each proxy-copied file in the control file. RMAN uses this data to resynchronize the recovery catalog. Use the V$PROXY_DATAFILE view to obtain the proxy copy information. Use the CHANGE PROXY command or DELETE PROXY command to change the status of or delete a proxy backup. The proxy functionality was introduced in Oracle8i Release 1 (8.1.5). If a proxy version of RMAN is used with a non-proxy target database, RMAN will not use proxy copy to create backup sets. If you make backups using proxy copy and then downgrade Oracle to a non-proxy version, RMAN will not use proxy copy backups when restoring and will issue a warning when the best available file is a proxy copy. Backup Set A backup set, which is a logical object, contains one or more physical backup pieces. By default, one backup set contains one backup piece. Backup pieces are operating system files that contain the backed up datafiles, control files, or archived redo logs. For example, you can back up ten datafiles into a single backup set containing a single backup piece (that is, a single output file). You cannot split a file across different backup sets or mix archived logs and datafiles into one backup set. RMAN can create backup sets that are written to disk or tertiary storage. If you specify DEVICE TYPE DISK, then you must back up to random access disks. You can make a backup on any device that can store an Oracle datafile: in other words, if the statement CREATE TABLESPACE tablespace_name DATAFILE 'filename' works, then 'filename' is also a valid backup path name. Using a media management system that is available and supported on your operating system, you can write backup sets to sequential output media such as magnetic tape. If you specify a device type such as sbt that is other than DISK, then you can back up to any media supported by the media management software. A backup set is a complete set of backup pieces that make up a full or incremental backup of the objects specified in the BACKUP command. Backup sets are in an RMAN-specific format. An image copy, which is a complete image of a single datafile, control file, or archived log, is not in an RMAN-specific format. You can back up datafiles, control files, archived redo logs, and the current server parameter file. You can also back up another backup set, as when you want to back up a disk backup to tape, or an image copy. For example, you can issue commands such as the following, each of which uses an automatic channel configuration: BACKUP
DATABASE;
You cannot make a backup of a transported tablespace until after it has been specified read/write. Backup Piece RMAN creates physical binary files while performing backup operations. These files are written to the chosen medium. They are in one word the datafiles, controlfiles, archived redo log files and spfile. Backup sets, backup pieces and datafiles Here are some important relational mechanism that works between the datafiles and backup pieces.
01. A datafile cannot span backup sets. Media Management Layer (MML) RMAN cannot handle the tapes on its own. It needs a MML to take care of that. If it is to the disks RMAN needs nobody’s help. This MML developed by various vendors like Legato, Veritas, and Tivoli etc, Using RMAN with nocatalog At the command prompt type the following list of commands appear: rman
help=yes
It also throws some additional error messages, which can be ignored At the command prompt type as seen here under Oracle Release 10.1.0.2.0 D:\oracle\ora10\BIN>rman
help=yes
Both
single and double quotes (' or ") are accepted for a quoted-string. D:\oracle\ora10\BIN>rman target system/system@kans10g nocatalog Recovery Manager: Release 10.1.0.2.0 - Production Copyright (c) 1995, 2004, Oracle. All rights reserved. connected
to target database: KANS10G (DBID=754098840) RMAN> If flash recovery destination is defined in the init.ora file for the database the snapshot for the controlfile is created there by default. D:\oracle\flash_recovery_area\KANS10G\CONTROLFILE Otherwise snapshot controlfile is created at the default destination unless otherwise it is set to another destination.
D:\oracle\Ora92\bin>rman target system/manager@sridevi nocatalog Recovery Manager: Release 9.2.0.6.0 - Production Copyright (c) 1995, 2002, Oracle Corporation. All rights reserved. connected
to target database: SRIDEVI (DBID=937156271) RMAN> You are at the rman command prompt “using target database controlfile instead of recovery catalog” tells you that you are connected to the target database to perform backup and recovery functions using nocatalog The snapshot of the controlfile is created at the %ORACLE_HOME%/database and is given a default name as under: sncf
stands for snapshot controlfile The
snapshot controlfile created when RMAN is invoked with nocatalog is sncfsridevi.ora
located at %ORCALE_HOME%\database\ that is the default location.
D:\oracle\Ora81\BIN>rman
help=yes
Connecting to target database with no catalog in Oracle 8.1.6.3.0 D:\oracle\Ora81\BIN>rman target system/manager@srinivas nocatalog Recovery
Manager: Release 8.1.6.3.0 - Production RMAN> sncf
stands for snapshot controlfile The
snapshot controlfile created when RMAN is invoked with nocatalog is sncfsrinivas.ora
located at %ORCALE_HOME%\database\ that is the default location. This
can be changed to a user-defined destination using Same is the case with Oracle release 8.0.x versions. They are nit illustrated, as those versions are not installed on this PC Here is what metalink says if you want to change the default destination for the snapshot controlfile (relevant from Oracle 8.0 to 8.1.x versions) Snapshot Controlfile When
RMAN needs to resynchronize from a read-consistent version of the control
file, it creates a temporary snapshot control file. For example, start RMAN and then enter: (Windows) set
snapshot controlfile name to 'd:\oracle\oradata\<sid_name>\snap.ctl';
For
example, enter: (UNIX) If one RMAN job is already backing up the control file while another needs to create a new snapshot control file, you may see the following message: RMAN-08512: waiting for snapshot controlfile enqueue Under normal circumstances, a job that must wait for the control file enqueue will wait for a brief interval and will then successfully retrieve the enqueue. Recovery Manager makes up to five attempts to get the enqueue and then fails the job. The conflict is usually caused when two jobs are both backing up the controlfile, and the job that starts backing up the control file first waits for service from the media manager. Recovering the database in case everything is lost using Oracle RMAN with NOCATALOG backups before Oracle 9i Version was not possible as controlfile only can recognize the RMAN backups and all those controlfiles are lost, even though you have a backup controlfile done by RAMAN with Nocatalog. If the lost controlfiles have a backup at another destination from where that can be restored to the database those files may be useful as they may contain RMAN backup information depending upon the time RMAN backup of the controlfiles and took place. The default controlfile keep time is 7 (seven) days. After seven days the controlfile entries are overwritten. So in the context we are not sure if we have a RMAN entries in the controlfile or not. For some reasons it as suggested to set the control_file_keep_time to 0(zero) because of a bug by oracle in some other context to avoid something else by Oracle Support. This was because controlfile refused to grow beyond 65536. This occurs when LGWR tries to write to "LOG_HISTORY" section (#9) of control file and LSN (log sequence number) is larger than 65535. It will crash the instance. "MAXLOGHISTORY" is one of the database settings specified in CREATE DATABASE statement. It is the number of redo log files about which the control file can keep information. This value determines how much space in the control file to allocate for the names of the archive redo logs files. The default value is operating system dependent. However, we have seen it default to 65535 on certain platforms. You need to set it to an appropriate value, which is sufficient for automatic media recovery of the database. You must recreate the control file when you want to change “MAXLOGHISTORY” value. When Oracle 8.0.4 databases crashed and controlfiles were to be used to restore the databases. The alert log file entries spoke volumes of this. Since that time we used to first run this script on Development Database before the database is upgraded. after it was conformed that this was fixed in 8.0.6 we gave up this PLSQL. declare
This
anonymous PLSQL was used to develop test case to reproduce the bug for
the TAR. A group that develops the case when TAR is opened supplied this. DBMS_BACKUP_RESTORE.RESTORECONTROLEFILETO
to restore the database in 8.1.6 as per my personal experience as also
the experience of Code McDaniel (Doc id 01.
Backup entire database This
part is scary. There are some differences on the size of the controlfile
I have and the way Code McDaniel has mentioned. I did not see growth of
the control as he saw. Mine was a test database in my name and the controlfile
was of 2896 KB before and after. To continue in part IV part 2 |