Call now: 252-767-6166  
Oracle Training Oracle Support Development Oracle Apps

 
 Home
 E-mail Us
 Oracle Articles
New Oracle Articles


 Oracle Training
 Oracle Tips

 Oracle Forum
 Class Catalog


 Remote DBA
 Oracle Tuning
 Emergency 911
 RAC Support
 Apps Support
 Analysis
 Design
 Implementation
 Oracle Support


 SQL Tuning
 Security

 Oracle UNIX
 Oracle Linux
 Monitoring
 Remote s
upport
 Remote plans
 Remote
services
 Application Server

 Applications
 Oracle Forms
 Oracle Portal
 App Upgrades
 SQL Server
 Oracle Concepts
 Software Support

 Remote S
upport  
 Development  

 Implementation


 Consulting Staff
 Consulting Prices
 Help Wanted!

 


 Oracle Posters
 Oracle Books

 Oracle Scripts
 Ion
 Excel-DB  

Don Burleson Blog 


 

 

 


 

 

 

 

 

RMAN Recovery Catalog Tips

Oracle Tips by Burleson Consulting

RMAN uses a recovery catalog; however, you can use RMAN without a catalog from just the data stored in the control files, but you are restricted to a subset of RMANs capabilities in this mode. The recovery catalog contains information on the following:

* Data file and archive log backup sets and pieces

* Data file copies

* Archived redo logs and copies of them

* Tablespaces and data files at the target database

* Named, user-created sequences of commands called stored scripts

* incarnation data

* backup history metadata

* redo log switch history

It is a good practice to maintain a small database strictly for the recovery catalog and perhaps the Enterprise Manager catalog files. The recovery catalog should be resynchronized with all remote databases on a periodic basis. If you don?t use a catalog you cannot do the following:

* Point-in-time recover

* Use stored scripts

* Recovery if a control file is not available.

RMAN creates backup sets that consist of backup pieces. Backup pieces are parts of the backup set at a size that is predetermined and usually based on backup media capacity of operating system file size limitations. Backup sets can be written to disk or secondary storage, can include a backup control file, and can span multiple OS files (pieces). Backup devices that are supported on your system are cataloged in the v$backup_device dynamic performance table.

The recovery catalog contains RMAN metadata.  The recovery catalog is updated after you take a backup, when there is a log switch, and when you change a tablespace or datafile. 

RMAN backup sets that contain archive logs are called, appropriately enough, archivelog backup sets. With Oracle8 you cannot write archive logs directly to tape, but a job can be scheduled using RMAN to back archive log backup sets to tape or other storage.

RMAN produces either full or incremental backups. A full backup  is a backup of one or more data files that contains all blocks of the data file(s) that have been modified or changed. Full backups can be created out of:

* Data files

* Data file copies

* Tablespaces (all data files for a tablespace)

* Archive logs

* Control files (current or backups)

* Entire databases

An incremental backup is a backup of one or more files and contains only blocks that have been modified. However, only complete control files are backed up in either incremental or full backups. Incremental backups can be made of:

* Data files

* Tablespaces

* Databases

The incremental backup allows leveling of backups. Each level is denoted by an integer value, with the level of backup meaning that any blocks changed since the last incremental backup at this level will be backed up the next time this level is specified. This allows levels to be set based on time frames; for example, 0 being a monthly full, 1 being a once-a-week incremental, and 2 being a daily incremental. Of course, this also leads to complicated rotation of tapes or backup media, taking us back to the good old towers-of-Hanoi backup scenario nightmares.

RMAN also allows for image copies of data files, archive logs, or control files. Image copies can only be made to disk and cannot contain multiple files.

RMAN allows report generation. Reports can be generated based on:

* What files need backup.

* What files haven?t been backed up recently.

* What backup files can be deleted.

Each backup set can be associated with a tag that can be used to identify it in subsequent operations. The tag doesn?t have to be unique. RMAN selects the most recent backup set in the case of backup sets with duplicate tags.

RMAN works against running or shutdown databases whether they are in archive log mode or not. However, if the database is not in archive log mode the entire database can only be backed up if it was shut down cleanly. Tablespaces can only be backed up in NOARCHIVELOG mode if they are off-line normal. There are no restrictions of this type on databases in ARCHIVELOG mode.

RMAN automatically detects corruptions and logs these in v$backup_corruption and v$copy_corruption dynamic performance tables. Corrupt blocks are still backed up.

Installing the RMAN Recovery Catalog

The recovery catalog should be owned by a user with the resource role grant. I suggest a user in a small database dedicated to system administration functions such as the RMAN catalog and Enterprise Manager catalog. Create a tablespace for use by the RMAN user and assign that as the user?s default tablespace with unlimited quota. For example, if we wanted our user to be named rman_dba, the steps would be as follows:

sqlplus system/manager
SQL>CREATE TABLESPACE rman_data DATAFILE 'file_spec' DEFAULT STORAGE (clause);
SQL>CREATE USER rman_dba IDENTIFIED BY rman_dba
 2: DEFAULT TABLESPACE rman_data
 3: TEMPORARY TABLESPACE  temp
 4: QUOTA UNLIMITED ON rman_data;
SQL>GRANT RESOURCE,CONNECT TO rman_dba;
SQL>CONNECT rman_dba/rman_dba
SQL> @$ORACLE_HOME/rdbms/admin/catrman.sql

Once the catalog is built, the recovery manager can be utilized. The command is either rman, rman80, or RMAN80 depending on your operating system. There are literally dozens of commands for use with the RMAN facility. I suggest reviewing the Oracle8i Server Backup and Recovery Guide, Release 8.1.5 (or most current release) (Oracle Corporation, 1999) before using RMAN.

The following are some example scenarios showing how the commands can be made into scripts.

Connection to rman in UNIX on early versions can be tricky. On some UNICES the double quote (?) character has to be escaped, and you need to use the double quotes to log into rman (at least on early versions). Assuming the database to be backed up is ORTEST1 with a TNS alias of ORTEST1, the user is as specified earlier, and the catalog database is ORRMAN, the connection to RMAN for the user SYSTEM password MANAGER would look like this:

$ rman ORTEST1\ system/manager@ORTEST1 rcvcat "rman_dbo/rman_dbo@ORRMAN\"

Intuitive, isn?t it? A sample session from Recovery Manager (RMAN) is shown next.

The target database service name in the ?tnsnames.ora? file is ?ORTEST1.? The recovery catalog database service name in the ?tnsnames.ora? file is ?ORRMAN.?

% cd $ORACLE_HOME/rdbms/admin
% sqlplus sys/change_on_install@ORRMAN
SQL> grant connect, resource to RMAN_DBA identified by RMAN_DBA;
Grant succeeded.
SQL> connect rman/rman@ORRMAN
Connected.
SQL> @catrman.sql
SQL> exit
%
% rman 'target sys/change_on_install@ORTEST1 rcvcat rman/rman@ORRMAN'
Recovery Manager: Release 8.0.2.0.0 - Beta
RMAN-06005: connected to target database: ORTEST1
RMAN-06008: connected to recovery catalog database
RMAN> register database;                          
RMAN-08006: database registered in recovery catalog
RMAN-08002: starting full resync of recovery catalog
RMAN-08004: full resync complete
RMAN> run    
2> {        
3> allocate channel c1 type disk;
 
4> backup full format '/oracle16/ORTEST1/amin/backup/backup%s%p' (database);
5> }
 
RMAN-08030: allocated channel: c1
 
RMAN-08500: channel c1: sid=12 devtype=DISK

RMAN-08008: channel c1: started datafile backupset

RMAN-08502: set_count=9 set_stamp=280246639 

RMAN-08011: channel c1: including current controlfile in backupset
RMAN-08010: channel c1: including datafile number 1 in backupset
RMAN-08010: channel c1: including datafile number 2 in backupset
     .
     .
     .
RMAN-08010: channel c1: including datafile number 11 in backupset
RMAN-08010: channel c1: including datafile number 12 in backupset
 
RMAN-08013: channel c1: piece 1 created
 
RMAN-08503: piece handle=/oracle16/ORTEST1/admin/backup/backup91 comment=NONE
RMAN-08003: starting partial resync of recovery catalog
RMAN-08005: partial resync complete
RMAN-10030: RPC call appears to have failed to start on channel default
RMAN-10036: RPC call ok on channel default
RMAN-08031: released channel: c1
RMAN> exit

Incomplete restore scenario

The following shows the scenario for an incomplete recovery. The following scenario assumes that:

* You wish to do an incomplete recovery due to an application error that was made at a specific time.

* There are three tape drives.

* You are using a recovery catalog.

TIP:  It is highly advisable to back up the database immediately after opening the database resetlogs.

The following script restores and recovers the database to the time immediately before the user error occurred. The script does the following:

* Starts the database mount and restricts connections to DBA-only users.

* Restores the database files (to the original locations).

* Recovers the data files by either using a combination of incremental backups and redo or just redo. Recovery Manager will complete the recovery when it reaches the transaction from the time specified.

* Opens the database resetlogs.

Oracle recommends that you backup your database after the resetlogs (this is not shown in the example).

Ensure that you set your NLS_LANG and NLS_DATE_FORMAT environment variables. You can set these to whatever you wish?the date format of the following example is the standard date format used for recovery, e.g., for UNIX (csh):

> setenv NLS_LANG AMERICAN
> setenv NLS_DATE_FORMAT 'YYYY-MM-DD:hh24:mi:ss'


Next, start up Server Manager:

SVRMGR> connect internal
Connected.
SVRMGR> startup mount restrict
SVRMGR>exit
 
#  rman target internal/knl@prod1 rcvcat rman/rman@rcat cmdfile case2.rcv
run {
#  The 'set until time' command is for all commands executed 
#  between the { and } braces. Means both restore and recover
#  will both be relative to that point in time.
#  Note that Recovery Manager uses the Recovery Catalog to,
#  determine the structure of the database at that time, and
#  restore it.
#
    set until time '1997-06-23:15:45:00';
#
    allocate channel t1 type 'SBT_TAPE';
    allocate channel t2 type 'SBT_TAPE';
    allocate channel t3 type 'SBT_TAPE';
#
    restore
      (database);
#
#  There is no need to manually catalog logs before recovery,
#  as Recovery Manager does catalog resync from the current
#  control file.
#
    recover
      database;
#
    sql 'alter database open resetlogs';
 

The preceding scenarios are just examples of how to use the recovery manager. Please consult your manual before attempting to use the facility for production work. The RMAN readme file contains valuable insights into RMAN use and has several additional scenarios.

 
 
 
Get the Complete
Oracle Backup & Recovery Details 

The landmark book "Oracle Backup & Recovery: Expert secrets for using RMAN and Data Pump " provides real world advice for resolving the most difficult Oracle performance and recovery issues. Buy it for 40% off directly from the publisher.
 

 

 


 

 
��  
 
 
Oracle Training at Sea
 
 
 
 
oracle dba poster
 

 
Follow us on Twitter 
 
Oracle performance tuning software 
 
Oracle Linux poster
 
 
 

 

Burleson is the American Team

Note: This Oracle documentation was created as a support and Oracle training reference for use by our DBA performance tuning consulting professionals.  Feel free to ask questions on our Oracle forum.

Verify experience! Anyone considering using the services of an Oracle support expert should independently investigate their credentials and experience, and not rely on advertisements and self-proclaimed expertise. All legitimate Oracle experts publish their Oracle qualifications.

Errata?  Oracle technology is changing and we strive to update our BC Oracle support information.  If you find an error or have a suggestion for improving our content, we would appreciate your feedback.  Just  e-mail:  and include the URL for the page.


                    









Burleson Consulting

The Oracle of Database Support

Oracle Performance Tuning

Remote DBA Services


 

Copyright © 1996 -  2016

All rights reserved by Burleson

Oracle ® is the registered trademark of Oracle Corporation.