Tuesday, June 25, 2013

RECOVERY USING RMAN IF ALL DATAFILE,CONTROLFILE,REDOLOGFILES

FIRST HAVE FULL BACKUP OF DATABASE

IF DATABASE OPEN THEN FIRST



[oracle@localhost ~]$ rman target /

Recovery Manager: Release 10.2.0.1.0 - Production on Tue Jun 25 15:58:42 2013

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

connected to target database: ORCL (DBID=1334973392, not open)

RMAN> shutdown immediate;

database closed
database dismounted
Oracle instance shut down

RMAN> STARTUP MOUNT;

connected to target database (not started)
Oracle instance started
database mounted

Total System Global Area     608174080 bytes

Fixed Size                     1220844 bytes
Variable Size                192941844 bytes
Database Buffers             411041792 bytes
Redo Buffers                   2969600 bytes

RMAN> SHOW ALL;

RMAN configuration parameters are:
CONFIGURE RETENTION POLICY TO REDUNDANCY 1; # default
CONFIGURE BACKUP OPTIMIZATION OFF; # default
CONFIGURE DEFAULT DEVICE TYPE TO DISK; # default
CONFIGURE CONTROLFILE AUTOBACKUP ON;
CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '%F'; # default
CONFIGURE DEVICE TYPE DISK PARALLELISM 1 BACKUP TYPE TO BACKUPSET; # default
CONFIGURE DATAFILE BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default
CONFIGURE ARCHIVELOG BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default
CONFIGURE MAXSETSIZE TO UNLIMITED; # default
CONFIGURE ENCRYPTION FOR DATABASE OFF; # default
CONFIGURE ENCRYPTION ALGORITHM 'AES128'; # default
CONFIGURE ARCHIVELOG DELETION POLICY TO NONE; # default
CONFIGURE SNAPSHOT CONTROLFILE NAME TO '/oracle/product/10.2.0/db_1/dbs/snapcf_orcl.f'; # default

RMAN> BACKUP DATABASE;

Starting backup at 25-JUN-13
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=156 devtype=DISK
channel ORA_DISK_1: starting full datafile backupset
channel ORA_DISK_1: specifying datafile(s) in backupset
input datafile fno=00001 name=/oracle/product/10.2.0/oradata/orcl/system01.dbf
input datafile fno=00003 name=/oracle/product/10.2.0/oradata/orcl/sysaux01.dbf
input datafile fno=00005 name=/oracle/product/10.2.0/oradata/orcl/example01.dbf
input datafile fno=00002 name=/oracle/product/10.2.0/oradata/orcl/undotbs01.dbf
input datafile fno=00004 name=/oracle/product/10.2.0/oradata/orcl/users01.dbf
channel ORA_DISK_1: starting piece 1 at 25-JUN-13
channel ORA_DISK_1: finished piece 1 at 25-JUN-13
piece handle=/oracle/product/10.2.0/flash_recovery_area/ORCL/backupset/2013_06_25/o1_mf_nnndf_TAG20130625T161443_8wlx4vy9_.bkp tag=TAG20130625T161443 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:02:06
Finished backup at 25-JUN-13

Starting Control File and SPFILE Autobackup at 25-JUN-13
piece handle=/oracle/product/10.2.0/flash_recovery_area/ORCL/autobackup/2013_06_25/o1_mf_s_819044006_8wlx8t3h_.bkp comment=NONE
Finished Control File and SPFILE Autobackup at 25-JUN-13

DELETE ALL DATAFILES,CONTROLFILE AND REDO LOGFILES





RMAN> SHUTDOWN IMMEDIATE;

database dismounted
Oracle instance shut down

RMAN>

RMAN>

RMAN> STARTUP NOMOUNT;

connected to target database (not started)
Oracle instance started

Total System Global Area     608174080 bytes

Fixed Size                     1220844 bytes
Variable Size                192941844 bytes
Database Buffers             411041792 bytes
Redo Buffers                   2969600 bytes

RMAN> RESTORE CONTROLFILE FROM AUTOBACKUP;

Starting restore at 25-JUN-13
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=156 devtype=DISK

recovery area destination: /oracle/product/10.2.0/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: /oracle/product/10.2.0/flash_recovery_area/ORCL/autobackup/2013_06_25/o1_mf_s_819044006_8wlx8t3h_.bkp
channel ORA_DISK_1: control file restore from autobackup complete
output filename=/oracle/product/10.2.0/oradata/orcl/control01.ctl
output filename=/oracle/product/10.2.0/oradata/orcl/control02.ctl
output filename=/oracle/product/10.2.0/oradata/orcl/control03.ctl
Finished restore at 25-JUN-13

RMAN> ALTER DATABASE MOUNT;

database mounted
released channel: ORA_DISK_1

RMAN>

RMAN>

RMAN> RESTORE DATABASE;

Starting restore at 25-JUN-13
Starting implicit crosscheck backup at 25-JUN-13
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=156 devtype=DISK
Crosschecked 4 objects
Finished implicit crosscheck backup at 25-JUN-13

Starting implicit crosscheck copy at 25-JUN-13
using channel ORA_DISK_1
Finished implicit crosscheck copy at 25-JUN-13

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

List of Cataloged Files
=======================
File Name: /oracle/product/10.2.0/flash_recovery_area/ORCL/autobackup/2013_06_25/o1_mf_s_819044006_8wlx8t3h_.bkp

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 /oracle/product/10.2.0/oradata/orcl/system01.dbf
restoring datafile 00002 to /oracle/product/10.2.0/oradata/orcl/undotbs01.dbf
restoring datafile 00003 to /oracle/product/10.2.0/oradata/orcl/sysaux01.dbf
restoring datafile 00004 to /oracle/product/10.2.0/oradata/orcl/users01.dbf
restoring datafile 00005 to /oracle/product/10.2.0/oradata/orcl/example01.dbf
channel ORA_DISK_1: reading from backup piece /oracle/product/10.2.0/flash_recovery_area/ORCL/backupset/2013_06_25/o1_mf_nnndf_TAG20130625T161443_8wlx4vy9_.bkp
channel ORA_DISK_1: restored backup piece 1
piece handle=/oracle/product/10.2.0/flash_recovery_area/ORCL/backupset/2013_06_25/o1_mf_nnndf_TAG20130625T161443_8wlx4vy9_.bkp tag=TAG20130625T161443
channel ORA_DISK_1: restore complete, elapsed time: 00:00:35
Finished restore at 25-JUN-13

RMAN>

RMAN>

RMAN> RECOVER DATABASE;

Starting recover at 25-JUN-13
using channel ORA_DISK_1

starting media recovery

unable to find archive log
archive log thread=1 sequence=1
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of recover command at 06/25/2013 16:23:28
RMAN-06054: media recovery requesting unknown log: thread 1 seq 1 lowscn 550400

RMAN> ALTER DATABASE OPEN RESETLOGS;

database opened

RMAN>


THE DATABASE OPEN WITH RESETLOGS

SQL> ARCHIVE LOG LIST;
Database log mode              Archive Mode
Automatic archival             Enabled
Archive destination            USE_DB_RECOVERY_FILE_DEST
Oldest online log sequence     0
Next log sequence to archive   1
Current log sequence           1
SQL>
 

1 comment: