RMAN is a oracle utility to backup, restore & recovery of database.
The following Steps will be demonstrated the configuration of oracle RMAN backup (for first time configuration)
Lets assume the database is in NOARCHIVELOG mode, by default the database is in NOARCHIVELOG mode, we need to change it to ARCHIVELOG mode for RMAN backup configuration.
We can configure RMAN backup with catalog/repository database as well as control file. It is strongly recommended & very good practice to configure RMAN backup with catalog/repository database.
catalog/repository database: It’s central repository & it requires separate database for backup operation. All registered target databases information stored in catalog database.
Control file: It contains registered target database information at server level itself & RMAN utility directly connects to target database by command “RMAN target /”
Note: Create catalog/repository database with the help of DBCA.
Lets consider following Step by Step syntax to do so:
Step # 1: Connect to Target database(Target DB: The database on which Backup & Recovery to be performed) as sysdba.
[oracle@centos ~]$ sqlplus "/ as sysdba" SQL*Plus: Release 220.127.116.11.0 Production on Fri Jan 3 11:28:24 2014 Copyright (c) 1982, 2009, Oracle. All rights reserved. Connected to: Oracle Database 11g Enterprise Edition Release 18.104.22.168.0 - 64bit Production With the Partitioning, OLAP, Data Mining and Real Application Testing options SQL>
Step # 2: Ensure the database has been configured with ARCHIVELOG mode or not?
SQL> select log_mode from v$database; LOG_MODE ------------ NOARCHIVELOG Database is in NOARCHIVELOG mode.
Step # 3: If the database has been configured with ARCHIVELOG mode then skip the Step number 3 to 6, If not then Shutdown the database.
SQL> shutdown immediate; Database closed. Database dismounted. ORACLE instance shut down.
Step # 4: Startup the database in mount state.
SQL> startup mount; ORACLE instance started. Total System Global Area 308981760 bytes Fixed Size 2212896 bytes Variable Size 163580896 bytes Database Buffers 138412032 bytes Redo Buffers 4775936 bytes Database mounted.
Step # 5: Configure database in ARCHIVELOG mode.
SQL> alter database archivelog; Database altered.
Step # 6: Alter database to open state.
SQL> alter database open; Database altered.
SQL> select open_mode from v$database; OPEN_MODE -------------------- READ WRITE
Step # 7: Ensure ARCHIVELOG destination.
SQL> archive log list Database log mode Archive Mode Automatic archival Enabled Archive destination USE_DB_RECOVERY_FILE_DEST Oldest online log sequence 2 Next log sequence to archive 4 Current log sequence 4
In case you wish to change default archive log destination then issue the following command.
SQL> alter system set log_archive_dest_1='location=/home/oracle/arch' scope=both; System altered.
SQL> archive log list Database log mode Archive Mode Automatic archival Enabled Archive destination /home/oracle/arch Oldest online log sequence 2 Next log sequence to archive 4 Current log sequence 4
Step # 8: Ensure the flash/fast recovery area location.
SQL> show parameter db_recovery_file_dest
Step # 9: Connect to RMAN prompt with target database.
[oracle@centos ~]$ rman target / Recovery Manager: Release 22.214.171.124.0 - Production on Fri Jan 3 11:46:22 2014 Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved. connected to target database: ORCL (DBID=1363580714) RMAN>
Step # 10: Configure RMAN with controlfile auto-backup feature that will be auto-backup controlfile in case of major changes done in database.
RMAN> configure controlfile autobackup on;
Step # 11: To enable backup optimization run the following command, by default backup optimization has been configured OFF.
RMAN> configure backup optimization on;
Step # 12: Configure retention policy for backup.
RMAN> CONFIGURE RETENTION POLICY TO RECOVERY WINDOW OF 7 DAYS;
Step # 13: Connect to the recovery catalog database(RMAN Repository) & Create a tablespace to store RMAN catalog database objects.
[oracle@centos ~]$ sqlplus "/ as sysdba" SQL> select global_name from global_name; GLOBAL_NAME -------------------------------------------------------------------------------- CATALOGD
SQL> create tablespace catalogtbs datafile '/home/oracle/dbfile/catalogtbs1.dbf' size 100M autoextend on maxsize unlimited; Tablespace created.
Step # 14: Create a RMAN user, assign RMAN tablespace to RMAN user as a default & grant recovery catalog owner,connect & resource privileges to RMAN user.
SQL> create user recoveryman identified by recoveryman; User created.
SQL> alter user recoveryman default tablespace catalogtbs temporary tablespace temp; User altered.
SQL> grant recovery_catalog_owner to recoveryman; Grant succeeded.
SQL> grant connect,resource to recoveryman; Grant succeeded.
Step # 15: Connect to RMAN on target and recovery catalog database.
[oracle@oracle ~]$ rman target / catalog recoveryman/recoveryman@catalogdb Recovery Manager: Release 126.96.36.199.0 - Production on Sat Jan 4 14:30:28 2014 Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved. connected to target database: ORCL (DBID=1363580714) connected to recovery catalog database
Step # 16: create catalog by issuing the following command in RMAN prompt.
RMAN> create catalog; recovery catalog created
Step # 17: After creating catalog, Ensure RMAN repository tables by logging into repository database as RMAN user. This is only for the first time.
[oracle@oracle ~]$ sqlplus "recoveryman/recoveryman@catalogdb" SQL> show user; USER is "RECOVERYMAN"
SQL> select table_name from user_tables;
Step # 18: Register database with recovery catalog.
RMAN> register database; database registered in recovery catalog starting full resync of recovery catalog full resync complete
Step # 19: Check whether registration was successful.
RMAN> report schema; Report of database schema for database with db_unique_name ORCL List of Permanent Datafiles =========================== File Size(MB) Tablespace RB segs Datafile Name ---- -------- -------------------- ------- ------------------------ 1 670 SYSTEM YES /home/oracle/app/oracle/oradata/orcl/system01.dbf 2 490 SYSAUX NO /home/oracle/app/oracle/oradata/orcl/sysaux01.dbf 3 30 UNDOTBS1 YES /home/oracle/app/oracle/oradata/orcl/undotbs01.dbf 4 5 USERS NO /home/oracle/app/oracle/oradata/orcl/users01.dbf List of Temporary Files ======================= File Size(MB) Tablespace Maxsize(MB) Tempfile Name ---- -------- ----------- --------- ------------------------------- 1 20 TEMP 32767 /home/oracle/app/oracle/oradata/orcl/temp01.dbf
RMAN> LIST INCARNATION OF DATABASE; List of Database Incarnations DB Key Inc Key DB Name DB ID STATUS Reset SCN Reset Time ------- ------- -------- ---------------- ------------ --- -------- 89 102 ORCL 1363580714 PARENT 1 15-AUG-09 89 90 ORCL 1363580714 CURRENT 945184 02-JAN-14
Target database is registered with the RMAN.
Now you can backup your target(registered) database as per your convenience.
Note: Please don’t hesitate to revert in case of any query OR feedback.
Have a easy life ahead. 🙂
28 thoughts on “How to configure Oracle RMAN backup for the first time”
Thank u very much for this very good presentation
Thank you sinu for writing!
Does a Catalog database need to be created using DBCA?
OR you can use control file instead of catalog database to maintain RMAN backup repository. In this case you can skip step 13 to 19 and directly connect to RMAN with following:
[oracle@centos ~]$ rman target /
Great Tutorial for beginners!
sir can you send the document of RMAN Configuration in windows
Thank you Sharma for writing!
There is no major difference in RMAN configuration for windows and linux.
Just take care about Step no 7, 13 for directory path structure.
Stay Tune. 🙂
Now you can backup your target(registered) database as per your convenience–means what?…do we need to do any further step for configuring backup?
This post is about “How to configure Oracle RMAN backup TOOL with target database”, after configuration of it, you can backup your database with following RMAN commands. You can also schedule it with crontab/windows scheduler.
Full database backup:
RMAN> BACKUP DATABASE;
Archive logs backup:
RMAN> BACKUP ARCHIVELOG ALL;
Database Plus Archivelog backup:
RMAN> BACKUP DATABASE PLUS ARCHIVELOG;
Hope these will help you. Stay Tune.
please send me steps of restore database by using rman
THANK YOU VERY, VERY MUCH … IT IS VERY SIMPLE.
Thank you Chantha for your kind words.
Stay Tune. 🙂
I’m got an error in Step # 15: Connect to RMAN on target and recovery catalog database. Btw, i’m using Windows
Thanks Hasbullah for writing!
Please share error logs.
Very helpful. I did this in class but now i have to do it on a live environment. Great info. Thank you much
Thank you Stephen for writing!
You can use this for the test as well as production(live) environment.
Stay Tune 🙂
Thank you very much, really Its very nice explanation, Jignesh, I am new in Oracle DBA, learning stage, Please send me Interview question & answer.
Thank you Mir Sadah Ali for writing, you can refer my blogs to improve your DBA skills.
I am sorry for the interview questions help, I can’t.
Thank you very much. This was really helpful.
Thanks Bernard for writing!
Thank you sir for this easy and helpfull steps.kindly share how to restore using rnman.
thanks and regards
Hi Sir, Did you write the recovery steps too. I need that.
I will say just awesome sir.
Thanks, still helpful in 2020 😉
I happened to stumble upon this, and finally someone who writes it without all that extra jargon for people to understand and do. My question is, we are using Oracle 12c, will there be much of a difference between 11g and 12c, in regards to the commands?
STEP NUMBER 13 , I am getting TNS protocol error
I am getting at step number 13
C:\app\saikrishna\product\11.2.0\dbhome_1\BIN>sqlplus “/ as sysdba”
SQL*Plus: Release 188.8.131.52.0 Production on Thu Nov 26 18:22:11 2020
Copyright (c) 1982, 2010, Oracle. All rights reserved.
ORA-12560: TNS:protocol adapter error
Hi Thanks for your documents. I want to ask u that I have to implement a RMAN Disk backup in a linux container. So what would i do.