Monday, June 06, 2005

Oracle Recovery Manager - RMAN - Commands

# set these parameters before running rman
NLS_LANG=american
NLS_DATE_FORMAT='Mon DD YYYY HH24:MI:SS'


# Create tablespace for rman
CREATE TABLESPACE rman LOGGING DATAFILE '/oracle_db/db1/test/rman.dbf' SIZE 100M REUSE
EXTENT MANAGEMENT LOCAL SEGMENT SPACE MANAGEMENT AUTO ;


# create user for rman
CREATE USER rman IDENTIFIED by rman
DEFAULT TABLESPACE rman
TEMpORARY TABLESPACE temp
QUOTA UNLIMITED ON rman;


# grant rman catalog user the needed privs
GRANT RECOVERY_CATALOG_OWNER TO rman;
GRANT CONNECT, RESOURCE TO rman;

# create the catalog
% rman TARGET system/manager CATALOG rman/cat@catdb
RMAN> CREATE CATALOG


# Register the target database with rman, each database needs to be backed up, run:
% rman TARGET system/manager@bpdb CATALOG rman/rman@rmandb
REGISTER DATABASE;


# configure rman to save backups for 14 days!
CONFIGURE RETENTION POLICY TO RECOVERY WINDOW OF 14 DAYS;

# only when backups to disks (when backup to sbt, then user PARAM) - change the backup PATH, %U => unique value
CONFIGURE CHANNEL 1 DEVICE TYPE DISK FORMAT '/oracle_backup/%U';

# configure the default device to disk (this is already the default :)
CONFIGURE DEFAULT DEVICE TYPE TO DISK;

# Backing up the database and control file and archive log
backup database current controlfile archivelog all;
or
backup database ;
backup current controlfile ;
backup archivelog all;


# backup all archive log and delete the files after
backup archivelog all delete input;

1 comment:

Anonymous said...

RMAN steps are simple and superb. nice documentation