RMAN Time Based Recovery

RMAN> run

{

allocate channel c1 device type disk;

allocate channel c2 device type disk;

backup database;

backup(archivelog all delete input);

}

 

SQL> create table b(name varchar(100));

 Table created.

 

SQL> insert into b values('INSERT BEFORE BACKUP');

 1 row created.

 

SQL> select to_char(sysdate,'YYYY-MM-DD hh24:mi:ss') from dual;

 TO_CHAR(SYSDATE,'YY

--------------------------------

2009-05-24 11:57:43

 

SQL> drop table b;

 Table dropped.

 

SQL> shutdown immediate;

Database closed.

Database dismounted.

ORACLE instance shut down.

 

SQL> startup mount;

ORACLE instance started.

 Total System Global Area  167772160 bytes

Fixed Size                  1247876 bytes

Variable Size              79693180 bytes

Database Buffers           79691776 bytes

Redo Buffers                7139328 bytes

Database mounted.

 

H:\>set nls_date_format=YYYY-MM-DD hh24:mi:ss

 H:\>set oracle_sid=dba20

 H:\>rman

 RMAN> connect target sys/sys

 connected to target database: DBA20 (DBID=847839442, not open)

 

RMAN> run

{

allocate channel c1 type disk;

allocate channel c2 type disk;

allocate channel c3 type disk;

set until time='2009-05-24 11:57:43';

restore database;

recover database;

}

 

SQL> alter database open resetlogs;

 Database altered.

 

SQL> select * from b;

 NAME

--------------------------------------------

 INSERT BEFORE BACKUP

 

Comments