Freeman
Freeman

Reputation: 12758

How to restore via RMAN?

I want to backup via RMAN and delete scott.dept and again restore everything. (this is for testing RMAN mechanism)

I wrote like this :

1)rman target sys/manager@db

2)in sql*plus
   shutdown immediate;
   startup mount exclusive;
   ALTER DATABASE ARCHIVELOG;

2)CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO 'g:\db\db_cf%F';

3)BACKUP DATABASE PLUS ARCHIVELOG;

4)alter database open;

5)drop scott.dept

6)in sql*plus
   shutdown immediate;
   startup mount exclusive;
   ALTER DATABASE ARCHIVELOG;

7)Restore Database;

8)Recover Database;

At the end it shows me : successfully completed .

but scott.dept not restore yet; why? Thanks ...

Upvotes: 0

Views: 1596

Answers (2)

OracleGuru
OracleGuru

Reputation: 3

IF you want to restore everything then no need to mention point-in-time

startup nomount

run {
restore controflile from 'path';
SQL 'ALTER DATABASE MOUNT';
restore database;
recover database;
}

Upvotes: 0

David Mann
David Mann

Reputation: 2000

If you did a full recovery then that is the result I would expect.

The DROP SCOTT.DEPT action was applied do the database when you recovered and fed RMAN all the outstanding archived logs.

You want to do a point in time recovery to a time before you issued the DROP statement.

rman target sys/manager@db 

RUN
{
  SET UNTIL TIME 'Feb 3 2010 08:30:00'; 
  RESTORE CONTROLFILE ;
  ALTER DATABASE MOUNT; 
  RESTORE DATABASE;
  RECOVER DATABASE;
}

More info here: Oracle 10.2 Backup and Recovery Basics - Performing Database Point-In-Time Recovery

ALternately you could leave the RECOVER DATABASE step off and just RESTORE the database followed by an OPEN RESETLOGS. That would allow you to skip applying any changes in the Archived Logs.

Upvotes: 2

Related Questions