Production server – serverProd
Standby server – serverStby
Production database – whseprod
Standby database - whsestby
Step 1: Using RMAN, Backup the database
that includes backup of datafiles, archivelogs and controlfile for standby
[oracle@serverProd]$
rman target /
connected
to target database: whseprod (DBID=123322)
RMAN>
run {
allocate
channel disk1 type disk format '/backup/whseprod_restore/%d%U' maxpiecesize 5
G;
allocate
channel disk2 type disk format '/backup/whseprod_restore/%d%U' maxpiecesize 5
G;
allocate
channel disk3 type disk format '/backup/whseprod_restore/%d%U' maxpiecesize 5
G;
allocate
channel disk4 type disk format '/backup/whseprod_restore/%d%U' maxpiecesize 5
G;
allocate
channel disk5 type disk format '/backup/whseprod_restore/%d%U' maxpiecesize 5
G;
backup
force as BACKUPSET tag '%TAG' database;
backup
as BACKUPSET tag '%TAG' archivelog;
release
channel disk1;
release
channel disk2;
release
channel disk3;
release
channel disk4;
release
channel disk5;
}
RMAN>
run {
allocate
channel disk1 type disk format '/backup/whseprod_restore/%d%U' maxpiecesize 5 G;
backup
force as BACKUPSET tag '%TAG' current
controlfile for standby;
release
channel disk1;
}
Step 2: Move the backups to the standby
server using ftp
cd to directory that you want
the files to go in on standby system
[oracle@serverStby
..]$ cd /backup/whseprod_restore
[oracle@serverStby /backup/whseprod_restore]$
ftp serverProd
ftp> bin
ftp> prompt
change
directory on the source system
ftp> cd /backup/whseprod_restore
ftp> mget *
ftp> quit
Step 3: Make proper changes in the
parameter files of both primary and standby database
whseprod init file
DB_NAME=whseprod
DB_UNIQUE_NAME=whse
CONTROL_FILES='/whseredo/oradata/control01.ctl','/whseredo/oradata/control02.ctl','/whseredo/oradata/control03.ctl'
LOG_ARCHIVE_DEST_1='LOCATION=/whsearch/arch
VALID_FOR=(ALL_LOGFILES,ALL_ROLES)'
alter
system set FAL_CLIENT=whseprod scope=both;
alter
system set FAL_SERVER=whsestby scope=both;
alter
system set LOG_ARCHIVE_CONFIG='DG_CONFIG=(whseprod, whsestby)' scope=both;
alter
system set log_archive_dest_2 ='SERVICE=whsestby LGWR ASYNC=40960
DB_UNIQUE_name=whsestby OPTIONAL REOPEN=120 MAX_FAILURE=120 NET_TIMEOUT=900'
scope=both;
alter
system set LOG_ARCHIVE_DEST_STATE_1=ENABLE scope=both;
alter
system set LOG_ARCHIVE_DEST_STATE_2=ENABLE scope=both;
alter
system set STANDBY_FILE_MANAGEMENT=AUTO scope=both;
whsestby init file
DB_NAME=whse
DB_UNIQUE_NAME=whsestby
CONTROL_FILES='/whseredo/oradata/control01.ctl','/whseredo/oradata/control02.ctl','/whseredo/oradata/control03.ctl'
LOG_ARCHIVE_DEST_1='LOCATION=/whsearch/arch
VALID_FOR=(ALL_LOGFILES,ALL_ROLES)'
alter
system set FAL_CLIENT=whsestby scope=both;
alter
system set FAL_SERVER=whseprod scope=both;
alter
system set LOG_ARCHIVE_CONFIG='DG_CONFIG=(whseprod, whsestby)' scope=both;
alter
system set log_archive_dest_2 ='SERVICE=whseprod LGWR ASYNC=40960
DB_UNIQUE_name=whseprod OPTIONAL REOPEN=120 MAX_FAILURE=120 NET_TIMEOUT=900'
scope=both;
alter
system set LOG_ARCHIVE_DEST_STATE_1=ENABLE scope=both;
alter
system set LOG_ARCHIVE_DEST_STATE_2=ENABLE scope=both;
alter
system set STANDBY_FILE_MANAGEMENT=AUTO scope=both;
Step 4: Do the restore and recover on standby
database
serverStby> rman target /
RMAN> startup nomount
RMAN> restore
standby controlfile from '/backup/whseprod_restore/c-1778-20171202-02';
serverStby>sqlplus as sysdba
sql> alter database mount standby database;
serverStby> rman target /
RMAN> restore
database
Rman>
list backup of archivelog all
***copied
all of the archives that were created after the backup to the /whsearch/arch
directory from the source
cd to directory that you want
the files to go in on standby system
[oracle@serverStby
..]$ cd /whsearch/arch
[oracle@serverStby /whsesarch/arch]$ ftp serverProd
ftp> bin
ftp> prompt
change
directory on the source system
ftp> cd /whsearch/arch
ftp> mget arch_111_2*
ftp> quit
Rman>
recover database
Step 5: Put the
standby database in recover managed mode
sql>
alter database recover managed standby database disconnect from session;
Database altered.
Verify the Physical
Standby Database Is Performing Properly
On the standby database,
query the V$ARCHIVED_LOG view to identify existing files in
the archived redo log.
sql> select sequence#, applied, to_char(first_time,'mm/dd/yy
hh24:mi:ss') first from v$archived_log order by first_time;
Step 6: Add standby redo logs
sql>alter database recover
managed standby database cancel;
sql>alter database add standby
logfile group 15 '/whseredo/oradata/whse_sr15.log' size 1048576000;
sql>alter database add
standby logfile group 16 '/whseredo/oradata/whse_sr16.log' size 1048576000;
sql>alter database add
standby logfile group 17 '/whseredo/oradata/whse_sr17.log' size 1048576000;
sql>alter database recover
managed standby database disconnect from session;
Step 7: Add Data Guard Broker through OEM
--make sure the standby’s are in oem
--set
preferred credentials by trying to log in through oem
Click on primary
database in OEM
On Home Page
->availability->add standby database
Choose third option
Manage an Existing standby database with data guard broker and follow the
on-screen instructions