Platform
Host:
name=rhora01
O.S.=Red Hat Enterprise Linux Server release 5.6
Database:
SID=fapp
Version=Oracle Data base Enterprise Edition 11.1.0.6.0
archivelog=enable
Full backup configuration
1) Define parameters RMAN
$ rman terget /
rman> CONFIGURE RETENTION POLICY TO RECOVERY WINDOW OF 1 DAYS ;
rman> CONFIGURE CONTROLFILE AUTOBACKUP ON;
rman> CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '/u02/backup_fapp/autobackup_%F.bkp';
2) Clean Catalog
$ rman terget /
run {
CROSSCHECK BACKUP;
CROSSCHECK ARCHIVELOG ALL;
}
run {
DELETE NOPROMPT EXPIRED BACKUP;
DELETE NOPROMPT OBSOLETE;
}
3) If the DB is using pfile (init.ora), then make a backup
cd $ORACLE_HOME/dbs
cp -p initfapp.ora initfapp_backup.ora
4) Backup of the database
$ rman terget /
CONFIGURE DEVICE TYPE DISK BACKUP TYPE TO COMPRESSED BACKUPSET PARALLELISM 3;
run {
allocate channel D1 type disk Format '/u02/backup_fapp/backup_full_db_d1_%d_%u_%s_%p.bkp';
allocate channel D2 type disk Format '/u02/backup_fapp/backup_full_db_d2_%d_%u_%s_%p.bkp';
allocate channel D3 type disk Format '/u02/backup_fapp/backup_full_db_d3_%d_%u_%s_%p.bkp';
sql 'alter system archive log current';
backup full database plus archivelog DELETE ALL INPUT TAG='BKP BD Daily Full';
release channel D1;
release channel D2;
release channel D3;
}
Disaster Simulation
We remove all datafiles, controlfile and pfile / spfile.
Now, we retrieve the full backup.
1) Restore pfile or spfile
1.a) Restore pfile from backup from o.s.:
cd $ORACLE_HOME/dbs
cp -p initfapp_backup.ora initfapp.ora
1.b) Restore spfile from RMAN autobackup:rman target /
SET DBID=3953304193; # <--- Obtained from rman backup log.
startup nomount;
restore spfile from '/u02/backup_fapp/autobackup_c-153873094-20121120-00.bkp';
shutdown immediate;
sqlplus / as sysdba
startup nomount;
2) Restore Controfiles:
rman target /
SET DBID=153873094;
SET CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '/u02/backup_fapp/autobackup_%F.bkp';
run {
restore controlfile FROM AUTOBACKUP;
alter database mount;
}
3) Restore and recover data base full;
rman target /
CONFIGURE DEVICE TYPE DISK BACKUP TYPE TO COMPRESSED BACKUPSET PARALLELISM 3;
run {
allocate channel D1 type disk Format '/u02/backup_fapp/backup_full_db_d1_%d_%u_%s_%p.bkp';
allocate channel D2 type disk Format '/u02/backup_fapp/backup_full_db_d2_%d_%u_%s_%p.bkp';
allocate channel D3 type disk Format '/u02/backup_fapp/backup_full_db_d3_%d_%u_%s_%p.bkp';
restore database;
switch datafile all;
recover database;
release channel D1;
release channel D2;
release channel D3;
}
4) Open database:
$ export ORACLE_SID=fapp
$ sqlplus / as sysdba
SQL> alter database open resetlogs;
Database altered.
SQL> select INSTANCE_NAME,STARTUP_TIME,STATUS from v$instance;
INSTANCE_NAME STARTUP_T STATUS
---------------- --------- ------------
fapp 20-NOV-12 OPEN
5) The end;