Wednesday, July 23, 2014

RECOVER NON SYSTEM DATAFILE with a simple command in RMAN

RECOVER  NON-SYSTEM DATAFILE using simple RMAN COMMANDS

MOVE/RENAME/DELETE any NON-SYSTEM datafile to any location
mv /u01/app/oracle/oradata/test/users1.dbf /u01/app/oracle/oradata/test/users1_backup.dbf



startup the database in OPEN mode
it'll throw error like below

SQL> startup
ORACLE instance started.

Total System Global Area 1653518336 bytes
Fixed Size                  2176288 bytes
Variable Size            1241516768 bytes
Database Buffers          402653184 bytes
Redo Buffers                7172096 bytes
Database mounted.
ORA-01157: cannot identify/lock data file 4 - see DBWR trace file
ORA-01110: data file 4: 'C:\APP\UK\ORADATA\TEST\USERS01.DBF'




now exit from SQLPLUS connect RMAN

exit;
RMAN TARGET /
it'll show that the DB is not open like this

C:\Users\IBM_ADMIN>rman target=sys

Recovery Manager: Release 11.2.0.1.0 - Production on Tue Jul 15 14:55:24 2014

Copyright (c) 1982, 2009, Oracle and/or its affiliates.  All rights reserved.

target database Password:
connected to target database: TEST (DBID=2147431481, not open)


NOW you just run the following commands

RMAN> LIST FAILURE;
RMAN> LIST FAILURE 552 DETAIL;
RMAN> ADVISE FAILURE;
RMAN> REPAIR FAILURE PREVIEW;
RMAN> REPAIR FAILURE;

it'll recover and restore the data from ARCHIVES


NOTE:
For these operations you need DB in ARCHIVELOG MODE
552 is the number of datafile which has been moved/deleted/renamed file number, i'll show when you run LIST FAILURE COMMAND




No comments:

Post a Comment