Recovery Manager or RMAN as it is more commonly known, is Oracle’s proprietary backup, restore and recovery solution for Oracle databases.
In Part 12, we’ll setup RMAN, run through some common backup/restore/recovery scenarios and have a little fun with some of the more interesting things RMAN can do.
Quick links to all the tasks:
- Task #1: Create an RMAN Catalog.
- Task #2: Execute RMAN Backups. (coming soon)
- Task #3: Execute RMAN Restores & Recoveries. (coming soon)
- Task #4: More Advanced Uses of RMAN. (coming soon)
- Task #5: RMAN Reporting. (coming soon)
In most cases, using an RMAN catalog is useful. It’s not strictly necessary since database backups will be recorded in the database control files anyway. Like with most things there are pros and cons. For example, if you have more than a few databases, recording backup activity in one place is more efficient and convenient. However, if your RMAN catalog database is down then your backups will fail. So you have the added overhead of protecting your RMAN catalog database. In most cases you should treat it like any other production database.
To create an RMAN catalog, just follow these 3 simple steps:
Task #1a: Create a Database for the RMAN Catalog.
Since our infrastructure is small there’s no real need to fire up a separate database to host an RMAN catalog. Instead, we’ll create another PDB within the CDB (PADMIN) which is already running the OEM Management Repository PDB (EMPDBREPOS).
Note, running more than one PDB within a CDB requires the multitenant license. Plus in a production environment, you would more likely choose to have completely separate databases for the OEM Management Repository and the RMAN catalog anyway. What we’re doing here is for demonstration/educational purposes only.
So let’s crack on and create another PDB:
[oracle@oraemcc ~]$ . oraenv ORACLE_SID = [oracle] ? PADMIN The Oracle base has been set to /u01/app/oracle [oracle@oraemcc ~]$ sqlplus / as sysdba SQL> show con_name CON_NAME -------- CDB$ROOT SQL> create pluggable database rmancat admin user rmancat_admin identified by rmancat_admin; Pluggable database created. SQL> select name,open_mode from v$pdbs; NAME OPEN_MODE ------------------------------ ---------- PDB$SEED READ ONLY EMPDBREPOS READ WRITE RMANCAT MOUNTED SQL> alter pluggable database rmancat open; Pluggable database altered. SQL> select name,open_mode from v$pdbs; NAME OPEN_MODE ------------------------------ ----------- PDB$SEED READ ONLY EMPDBREPOS READ WRITE RMANCAT READ WRITE
Next, we’ll quickly add the relevant TNS connect string to the tnsnames.ora file:
[oracle@oraemcc ~]$ vi $ORACLE_HOME/network/admin/tnsnames.ora RMANCAT = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = oraemcc.mynet.com)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = RMANCAT.mynet.com) ) )
Task #1b: Create the Recovery Catalog Owner (RCO).
[oracle@oraemcc ~]$ sqlplus system@rmancat SQL> create tablespace rmancat_data; Tablespace created. SQL> create user rco identified by rco default tablespace rmancat_data quota unlimited on rmancat_data; User created. SQL> grant create session, resource, recovery_catalog_owner to rco; Grant succeeded.
Task #1c: Create the Recovery Catalog.
For this step, we actually log into RMAN:
[oracle@oraemcc ~]$ rman RMAN> connect catalog rco/rco@rmancat connected to recovery catalog database RMAN> create catalog tablespace rmancat_data; recovery catalog created
That’s it! The RMAN recovery catalog is now ready to use.