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

Hi,

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

 

Before Dataguard Installation, read following article to understand Architecture of Dataguard.

 

With Oracle DataGuard technology, we can create Physical and Logical Standby for our databases for providing disaster recovery . I will explain the most used Physical Standby configuration and setup in Oracle 12c, Oracle 18c database on Linux server.

 

Before starting installation, I will use db_name ORCL for my Primary database. The name of the Physical Standby database will be ORCLDG.  I will proceed step by step through the configuration and installation.

Requirements

1- 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)

2- A Listener must be created on the standby database server that will listen to the physical standby that will be created by NETCA with Oracle Software.

 

3- The primary database must be in Archivelog mode. For detailed information about Archivelog mode, please read the following article. You can find out whether the database is in archive mode with the following query.

 

 

SELECT log_mode FROM v$database;

LOG_MODE
------------
ARCHIVELOG

SQL>

 

 

4- All changes namely transactions (except TEMP Tablespace) running in the primary database must be logged and applied to the Standby. The following command must be run in Primary so that all changes and transactions in the primary database will be logged.

 

SQL> alter database force logging;

Database altered.

 

 

5- If DNS Server is not existed, both hostnames’ and IPs’ should be in their /etc/hosts file.

[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

6- Following scripts have to execute on Primary Side.

alter system set LOG_ARCHIVE_CONFIG='DG_CONFIG=(ORCL,ORCLDG)' scope=BOTH;
alter system set LOG_ARCHIVE_DEST_2='SERVICE=ORCLDG LGWR ASYNC VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=ORCLDG' scope=BOTH;
alter system set LOG_ARCHIVE_DEST_STATE_2=ENABLE scope=BOTH;
alter system set FAL_SERVER=ORCLDG scope=BOTH;
alter system set FAL_CLIENT=ORCL 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;

 

After making the following parameter change, the database must be closed and opened due to static parameters. Those who do not know how to close or open the database can read the following article.

 

 

7- Take full backup like following and transfer these backup files to the Standby Server.

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;
BACKUP AS COMPRESSED BACKUPSET DATABASE FORMAT '/u01/oracle/backup/FULL_%d_%u_%s_%T.bkp';
BACKUP AS COMPRESSED BACKUPSET ARCHIVELOG ALL not backed up 1 times FORMAT '/u01/oracle/backup/Archivelogs_%d_%u_%s_%T.bkp';
BACKUP CURRENT CONTROLFILE FORMAT '/u01/oracle/backup/CONTROLFILE%d_%u_%s_%T.bkp';
RELEASE CHANNEL CH1;
RELEASE CHANNEL CH2;
RELEASE CHANNEL CH3;
RELEASE CHANNEL CH4;
RELEASE CHANNEL CH5;
RELEASE CHANNEL CH6;
RELEASE CHANNEL CH7;
RELEASE CHANNEL CH8;
}

[oracle@test01 backup]$ scp * oracle@test02:/u01/oracle/backup/

 

8- Create PFILE, Standby Controlfile and Password File for Standby and Transfer these files to the Standby Server like following.

create pfile='/home/oracle/pfile.ora' from spfile;
alter database create standby controlfile as '/u01/oracle/backup/standbycontrol.ctl';

[oracle@test01 ~]$ scp pfile.ora oracle@test02:/home/oracle/
[oracle@test01 ~]$ scp /u01/oracle/backup/standbycontrol.ctl oracle@test02:/u01/oracle/backup/standbycontrol.ctl

[oracle@test01 ~]$ scp orapwORCL oracle@test02:/u01/app/oracle/product/11.2.0/dbhome/dbs/orapwORCLDG

 

9- Add Primary and Standby TNS aliases and TNS informations into tnsnames.ora under $ORACLE_HOME/network/admin directory like following.

 

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)
)
)


Test these TNS Aliases like following.

tnsping ORCLDG 

tnsping ORCL

 

 

Check Sys connection and Passwordfile existence like following.

 sqlplus /nolog 

SQL> connect sys/oracle@ORCLDG as sysdba 

Connected.

 SQL> connect sys/oracle@ORCL as sysdba

 Connected.

 

 

 

I will continue to explain Dataguard installation in the next article.

 

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

 


Mehmet Salih Deveci

I am Founder of 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 mehmetsalih.deveci@outlook.com.-                                                                                                                                                                                                                                                 -Oracle DBA, SQL Server DBA, APPS DBA,  Exadata, Goldengate, EBS ve linux Danışmanlık ve Eğitim için  mehmetsalih.deveci@outlook.com a mail atabilirsiniz.

Leave a Reply

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