Oracle DataGuard Physical Standby Installation Step by Step Using RMAN -2

Hi,

I will continue to explain Oracle DataGuard Physical Standby Step by Step Installation in this article.

 

Oracle DataGuard Physical Standby Installation

Read first installation article before this.

Oracle DataGuard Physical Standby Installation Step by Step Using RMAN -1

 

 

Oracle DataGuard Installation Using RMAN

 

Some requirements and tasks are performed on Primary Side in the first article. Now We need to perform similar tasks on Standby Side.

An Oracle Software must be installed on the standby database server, which versions will be the same as the Primary database and also Patchset versions. (Database must not be created with DBCA and  If your primary database is 12.1.0.2, it must be 12.1.0.2 for Standby database)

 

You can install Oracle 12c on Standby Server if you don’t know how to install it with following article.

Oracle Database 12c Step by Step Installation On Linux -3

 

 

Physical Standby Installation Using RMAN

Following Tasks are performed on Standby Server.

 

1- If DNS Server is not existed, both hostnames’ and IPs’ should be in their /etc/hosts file. Configure Listener.ora and tnsnames.ora like following to configure listener.

[oracle@test01 ~]$ cat /etc/hosts
192.168.56.75 test01 test01.localdomain
192.168.56.76 test02 test02.localdomain

[oracle@test02 ~]$ cat /etc/hosts
192.168.56.75 test01 test01.localdomain
192.168.56.76 test02 test02.localdomain


[oracle@test02 admin]$ vi listener.ora
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
(ADDRESS = (PROTOCOL = TCP)(HOST = test02)(PORT = 1521))
)
)

ADR_BASE_LISTENER = /u01/app/oracle

ENABLE_GLOBAL_DYNAMIC_ENDPOINT_LISTENER=ON # line added by Agent

lsnrctl stop
lsnrctl start

ORCL =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = test01.localdomain)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = ORCL)
)
)

ORCLDG =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = test02.localdomain)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = ORCLDG)
)
)


Following tnsping should be OK to run Dataguard properly.
tnsping ORCLDG
tnsping ORCL


2- In this step, You can startup oracle database with following parameters in the pfile.

[oracle@test02 ~]$ vi pfile.ora
TEST.__db_cache_size=293601280
TEST.__java_pool_size=4194304
TEST.__large_pool_size=4194304
TEST.__pga_aggregate_target=339738624
TEST.__sga_target=503316480
TEST.__shared_io_pool_size=0
TEST.__shared_pool_size=192937984
TEST.__streams_pool_size=0
*.audit_file_dest='/u01/app/oracle/admin/ORCLDG/adump'
*.audit_trail='db'
*.compatible='11.2.0.0.0'
*.control_files='/u01/app/oracle/ORCLDG/control01.ctl'
*.db_block_size=8192
*.db_domain=''
*.db_name='ORCL'
*.db_unique_name='ORCLDG'
*.diagnostic_dest='/u01/app/oracle'
*.dispatchers='(PROTOCOL=TCP) (SERVICE=TESTXDB)'
*.memory_target=839909376
*.open_cursors=300
*.processes=150
*.recyclebin='OFF'
*.remote_login_passwordfile='EXCLUSIVE'
*.undo_tablespace='UNDOTBS1'


3- Create related directories on Linux like following.

[oracle@test02 adump]$ mkdir -p /u01/app/oracle/ORCLDG
[oracle@test02 ~]$ mkdir -p /u01/app/oracle/admin/ORCLDG/adump

 

 

4- After setting bash profile through the server, we are starting Oracle Instance in nomount mode.

 

[oracle@test02 ~]$ vi .bash_profile

# .bash_profile
export PATH
export ORACLE_HOME=/u01/app/oracle/product/11.2.0/dbhome
export PATH=$ORACLE_HOME/bin:$ORACLE_HOME/OPatch:$PATH
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:$ORACLE_HOME/lib32
export LIBPATH=$ORACLE_HOME/lib:$ORACLE_HOME/lib32
export ORACLE_SID=ORCLDG
export NLS_LANG=AMERICAN_AMERICA.WE8ISO8859P9

 

Start up Oracle database in nomount mode.

[oracle@test02 ~]$ sqlplus / as sysdba
SQL> startup nomount pfile='pfile.ora';

 

 

5- Following scripts have to execute on Standby Side to modify some dataguard parameters

alter system set LOG_ARCHIVE_CONFIG='DG_CONFIG=(ORCL,ORCLDG)' scope=BOTH;
alter system set LOG_ARCHIVE_DEST_2='SERVICE=ORCL LGWR ASYNC VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=ORCL' scope=BOTH;
alter system set LOG_ARCHIVE_DEST_STATE_2=ENABLE scope=BOTH;
alter system set FAL_SERVER=ORCL scope=BOTH;
alter system set FAL_CLIENT=ORCLDG scope=BOTH;
ALTER SYSTEM SET LOG_ARCHIVE_FORMAT='%t_%s_%r.arc' SCOPE=SPFILE;
ALTER SYSTEM SET LOG_ARCHIVE_MAX_PROCESSES=30 scope=BOTH;
ALTER SYSTEM SET REMOTE_LOGIN_PASSWORDFILE=EXCLUSIVE SCOPE=BOTH;


6- Restore Standby Controlfile and database like following.

 

[oracle@test02 ~]$ rman target /
RMAN> restore standby controlfile from '/u01/oracle/backup/standbycontrol.ctl';


Switch database into mount mode.

RMAN> alter database mount;



Run catalog command to register backups into new controlfile. If you don't catalog it,
 it does not identify backups and you will get No backup founds errors.

RMAN> catalog start with '/u01/oracle/backup/';



Restore Standby database from backup like following.

RMAN> connect target /
run{
ALLOCATE CHANNEL CH1 DEVICE TYPE DISK;
ALLOCATE CHANNEL CH2 DEVICE TYPE DISK;
ALLOCATE CHANNEL CH3 DEVICE TYPE DISK;
ALLOCATE CHANNEL CH4 DEVICE TYPE DISK;
ALLOCATE CHANNEL CH5 DEVICE TYPE DISK;
ALLOCATE CHANNEL CH6 DEVICE TYPE DISK;
ALLOCATE CHANNEL CH7 DEVICE TYPE DISK;
ALLOCATE CHANNEL CH8 DEVICE TYPE DISK;
restore database;
RELEASE CHANNEL CH1;
RELEASE CHANNEL CH2;
RELEASE CHANNEL CH3;
RELEASE CHANNEL CH4;
RELEASE CHANNEL CH5;
RELEASE CHANNEL CH6;
RELEASE CHANNEL CH7;
RELEASE CHANNEL CH8;
}


7- Add Standby logfile to apply and run realtime dataguard.

alter database add standby logfile group 4 '/u01/app/oracle/ORCLDG/standby01.log' size 20737418;
alter database add standby logfile group 5 '/u01/app/oracle/ORCLDG/standby02.log' size 20737418;
alter database add standby logfile group 6 '/u01/app/oracle/ORCLDG/standby03.log' size 20737418;
alter database add standby logfile group 7 '/u01/app/oracle/ORCLDG/standby04.log' size 20737418;
alter database add standby logfile group 8 '/u01/app/oracle/ORCLDG/standby05.log' size 20737418;

 

8- After Restore is finished,  connect to the Standby database and start the process of the MRP (Managed Recovery Process) and start applying of Redologs to the standby like following.

 

SQL> ALTER DATABASE RECOVER MANAGED STANDBY DATABASE USING CURRENT LOGFILE DISCONNECT FROM SESSION;

 

After starting MRP process, we can start monitoring of dataguard like following.

 

select process, client_process,thread#,sequence#,status from v$managed_standby;


You can check Dataguard lag with following script.

select name,value from v$dataguard_stats;


 

 

 

Read the following articles for monitoring dataguard in detail.

 

 

You can read other Dataguard installation via Duplicate method like following.

Oracle DataGuard Step by Step Installation with RMAN Duplicate Method -1

 

 

 

 

Do you want to learn Oracle Database for Beginners, then read the following articles.

Oracle Tutorial | Oracle Database Tutorials for Beginners ( Junior Oracle DBA )

About Mehmet Salih Deveci

I am Founder of SysDBASoft IT and IT Tutorial and Certified Expert about Oracle & SQL Server database, Goldengate, Exadata Machine, Oracle Database Appliance administrator with 10+years experience.I have OCA, OCP, OCE RAC Expert Certificates I have worked 100+ Banking, Insurance, Finance, Telco and etc. clients as a Consultant, Insource or Outsource.I have done 200+ Operations in this clients such as Exadata Installation & PoC & Migration & Upgrade, Oracle & SQL Server Database Upgrade, Oracle RAC Installation, SQL Server AlwaysOn Installation, Database Migration, Disaster Recovery, Backup Restore, Performance Tuning, Periodic Healthchecks.I have done 2000+ Table replication with Goldengate or SQL Server Replication tool for DWH Databases in many clients.If you need Oracle DBA, SQL Server DBA, APPS DBA,  Exadata, Goldengate, EBS Consultancy and Training you can send my email adress [email protected].-                                                                                                                                                                                                                                                 -Oracle DBA, SQL Server DBA, APPS DBA,  Exadata, Goldengate, EBS ve linux Danışmanlık ve Eğitim için  [email protected] a mail atabilirsiniz.

Leave a Reply

Your email address will not be published. Required fields are marked *