How to configure simple standard RMAN backups for Oracle DB with catalog database

Create Catalog Schema

At the database you intend to use as catalog database:

Create Tablespace for catalog schema

SQL> create tablespace CAT_TBS; 
Tablespace created.

Create Catalog Schema

SQL> create user RMANCAT identified by XXX default tablespace CAT_TBS temporary tablespace TEMP quota unlimited on CAT_TBS;
 
SQL> grant create session to RMANCAT;
Grant succeeded.
SQL> grant recovery_catalog_owner to RMANCAT;
Grant succeeded.
SQL> grant execute on dbms_stats to RMANCAT;
Grant succeeded.

Configure RMAN

At the database you want to backup, confugure RMAN with access to catalog

Configure TNS

Configure TNS so you have connectivity to the catalog database.

vi $TNS_ADMIN/tnsnames.ora
OPS =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = linux10)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = ops.loopback.org)
)
)

Connect RMAN to catalog

 

oracle@orcl1$ rman target / catalog rmancat/XXX@ops
Recovery Manager: Release 11.2.0.2.0 - Production on Fri Feb 24 18:49:22 2012
Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved.
connected to target database: OPS (DBID=3945272714)
connected to recovery catalog database

Create Catalog

RMAN> create catalog tablespace cat_tbs;

recovery catalog created

Register database

RMAN> register database;
database registered in recovery catalog
starting full resync of recovery catalog
full resync complete

RMAN> report schema;

Report of database schema for database with db_unique_name LOOPDW
List of Permanent Datafiles

File Size(MB) Tablespace RB segs Datafile Name

---- -------- -------------------- ------- ------------------------
1 820 SYSTEM YES /orcl1/oradata/LOOPDW/datafile/o1_mf_system_75w23n11_.dbf
2 1300 SYSAUX NO /orcl1/oradata/LOOPDW/datafile/o1_mf_sysaux_75w25hkd_.dbf
3 540 UNDOTBS1 YES /orcl1/oradata/LOOPDW/datafile/o1_mf_undotbs1_75w273r6_.dbf
4 5 USERS NO /orcl1/oradata/LOOPDW/datafile/o1_mf_users_75w28flx_.dbf
5 100 TBSAAAAAA NO /orcl1/oradata/LOOPDW/datafile/o1_mf_daff_75wf3gll_.dbf
6 100 TBSBBBBBB NO /orcl1/oradata/LOOPDW/datafile/o1_mf_efef_75wf58x5_.dbf
7 300 OWB NO /orcl1/oradata/LOOPDW/datafile/o1_mf_owb_767m2qrp_.dbf
8 11 OLTS_DEFAULT NO /orcl1/oradata/gdefault1_oid.dbf
9 0 OLTS_BATTRSTORE NO /orcl1/oradata/battrs1_oid.dbf
10 54 OLTS_CT_STORE NO /orcl1/oradata/gcats1_oid.dbf
11 21 OLTS_ATTRSTORE NO /orcl1/oradata/attrs1_oid.dbf
12 11 OLTS_SVRMGSTORE NO /orcl1/oradata/svrmg1_oid.dbf

List of Temporary Files
File Size(MB) Tablespace Maxsize(MB) Tempfile Name
---- -------- -------------------- ----------- --------------------
1 60 TEMP 65535 /orcl1/oradata/LOOPDW/datafile/o1_mf_temp_75w27mdo_.tmp
2 100 IAS_TEMP 100 /orcl1/oradata/iastemp.dbf Configure RMAN parameters h1. (optionally)

RMAN> configure default device type to disk;

new RMAN configuration parameters:
CONFIGURE DEFAULT DEVICE TYPE TO DISK;
new RMAN configuration parameters are successfully stored
starting full resync of recovery catalog
full resync complete

RMAN> configure retention policy to recovery window of 7 days;

new RMAN configuration parameters:
CONFIGURE RETENTION POLICY TO RECOVERY WINDOW OF 7 DAYS;
new RMAN configuration parameters are successfully stored
starting full resync of recovery catalog
full resync complete

RMAN> configure backup optimization on;

new RMAN configuration parameters:
CONFIGURE BACKUP OPTIMIZATION ON;
new RMAN configuration parameters are successfully stored
starting full resync of recovery catalog
full resync complete

Configure a default destination for backups:


RMAN> CONFIGURE CHANNEL DEVICE TYPE DISK FORMAT '/filer/RMAN/LOOPDW/%U';

Provide space for backup destinations at the database host RMAN is running on.

If you are using NFS storage, use correct mount options to avoid "ORA-27054: NFS file system where the file is created or resides is not mounted with correct options" errors.

mount -F nfs -o rw,bg,hard,rsize=32768,wsize=32768,vers=3,forcedirectio,nointr,proto=tcp,suid filer:/tank/filer Backups/RMAN /filer/RMAN

Perform a manual backup

An instant backup, done interactively h1. RMAN> backup database;

RMAN> backup archivelog all delete input;

Confugure a cron based backup

oracle@orcl1 ~/RMAN/scripts$ cat loopdw.cmd
# Perform backup of database and archivelogs, deleting backed up archivelogs
BACKUP AS COMPRESSED BACKUPSET DATABASE PLUS ARCHIVELOG DELETE INPUT;
# Maintainance commands for crosschecks and deleting expired backups
ALLOCATE CHANNEL FOR MAINTENANCE DEVICE TYPE DISK;
CROSSCHECK BACKUP;
DELETE NOPROMPT EXPIRED BACKUP;
DELETE NOPROMPT OBSOLETE DEVICE TYPE DISK;
CROSSCHECK ARCHIVELOG ALL;
DELETE NOPROMPT EXPIRED ARCHIVELOG ALL;
# EOF

$ export EDITOR=vi

$ crontab -e

$ crontab -l
35 02 * * * rman target / catalog rmancat/XXX@loopds cmdfile=/home/oracle/RMAN/scripts/loopdb.cmd