Thursday, April 16, 2009

Using RMAN to Recover a Database in ARCHIVELOG mode
CH # 13
Note: You must have backup of database by RMAN.
Scenario: Delete two or three datafiles from database and then do the following:
RMAN> Startup Mount
RMAN> Restore Database;
RMAN> Recover Database
RMAN>Alter database open
Using RMAN to Restore Datafiles to a New Location
RMAN> Run {
Set newname from datafile 1 to ‘c:\newlocation\system01.dbf’;
Restore database;
Switch datafile all (entry will be recorded in controlfile)
Recover database;
Alter database open;}

Using RMAN to Recover a Tablespace
RMAN> Run {
Sql ‘alter tablespace users offline immediate ‘;
Restore tablespace users;
Recover tabelspace users;
Sql ‘ alter tablespace users online’; }
Using RMAN to Relocate a Tablespace
RMAN > Run {
Sql ‘ alter tablespace users offline immediate ‘;
Set newname for datafile ‘c:\oracle\oradata\orcl\users01.dbf’ to
‘c:\newlocation\users01.dbf’;
Restore tablespace users;
Switch datafile 3; (update the control file and recovery catalog)
Recover tablespace users;
Sql ‘ alter tablespace users online;
}
RMAN InComplete Recovery Until Time
CH # 15
Note: Suppose a table is drop and you have to recover that table then you must have
to perform incomplete recovery.
Set the following environmental variables in registry for this practical
1- NLS_LANG=American
2- NLS_DATE_FORMAT =’YYY’-MM-DD:HH24:MI:SS’
RMAN > Run {
Allocate Channel c1 type disk;
Allocate Channel c2 type disk ;
Set until time=’2001-12-08:13:54:00’
Restore database;
Recover database;
Alter database open resetlogs;
}

RMAN MAINTENANCE COMMANDS
CH # 16
CROSSCHECK COMMAND
RMAN> Crosscheck backupset of database;
RMAN> Crosscheck Copy ;
This command compare the recovery catalog to Hard Disk for confirmation that
the above backupset is available or expired.
DELETE COMMAND
RMAN> Delete backupset 102
If you want to delete without confirmation the use the following command.
RMAN> Delete noprompt expired backup of tablespace users;
If you want to delete backups,copies and archived redo log files based on the configured
retention policy then use the following command .
RMAN> Delete Obsolete

No comments: