RMAN Backup and Recovery

Figure: RMAN Channel allocation

SQL> archive log list;

Database log mode Archive Mode

Automatic archival Enabled

Archive destination USE_DB_RECOVERY_FILE_DEST

Oldest online log sequence 17

Next log sequence to archive 19

Current log sequence 19

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

Table created.

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

1 row created.

SQL> commit;

Commit complete.

H:\>set oracle_sid=dba20

H:\>rman

RMAN> connect target sys/sys

connected to target database: DBA20 (DBID=847839442)

RMAN> run{

allocate channel c1 type disk;

allocate channel c2 type disk;

allocate channel c3 type disk;

allocate channel c4 type disk;

backup database;

}

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

1 row created.

SQL> commit;

Commit complete.

SQL> shutdown immediate;

Database closed.

Database dismounted.

ORACLE instance shut down.

Delete USERS.DBF/SYSTEM.DBF

SQL> startup;

ORACLE instance started.

Total System Global Area 167772160 bytes

Fixed Size 1247876 bytes

Variable Size 71304572 bytes

Database Buffers 88080384 bytes

Redo Buffers 7139328 bytes

Database mounted.

ORA-01157: cannot identify/lock data file 1 - see DBWR trace file

ORA-01110: data file 1: 'C:\ORACLE\PRODUCT\10.2.0\ORADATA\DBA20\SYSTEM01.DBF'

RMAN> run

{

allocate channel c1 type disk;

allocate channel c2 type disk;

allocate channel c3 type disk;

restore database;

recover database;

}

SQL> alter database open;

Database altered.

SQL> select * from b;

NAME

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

**** INSERT BEFORE BACKUP *****

**** INSERT AFTER BACKUP *****