Connecting to RMAN
1.Open the DOS command prompt.
2.C:>rman
3.RMAN>
4.RMAN>exit
Connecting to the target database
1.Open the DOS command prompt.
2.C:>SET ORACLE_SID=kendb
3.RMAN> connect target
Or
rman target / NOCATALOG
Or
rman target/
4.RMAN>exit
Creating the Repository in the Recovery Catalog Database
RMAN repository in a separate database called RCMDB.
Add entry in tnsnames.ora file.
Make sure RCMDB is in ArchiveLog Mode.
Make sure Target Database (KENDB) is in archivelog mode.
- sqlplus to RCMDB as SYSDBA
Set oracle_sid=RCMDB
Sqlplus ì/as sysdbaî
Sql>select name from v$database; (Verify you connected to rcmdb) - CREATE USER RMANUSER
IDENTIFIED BY RMANUSER
DEFAULT TABLESPACE USERS
TEMPORARY TABLESPACE TEMP; - sql>grant connect, resource,recovery_catalog_owner to rmanuser;
4.sql>exit; - Invoke RMAN executable
RMAN
RMAN>connect catalog rmanuser/[email protected] - Create catalog for RMANUSER
RMAN>CREATE CATALOG; - RMAN>EXIT;
Connecting to Target and Recovery Catalog Database - C:>set oracle_sid=TESTDB
- C:>RMAN
- RMAN>CONNECT TARGET
- RMAN>CONNECT CATALOG RMANUSER/[email protected]
- RMAN>EXIT;
Or
Instead or step3,4 and 5 You can use following:
C:>RMAN TARGET / CATALOG RMANUSER/[email protected]
Registering the Target Database. - C:>SET ORACLE_SID=TESTDB
- C:>RMAN
- RMAN>CONNECT TARGET
- RMAN>CONNECT CATALOG RMANUSER/[email protected]
- RMAN>REGISTER DATABASE;
- RMAN>EXIT;
Setting the Retention Policy - Launch RMAN again
- C:>rman target/
- RMAN>configure retention policy to redundancy 2;
- RMAN>show retention policy;
- RMAN>configure retention policy to recovery window of 3 days;
- RMAN>configure retention policy clear;
- RMAN>exit;
Configuring the Default Device Type - C>rman target/
- RMAN>configure default device type to sbt; (for tape)
- RMAN>configure default device type to disk;
- RMAN>show default device type;
- RMAN>configure default device type clear;
- RMAN>exit;
format for device type disk
Configuring Controlfile Autobackup - C>rman target/
- RMAN>configure controlfile autobackup on;
- RMAN> configure controlfile autobackup format for device type disk to ‘f:\backup\kendb\rman\%F’;
- RMAN>show controlfile autobackup;
- RMAN>show controlfile autobackup format;
- RMAN>configure controlfile autobackup clear;
- RMAN>configure controlfile autobackup format for device type disk clear;
- RMAN>exit;
Configuring the Default Backup Type - C>rman target/
- RMAN>configure device type disk backup type to backupset;
- RMAN>configure device type disk backup type to copy;
- RMAN>configure device type disk backup type to compressed backupset;
- RMAN>show device type;
- RMAN>backup database;
- RMAN>list backup;
- RMAN>configure device type disk clear;
- RMAN>exit;
Parallelizing backups - C>set oracle_sid=kendb
- C>rman target/
- RMAN>configure device type disk parallelism 4;
- RMAN>backup datafile 2, 3;
RMAN>exit
Backup entire Database - C>set oracle_sid=kendb
- C>rman
- RMAN>CONNECT TARGET
- RMAN>CONNECT CATALOG RMANUSER/[email protected];
- RMAN>CONFIGURE DEVICE TYPE DISK CLEAR;
- RMAN>BACKUP DATABASE;
OR - RMAN> BACKUP DATABASE FORMAT ëO:\ORABACKUP\KENDB\BACKUP.RMAN\db_%u_%d_%s_%pí;
OR - RMAN>BACKUP DATABASE MAXSETSIZE=500M;
- RMAN>EXIT;
Backup Tablespace - C>set oracle_sid=kendb
- C>rman target/
- RMAN>backup tablespace system;
- RMAN>backup tablespace system, sysaux;
Backup Datafile - C>set oracle_sid=kendb
- C>rman target/
- RMAN>report schema;
- RMAN>backup datafile 3;
- RMAN>backup datafile 2,4;
- RMAN>exit;
Backup Controlfile - C>rman target/
- RMAN>backup current controlfile;
- RMAN>exit;
Creating Compressed Backups - C>set oracle_sid=kendb
- C>rman target/
- RMAN>backup as compressed backupset datafile 3;
RMAN>exit;
Backup ArchiveLogs - C>set oracle_sid=kendb
- C>rman
- RMAN>backup archivelog all;
OR - RMAN>backup archivelog all delete input;
(This deletes archivelog files after they have been backed up.) - Backup Archivelogs generated in the past 2 days.
- RMAN>backup archivelog from time ësysdate-2í until time ësysdateí;
- RMAN>exit;
Performing Incremental Backups - C>set oracle_sid=kendb
- C>rman target/
- RMAN>backup incremental level 0 database;
Incremental backups may be taken at Tablespace or datafile level.
OR - RMAN>BACKUP INCREMENTAL LEVEL 0 DATAFILE 2, 4;
- RMAN>BACKUP INCREMENTAL LEVEL 0 TABLESPACE USERS;
Create Incremental Level 1 backups - RMAN>backup incremental level 1 tablespace users;
- RMAN>backup incremental level 1 database;
Create Cumulative Level 1 backups - RMAN>backup incremental level 1 cumulative tablespace users;
- RMAN>backup incremental level 1 cumulative database;
- RMAN>backup incremental level 1 cumulative datafile 2, 4;
- RMAN>exit;
Create Image Copies - C>set oracle_sid=kendb
- C>rman target/
- RMAN>backup as copy database;
OR - RMAN>backup as copy tag ìusers_wkly_bkpî tablespace users;
OR - RMAN>backup as copy datafile 4;
- RMAN>exit;
LIST COMMAND
Which backups are currently available. - C>set oracle_sid=kendb
- C>rman target/
- rman>list backup by backup;
- rman>list backupset by backup;
- rman>list backup by backup verbose;
- rman>list backup by backup summary;
- rman>list backup by file;
- rman>list copy of database; ?image copies
- rman>list copy of tablespace users;
- rman>list copy of datafile 3;
- rman>list incarnation; ?to view different incarnation
Identify files that are in need of backup - c>set oracle_sid=kendb
- c>rman target/
- rman>configure retention policy to redundancy 2;
- rman> report need backup;
- rman> report need backup days=7 database; ?files that need a minimum of 7 days of logfiles to be applied in the event of recovery.
- rman>exit;
Report Obsolete - c>set oracle_sid=kendb
- c> rman target/
- rman> report obsolete;
- rman> delete obsolete;
- rman>exit;