Custom Search . . .

Sunday, May 2, 2010

RMAN Incomplete Recovery


Take complete RMAN FULL backup

rman > backup database;

SQL> create table test (a int);

Table created.


SQL> begin
  2  for i in 1..50 loop
  3  insert into test values (i);
  4  end loop;
  5  commit;
  6  end;
  7  /

PL/SQL procedure successfully completed.

SQL> commit;

Commit complete.

SQL> select to_char(sysdate,'dd-mm-yy hh24:mi:ss') from dual;

TO_CHAR(SYSDATE,'
-----------------
01-05-10 16:25:00

SQL> delete from test;

50 rows deleted.

SQL> commit;

Commit complete.

SQL> select count(*) from test;

  COUNT(*)
----------
         0

RMAN> run
2> {
3> shutdown immediate
4> startup mount
5> allocate channel c1 type disk;
6> allocate channel c2 type disk;
7> set until time "to_date('01-05-2010 16:25:00','DD-MM-YYYY HH24:MI:SS')";
8> restore database;
9> recover database;
10> }

database dismounted
Oracle instance shut down

connected to target database (not started)
Oracle instance started
database mounted

Total System Global Area     209235968 bytes

Fixed Size                     1332188 bytes
Variable Size                138415140 bytes
Database Buffers              62914560 bytes
Redo Buffers                   6574080 bytes

allocated channel: c1
channel c1: SID=154 device type=DISK

allocated channel: c2
channel c2: SID=153 device type=DISK

executing command: SET until clause

Starting restore at 01-MAY-10

channel c1: starting datafile backup set restore
channel c1: specifying datafile(s) to restore from backup set
channel c1: restoring datafile 00003 to F:\ORACLE\PRODUCT\11.0.1\ORADATA\ORCL\DATA\UNDOTBS01.DBF
channel c1: restoring datafile 00004 to F:\ORACLE\PRODUCT\11.0.1\ORADATA\ORCL\DATA\USERS01.DBF
channel c1: reading from backup piece I:\BACKUP\ORCL\ORCL_20100501_0ILCJKUR_S18_P1
channel c2: starting datafile backup set restore
channel c2: specifying datafile(s) to restore from backup set
channel c2: restoring datafile 00001 to F:\ORACLE\PRODUCT\11.0.1\ORADATA\ORCL\DATA\SYSTEM01.DBF
channel c2: restoring datafile 00002 to F:\ORACLE\PRODUCT\11.0.1\ORADATA\ORCL\DATA\SYSAUX01.DBF
channel c2: restoring datafile 00005 to F:\ORACLE\PRODUCT\11.0.1\ORADATA\ORCL\DATA\TEST010_2.DBF
channel c2: reading from backup piece I:\BACKUP\ORCL\ORCL_20100501_0HLCJKUQ_S17_P1
channel c1: piece handle=I:\BACKUP\ORCL\ORCL_20100501_0ILCJKUR_S18_P1 tag=TAG20100501T162042
channel c1: restored backup piece 1
channel c1: restore complete, elapsed time: 00:00:45
channel c2: piece handle=I:\BACKUP\ORCL\ORCL_20100501_0HLCJKUQ_S17_P1 tag=TAG20100501T162042
channel c2: restored backup piece 1
channel c2: restore complete, elapsed time: 00:01:05
Finished restore at 01-MAY-10

Starting recover at 01-MAY-10

starting media recovery
media recovery complete, elapsed time: 00:00:02

Finished recover at 01-MAY-10
released channel: c1
released channel: c2

RMAN> alter database open resetlogs;

database opened

RMAN>

SQL> select count(*) from test;

  COUNT(*)
----------
        50

For recover single database objects not require go with RMAN. According to oracle document we should go with oracle utilities (export/import) or oracle flashback option.

For my scenario I don’t have logical backup as well as flashback option also not enabled.

Using RMAN incomplete recovery tried to recover single objects J

No comments: