Friday 22 March 2019

How to restore a corrupted/missing datafile in standby:



How to restore a corrupted/missing datafile in standby:


Before 12.2
1. Cancel the recovery
    dgmgrl > edit database <db> set state='APPLY-OFF';
     (or) alter database recover managed standby database cancel;

2. From Primary take a datafile copy
rman target /
 backup as copy datafile 2 format "/u01/app/oracle/data01/sysaux_01.dbk" ;

3. scp the file from primay server to standby server ( may be to the same location in standby server)
4. catalog the datafile copy ( in sby server)
rman target /
  catalog datafilecopy '/u01/app/oracle/data01/sysaux_01.dbk'

5. Either do a switch copy or restore the datafile to the same location mentioned in the controlfile( in sby server)
   rman target /
 switch datafile 2 to copy;
 report schema

  alternatively
RUN {
  ALLOCATE CHANNEL ch00 TYPE disk ;
  restore datafile 2  ;
  }

6. enable recovery
    dgmgrl > edit database <db> set state='APPLY-ON';
     (or) alter database recover managed standby database disconnect from session ;


After 12
rman target sys/oracle@prod
RMAN> run
{
set newname for datafile 4 to '/u01/oracle/data02/users01.dbf' section size 1G;
restore (datafile 4 from service prodservice) using compressed backupset;
catalog datafilecopy '/u01/oracle/data02/users01.dbf';
}

No comments:

Post a Comment

ZFS

Public Cloud tools comparison