RMAN> Recuperando o banco após uma perda de Controlfile

Este artigo mostra como realizar uma recuperação de um backup feito a partir do RMAN.

1) Conect-se ao banco de dados que quer restaurar:

rman target /

Recovery Manager: Release 10.2.0.1.0 – Production on Wed Apr 15 12:36:08 2009

Copyright (c) 1982, 2005, Oracle. All rights reserved.

connected to target database (not started)

2) inicie a instância em modo nomount;

RMAN> startup nomount

Oracle instance started

Total System Global Area 838860800 bytes

Fixed Size 1222192 bytes
Variable Size 239077840 bytes
Database Buffers 591396864 bytes
Redo Buffers 7163904 bytes

3) Restaure os controlfiles com o comando

RMAN> restore controlfile from autobackup;

Starting restore at 15-APR-09
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=541 devtype=DISK

recovery area destination: /u01/flash_recovery_area
database name (or database unique name) used for search: ORCL
channel ORA_DISK_1: autobackup found in the recovery area
channel ORA_DISK_1: autobackup found: /u01/flash_recovery_area/ORCL/autobackup/2009_04_15/o1_mf_s_684241770_4yctnw2z_.bkp
channel ORA_DISK_1: control file restore from autobackup complete
output filename=/u01/app/oracle/oradata/ORCL/c_ORCL_01.ctl
output filename=/u01/app/oracle/oradata/ORCL/c_ORCL_02.ctl
output filename=/u01/app/oracle/oradata/ORCL/c_ORCL_03.ctl
Finished restore at 15-APR-09

4) Monte a base de dados

RMAN> alter database mount;

database mounted
released channel: ORA_DISK_1

5) Catalogue algum archive que possivelmente tenha sido gerado após o seu ultimo backup

RMAN> catalog start with ‘/u01/flash_recovery_area/’;

Starting implicit crosscheck backup at 15-APR-09
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=541 devtype=DISK
Crosschecked 3 objects
Finished implicit crosscheck backup at 15-APR-09

Starting implicit crosscheck copy at 15-APR-09
using channel ORA_DISK_1
Finished implicit crosscheck copy at 15-APR-09

searching for all files in the recovery area
cataloging files…
cataloging done

List of Cataloged Files
=======================
File Name: /u01/flash_recovery_area/ORCL/archivelog/2009_04_15/o1_mf_1_16_4ycyqx7c_.arc
File Name: /u01/flash_recovery_area/ORCL/archivelog/2009_04_15/o1_mf_1_17_4ycysb2r_.arc
File Name: /u01/flash_recovery_area/ORCL/archivelog/2009_04_15/o1_mf_1_18_4ycysh47_.arc
File Name: /u01/flash_recovery_area/ORCL/archivelog/2009_04_15/o1_mf_1_19_4ycyso4y_.arc
File Name: /u01/flash_recovery_area/ORCL/archivelog/2009_04_15/o1_mf_1_20_4ycystv1_.arc
File Name: /u01/flash_recovery_area/ORCL/archivelog/2009_04_15/o1_mf_1_21_4ycysv15_.arc
File Name: /u01/flash_recovery_area/ORCL/archivelog/2009_04_15/o1_mf_1_22_4ycyt06q_.arc
File Name: /u01/flash_recovery_area/ORCL/autobackup/2009_04_15/o1_mf_s_684241770_4yctnw2z_.bkp

searching for all files that match the pattern /u01/flash_recovery_area/
no files found to be unknown to the database

6) Restauração dos datafiles do banco

RMAN> restore database;

Starting restore at 15-APR-09
using channel ORA_DISK_1

channel ORA_DISK_1: starting datafile backupset restore
channel ORA_DISK_1: specifying datafile(s) to restore from backup set
restoring datafile 00001 to /u01/app/oracle/oradata/ORCL/system.dbf
restoring datafile 00002 to /u01/app/oracle/oradata/ORCL/undo.dbf
restoring datafile 00003 to /u01/app/oracle/oradata/ORCL/sysaux.dbf
channel ORA_DISK_1: reading from backup piece /u01/flash_recovery_area/ORCL/backupset/2009_04_15/o1_mf_nnndf_TAG20090415T110820_4yctlo88_.bkp
channel ORA_DISK_1: restored backup piece 1
piece handle=/u01/flash_recovery_area/ORCL/backupset/2009_04_15/o1_mf_nnndf_TAG20090415T110820_4yctlo88_.bkp tag=TAG20090415T110820
channel ORA_DISK_1: restore complete, elapsed time: 00:01:25
Finished restore at 15-APR-09

7) Aplicação dos archivelogs no banco (Media Recover)

RMAN> recover database;

Starting recover at 15-APR-09
using channel ORA_DISK_1

starting media recovery

archive log thread 1 sequence 15 is already on disk as file /u01/flash_recovery_area/ORCL/archivelog/2009_04_15/o1_mf_1_15_4yctnpwn_.arc
archive log thread 1 sequence 16 is already on disk as file /u01/flash_recovery_area/ORCL/archivelog/2009_04_15/o1_mf_1_16_4ycyqx7c_.arc
archive log thread 1 sequence 17 is already on disk as file /u01/flash_recovery_area/ORCL/archivelog/2009_04_15/o1_mf_1_17_4ycysb2r_.arc
archive log thread 1 sequence 18 is already on disk as file /u01/flash_recovery_area/ORCL/archivelog/2009_04_15/o1_mf_1_18_4ycysh47_.arc
archive log thread 1 sequence 19 is already on disk as file /u01/flash_recovery_area/ORCL/archivelog/2009_04_15/o1_mf_1_19_4ycyso4y_.arc
archive log thread 1 sequence 20 is already on disk as file /u01/flash_recovery_area/ORCL/archivelog/2009_04_15/o1_mf_1_20_4ycystv1_.arc
archive log thread 1 sequence 21 is already on disk as file /u01/flash_recovery_area/ORCL/archivelog/2009_04_15/o1_mf_1_21_4ycysv15_.arc
archive log thread 1 sequence 22 is already on disk as file /u01/flash_recovery_area/ORCL/archivelog/2009_04_15/o1_mf_1_22_4ycyt06q_.arc
archive log filename=/u01/flash_recovery_area/ORCL/archivelog/2009_04_15/o1_mf_1_15_4yctnpwn_.arc thread=1 sequence=15
archive log filename=/u01/flash_recovery_area/ORCL/archivelog/2009_04_15/o1_mf_1_16_4ycyqx7c_.arc thread=1 sequence=16
archive log filename=/u01/flash_recovery_area/ORCL/archivelog/2009_04_15/o1_mf_1_17_4ycysb2r_.arc thread=1 sequence=17
archive log filename=/u01/flash_recovery_area/ORCL/archivelog/2009_04_15/o1_mf_1_18_4ycysh47_.arc thread=1 sequence=18
archive log filename=/u01/flash_recovery_area/ORCL/archivelog/2009_04_15/o1_mf_1_19_4ycyso4y_.arc thread=1 sequence=19
archive log filename=/u01/flash_recovery_area/ORCL/archivelog/2009_04_15/o1_mf_1_20_4ycystv1_.arc thread=1 sequence=20
archive log filename=/u01/flash_recovery_area/ORCL/archivelog/2009_04_15/o1_mf_1_21_4ycysv15_.arc thread=1 sequence=21
archive log filename=/u01/flash_recovery_area/ORCL/archivelog/2009_04_15/o1_mf_1_22_4ycyt06q_.arc thread=1 sequence=22
unable to find archive log
archive log thread=1 sequence=23
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of recover command at 04/15/2009 12:42:30
RMAN-06054: media recovery requesting unknown log: thread 1 seq 23 lowscn 471959

8) Abra o banco em resetlogs para ter uma nova incarnação do database. Sempre que restauração do controlfile é feita, esse passo é obrigatório.

RMAN> alter database open resetlogs;

database opened

RMAN>

9) Faça um backup full novamente, pois vc tem agora uma nova incarnação do banco de dados.

Deixe uma resposta

O seu endereço de email não será publicado. Campos obrigatórios são marcados com *