Saturday, February 26, 2022
RMAN Database Full Backup & Recovery
RMAN Database Full Backup & Recovery
-Take RMAN DB FULL Backup
-Simulate Failure
-Start Database Recovery
nohup rman target / cmdfile=/u01/mqm/MQM_RMAN_Backup_script.sh log=/u01/mqm/rman_fullbackup_db.log &
cat mqm_rmanbackup.txt
run
{
allocate channel t1 type disk;
backup format '/u01/mqm/full_db_%t_%p%p' database;
backup format '/u01/mqm/archive_%t_%p%p' archivelog all;
backup format '/u01/mqm/cntrl_%s_%p_%t' current controlfile;
Backup format '/u01/mqm/spfile_%s_%p_%t' spfile;
release channel t1;
}
cat rman_exec.sh
rman target / cmdfile=mqm_rmanbackup.txt
nohup ./rman_exec.sh &
RMAN> list backup of database summary;
RMAN> list backup summary;
Simulate Failure:
Take the location of spfile, datafile & control file
SQL> select name from v$datafile;
SQL> select member from v$logfile;
SQL> select name from v$controlfile;
SQL> show parameter spfile;
SQL> create pfile from spfile;
File created.
Delete all the spfile, datafiles & Control files from the server.
SQL> startup;
ORACLE instance started.
Total System Global Area 801112064 bytes
Fixed Size 8797872 bytes
Variable Size 423625040 bytes
Database Buffers 360710144 bytes
Redo Buffers 7979008 bytes
ORA-00205: error in identifying control file, check alert log for more info
Restore Controlfile:
run
{
allocate channel c1 type disk;
set until time "to_date('2022/02/26 15:47:00','yyyy/mm/dd HH24:MI:SS')";
restore controlfile from '/u01/mqm/cntrl_23_1_1097682448';
release channel c1;
}
Bring the database at mount state
RMAN> alter database mount;
Statement processed
(or)
sqlplus / as sysdba
SQL> alter database mount;
Database altered.
Restore Database:
run
{
allocate channel c1 type disk;
set until time "to_date('2022/02/26 15:47:00','yyyy/mm/dd HH24:MI:SS')";
restore database;
recover database;
release channel c1;
}
RMAN> alter database open resetlogs;
Statement processed
(or)
sqlplus / as sysdba
SQL> alter database open resetlogs;
Database altered.