This tip is an excerpt from the author's "Backup and Recovery using RMAN" course at SkillBuilders.
By submitting your email address, you agree to receive emails regarding relevant topic offers from TechTarget and its partners. You can withdraw your consent at any time. Contact TechTarget at 275 Grove Street, Newton, MA.
Recovery Manager is a great tool for backup, restore and recovery operations. Here is a practical setup procedure to get you started.
Setting up the RMAN environment involves several steps. Assuming you'd like to take advantage of the benefits provided by a recovery catalog (recommended), you must install the RMAN catalog. For anything but easily-recreated test environments, this would be done on a separate machine from the target database. Here is a summary of the steps:
Install recovery catalog on separate database
- Set up a DB to hold recovery catalog
- Create a tablespace to hold recovery catalog
- Create user RMAN
- Grant privileges to RMAN
Register the target database
- Connect to RMAN
- Create recovery catalog
- "Register" the target DB(s) in the new catalog
Execute this code from SQL*Plus, logged in as SYSTEM, and connected to your CATALOG database (i.e., the database you want to build your recovery catalog on). It will need to be adjusted to reflect the correct OS file paths and the service name of your recovery and target databases:
-- Setup RMAN with a recovery database.
-- Create a tablespace to hold the recovery catalog.
create tablespace rmancatalog datafile 'c:\oracle\oradata\prod\rman\catalog.dbf' size 50m;-- Create the RMAN user.
create user rman identified by rman temporary tablespace temp default tablespace rmancatalog quota unlimited on rmancatalog;-- Grant privilege to maintain and query the recovery catalog to the RMAN user
grant recovery_catalog_owner, connect, resource to rman;-- Start RMAN utility from OS command line and create the recovery catalog.
-- Log any errors.
$rman catalog rman/rman@prod log=c:\rman\rman_create_catalog.log cmdfile=c:\rman\createcatalog.rman-- Connect to RMAN and register the database to be backed up (i.e., the target DB):
$rman target=sys/change_on_install@prod catalog=rman/rman@prod log=c:\rman\rman_register_db.log cmdfile=c:\rman\registerdb.rman RMAN Script: createcatalog.rman create catalog; exit; RMAN Script: registerdb.rman register database; exit;
For More Information
- Feedback: E-mail the editor with your thoughts about this tip.
- More tips: Hundreds of free Oracle tips and scripts.
- Tip contest: Have an Oracle tip to offer your fellow DBAs and developers? The best tips submitted will receive a cool prize -- submit your tip today!
- Ask the Experts: Our SQL, database design, Oracle, SQL Server, DB2, metadata, and data warehousing gurus are waiting to answer your toughest questions.
- Forums: Ask your technical Oracle questions--or help out your peers by answering them--in our active forums.
- Best Web Links: Oracle tips, tutorials, and scripts from around the Web.