Wednesday, February 2, 2022

RMAN Backup on Standby Database and Restoration on new server

 Overview

   In this document, I will show you the steps of backing up the oracle database using Rman on the active standby database, and then I will copy that backup set to another server for the restoration.


1. Database Backup on Standby

1.1 Consistent means, that the backup is having the datafiles and the related archived redologs, so that it can be opened with this backup. This done on the Primary database by using :

RMAN> backup database plus archivelog;

1.2 Write a shell script to switch log files from Primary database

#!/bin/ksh

#
# Change <passwd>
#        <primary_db>
#

sqlplus -s "sys/<passwd>@<primary_db> as sysdba" <<EOF
alter system archive log current;
exit
EOF

% chmod 755 /usr/local/bin/logswitch.sh


1.3 Rman backup on active data guard database

% rman target / catalog <un/pw@catalog_db>

Rman> Configure controlfile autobackup on  ;--------------> This would ensure Controlfile auto backup
RMAN> backup database plus archivelog delete input;

      host "/usr/local/bin/logswitch.sh";

      backup archivelog all delete input;

2. Copy the backup set to restore in new server

2.1 startup nomount

 startup nomount pfile='/u01/app/oracle/product/12.1.0.2/db_1/dbs/initcdb3.ora';

2.2 Restore control file from backup piece

restore controlfile from '/data/2022_02_03/o1_mf_s_1095663611_jzpj98qo_.bkp';

2.3 Catalog backup set and restore/recover database

 run

{

catalog start with '/data/2022_02_03/' noprompt;

Restore database;

SWITCH DATAFILE ALL;

Recover database;

}

2.4 Force Finish the Recovery

SQL> RECOVER MANAGED STANDBY DATABASE FINISH FORCE;

Media recovery complete.


2.5 Activate Standby DB

SQL> alter database activate standby database;


2.6 Open Database

SQL> alter database open;


Database altered.


No comments:

Post a Comment