Thursday, April 1, 2010

RMAN -Practicals

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

Regards,
Sowmya (OSR)