You are on page 1of 2

Create Physical Standby Using RMAN

Step 1:
Backup the primary database that includes backup of datafiles, archivelogs and
controlfile for standby

$ rman target /

RMAN>
run
{
allocate channel c1 type disk;
allocate channel c2 type disk;
allocate channel c3 type disk;
backup database plus archivelog;
}

RMAN> run
2> {
3> allocate channel c1 type disk;
4> backup current controlfile for standby;
5> }

Step 2:
Move the backups to the standby server
+ FTP or SCP the backup pieces.
+ If the backups are on NFS mount then mount the NFS on standby server with the
same name as you mounted on primary database.
+ If the backups are on tape then make sure that you make proper changes on standby
server so that you can restore the backups on standby server.

Step 3:
Make proper changes in the parameter files of both primary and standby database
Add the below parameter in primary database parameter file :
1. log_archive_dest_2='SERVICE=STANDBY'

Add the below parameters in standby database parameter file :


Copy the primary database parameter file and make necessary changes :
1. db_unique_name='standby'
2. db_file_name_convert='/u01/oracle/product/oradata/ora10g/data/',
'/u01/oracle/product/ora10g/oradata/standby/data/'
3. log_file_name_convert='/u01/oracle/product/oradata/ora10g/log/',
'/u01/oracle/product/ora10g/oradata/standby/log'
4. standby_archive_dest='/u01/oracle/product/ora10g/oradata/standby/arch1'

Step 4:
Do the restore and recover on standby database

Note: After the restore try to identify the last archivelog sequence that is backed
up and add 1 to it and do the recovery using it. In the below example the last
archivelog that is backed up is sequence 36 and we added 1 to it that becomes 37
and we recovered till sequence 37.

$ export ORACLE_SID=standby
$ rman target /

RMAN> startup nomount;


RMAN> set dbid=<dbid>;

RMAN> restore standby controlfile from '<controlfile>';

RMAN> sql 'alter database mount standby database';

RMAN> restore database;

RMAN> list backup of archivelog all;

RMAN> recover database until sequence <last Seqno + 1>;

Note:
No need to worry about the errors, you can safely ignore and move to step 5.
Oracle Error:
ORA-01547: warning: RECOVER succeeded but OPEN RESETLOGS would get error below
ORA-01152: file 1 was not restored from a sufficiently old backup
ORA-01110: data file 1: '/u01/oracle/product/ora10g/oradata/standby/data/sys01.dbf'

RMAN> exit

Recovery Manager complete.

Step 5:
Create stadby redolog files.

SQL> alter database add standby logfile '<file>' size <size>;

Step 6:
Put the standby database in recovery managed mode

$ sqlplus "/ as sysdba"

SQL> alter database recover managed standby database disconnect from session;

Database altered.

Step 7:
Check if the archive logs are getting shipped or not.

On Primary:
SQL> alter system archive log current;

SQL> SELECT max(SEQUENCE#) FROM V$ARCHIVED_LOG;


Note:
Note down the sequence# from the above query,

On Standby:
SQL> SELECT max(SEQUENCE#) FROM V$ARCHIVED_LOG;
Note:
Keep checking for some time. Notice that the sequence number should be same after
some time.

You might also like