Sunday, 24 May 2026

ORACLE DATA GUARD (Broker Configuration Guide)

ORACLE DATA GUARD

Broker Configuration Guide

Step-by-Step Setup & Switchover Procedures

Primary: ORAP  |  Standby: ORAS


1. Pre-Configuration Checks

 

Before configuring the DataGuard Broker, verify the database role and switchover status on both the primary and standby databases.

 

1.1  Query Database Status

Run the following SQL query on both PRIMARY and STANDBY:

 

-- Run on PRIMARY and STANDBY

SELECT DB_UNIQUE_NAME, DATABASE_ROLE, SWITCHOVER_STATUS, OPEN_MODE

FROM V\$DATABASE;

 

ℹ️  Confirm DATABASE_ROLE shows PRIMARY on the primary node and PHYSICAL STANDBY on the standby node before proceeding.

 

2. Enable DataGuard Broker

 

Enable the DataGuard Broker on both the PRIMARY and STANDBY databases by setting the DG_BROKER_START parameter.

 

2.1  Set DG_BROKER_START on Both Nodes

-- Execute on PRIMARY AND STANDBY

ALTER SYSTEM SET DG_BROKER_START=TRUE SCOPE=BOTH;

 

⚠️  Run this command on BOTH servers. Skipping either node will prevent the broker from starting correctly.

 

3. Clear Archive Log Destination on Standby

 

On the standby server (ORAS), clear the LOG_ARCHIVE_DEST_2 parameter. The broker will manage log shipping after configuration.

 

3.1  Clear LOG_ARCHIVE_DEST_2  (Run on STANDBY — ORAS)

-- Run on STANDBY (oras) only

ALTER SYSTEM SET LOG_ARCHIVE_DEST_2='';

 

4. Create DataGuard Broker Configuration

 

Connect to DGMGRL on the PRIMARY server and create the broker configuration.

 

4.1  Connect to DGMGRL on Primary

dgmgrl sys/password as sysdba

 

4.2  Check Existing Configuration

DGMGRL> show configuration;

 

4.3  Create the Broker Configuration

Create a new configuration named 'ora' with the primary database 'orap':

DGMGRL> create configuration 'ora'

           as primary database is 'orap'

           connect identifier is orap;

 

4.4  Add the Standby Database

Add the standby database 'oras' as a Physical Standby:

DGMGRL> add database 'oras'

           as connect identifier is 'oras'

           maintained as physical;

 

4.5  Verify Configuration

DGMGRL> show configuration;

 

5. Set Static Connect Identifiers

 

Set the static connect identifiers for both the primary and standby databases to allow the broker to restart instances if needed.

 

5.1  Primary Database (ORAP) — HOST: WIN19PRIMARY, PORT: 1522

DGMGRL> edit database orap set property

  staticconnectidentifier=

  '(DESCRIPTION=

     (ADDRESS=(PROTOCOL=TCP)(PORT=1522)(HOST=WIN19PRIMARY))

     (CONNECT_DATA=

       (SERVICE_NAME=ora)(INSTANCE_NAME=ora)(SERVER=DEDICATED)

     )

   )';

 

5.2  Standby Database (ORAS) — HOST: WIN19STANDBY, PORT: 1522

DGMGRL> edit database oras set property

  staticconnectidentifier=

  '(DESCRIPTION=

     (ADDRESS=(PROTOCOL=TCP)(PORT=1522)(HOST=WIN19STANDBY))

     (CONNECT_DATA=

       (SERVICE_NAME=ora)(INSTANCE_NAME=ora)(SERVER=DEDICATED)

     )

   )';

 

6. Set Lag Threshold Properties

 

Configure the ApplyLagThreshold and TransportLagThreshold to 0 on both databases to enable alerting on any lag.

 

6.1  Primary Database Properties

DGMGRL> edit database orap set property ApplyLagThreshold=0;

DGMGRL> edit database orap set property TransportLagThreshold=0;

 

6.2  Standby Database Properties

DGMGRL> edit database oras set property ApplyLagThreshold=0;

DGMGRL> edit database oras set property TransportLagThreshold=0;

 

7. Enable Configuration & Verify

 

7.1  Enable the Broker Configuration

DGMGRL> enable configuration;

 

7.2  Verify Configuration Status

DGMGRL> show configuration;

 

ℹ️  The configuration status should show SUCCESS for both databases. If any errors appear, resolve them before proceeding to switchover.

 

8. Perform Switchover

 

Perform a controlled switchover from the primary database (ORAP) to the standby database (ORAS).

 

⚠️  Ensure all application connections are quiesced before performing a switchover in a production environment.

 

8.1  Initiate Switchover to ORAS

DGMGRL> switchover to 'oras';

 

8.2  Verify Roles in SQL*Plus After Switchover

-- Run in SQL*Plus on both nodes

SELECT DB_UNIQUE_NAME, DATABASE_ROLE, SWITCHOVER_STATUS

FROM V\$DATABASE;

 

9. Data Replication Verification

 

After switchover, verify that data replication is working correctly by creating a test table and inserting rows on the new primary.

 

9.1  Create Employee Test Table

DROP TABLE employee;

COMMIT;

 

CREATE TABLE employee (

    emp_id          INT,

    emp_name        VARCHAR2(12),

    date_of_joining TIMESTAMP DEFAULT systimestamp

);

 

9.2  Insert Initial Records

INSERT INTO employee (emp_id, emp_name) VALUES (1, 'Rock');

INSERT INTO employee (emp_id, emp_name) VALUES (2, 'Water');

COMMIT;

 

ALTER SYSTEM CHECKPOINT;

ALTER SYSTEM SWITCH LOGFILE;

ALTER SYSTEM ARCHIVE LOG CURRENT;

 

COLUMN DATE_OF_JOINING FORMAT A30;

SELECT * FROM employee;

 

9.3  Insert Second Batch & Verify

INSERT INTO employee (emp_id, emp_name) VALUES (3, 'Air');

COMMIT;

 

ALTER SYSTEM CHECKPOINT;

ALTER SYSTEM SWITCH LOGFILE;

ALTER SYSTEM ARCHIVE LOG CURRENT;

 

COLUMN DATE_OF_JOINING FORMAT A30;

SELECT * FROM employee;

 

9.4  Insert Third Batch & Verify

INSERT INTO employee (emp_id, emp_name) VALUES (4, 'Stone');

COMMIT;

 

ALTER SYSTEM CHECKPOINT;

ALTER SYSTEM SWITCH LOGFILE;

ALTER SYSTEM ARCHIVE LOG CURRENT;

 

COLUMN DATE_OF_JOINING FORMAT A30;

SELECT * FROM employee;

 

10. Final Status Check

 

Run the following query to get a consolidated view of the database role, switchover status, and host information:

 

10.1  Comprehensive Status Query

COLUMN DB_UNIQUE_NAME    FORMAT A10;

COLUMN DATABASE_ROLE     FORMAT A20;

COLUMN SWITCHOVER_STATUS FORMAT A20;

COLUMN HOST_NAME         FORMAT A15;

COLUMN MACHINE           FORMAT A15;

 

host cls

 

SELECT host_name, db_unique_name, database_role, switchover_status

FROM v\$database, v\$instance;

 

11. Reference Commands

 

ℹ️  The following command is provided for reference only. Use it to start managed recovery on the standby if needed outside of broker management.

 

11.1  Start Managed Standby Recovery (Reference Only)

-- Reference ONLY

ALTER DATABASE RECOVER MANAGED STANDBY DATABASE

    DISCONNECT FROM SESSION;

 

Summary — Configuration Steps

 

Step

Action

Description

1

Pre-Check Database Status

Query V$DATABASE for role, switchover status, and open mode on both nodes.

2

Enable DG Broker

Set DG_BROKER_START=TRUE SCOPE=BOTH on PRIMARY and STANDBY.

3

Clear Archive Dest

Set LOG_ARCHIVE_DEST_2='' on the standby server (ORAS).

4

Create Configuration

Use DGMGRL to create the 'ora' configuration with primary 'orap' and add standby 'oras'.

5

Set Static Connect IDs

Configure staticconnectidentifier property for both ORAP and ORAS.

6

Set Lag Thresholds

Set ApplyLagThreshold and TransportLagThreshold to 0 on both databases.

7

Enable & Verify

Run 'enable configuration' and confirm SUCCESS status.

8

Switchover

Execute switchover to 'oras' and verify database roles in SQL*Plus.

9

Test Replication

Insert rows into the employee table and verify data on standby.

10

Final Status Check

Query v$database and v$instance for host name, role, and switchover status.

 

Saturday, 23 May 2026

ORACLE 19c RAC INSTALLATION GUIDE

                                           ORACLE 19c RAC

INSTALLATION GUIDE

With Real Installation Screenshots

Grid Infrastructure  •  ASM Disk  •  DNS/SCAN  •  Oracle Database

1. GRID INFRASTRUCTURE INSTALLATION

 

Steps 1–5: OS Installation, Network, Firewall & Oracle Pre-install

S.NO

STEPS / COMMANDS

DESCRIPTION

1

OEL 7.9 Installation

Install Oracle Enterprise Linux 7.9 on Node1 and Node2.

2

Configure: PUBLIC / PRIVATE / INTERNET

Set up three NICs: Public (SSH), Private (RAC interconnect), Internet.

3

systemctl stop firewalld

systemctl disable firewalld

Disable firewall permanently on both nodes.

4

yum install -y oracle-database-preinstall-19c

Installs Oracle user, sets kernel params, installs dependency packages.

5

passwd oracle

Set password for oracle OS user.

 

Figure: Steps 4–5: oracle-database-preinstall-19c installation & oracle password setup

Steps 6–12: ASM Packages, Groups & Users

S.NO

STEPS / COMMANDS

DESCRIPTION

6

yum install -y oracleasm-support

rpm -qa | grep oracleasm-support

oracleasm-support: tools to configure/manage ASM devices and init scripts.

7

yum install -y kmod-oracleasm

Kernel module for Oracle ASM. Provides oracleasm configure/init/scandisks.

8

groupadd asmadmin

ASM admin group: SYSASM, start/stop ASM, create/drop disk groups.

9

groupadd asmdba

ASM DBA group: database instances access ASM disks.

10

useradd -u 54323 -g oinstall -G asmadmin,asmdba grid

Create GRID user with UID 54323 for cluster-wide consistency.

11

getent group asmadmin

# asmadmin:x:54331:grid

Verify groups created and grid user is a member.

12

passwd grid

Set password for GRID OS user.

 


Figure: Steps 8–12: Creating asmadmin/asmdba groups, grid user, oracle user group assignments

Steps 13–19: User Permissions, Directories, .bash_profile & ASMLib

S.NO

STEPS / COMMANDS

DESCRIPTION

13

usermod -a -G asmdba oracle

usermod -G backupdba,dba,oinstall,racdba,kmdba,dgdba,oper oracle

Add oracle to all required OS groups for full DBA privileges.

14

mkdir -p /u01/app/oracle/product/19C/dbhome

chown -R oracle:oinstall /u01

chmod -R 775 /u01

mkdir -p /u02/app/grid/product/19C/dbhome

chown -R grid:oinstall /u02

chmod -R 775 /u02

Create ORACLE_HOME & GRID_HOME, set ownership and 775 permissions.

16

# GRID .bash_profile:

export ORACLE_BASE=/u02/app/gridbase

export ORACLE_HOME=/u02/app/grid/product/19C/dbhome

export ORACLE_SID=+ASM1

source .bash_profile

Grid user env: ORACLE_HOME → Grid home, SID → +ASM1 (ASM instance).

17

# ORACLE .bash_profile:

export ORACLE_BASE=/u01/app/oraclebase/

export ORACLE_HOME=/u01/app/oracle/product/19C/dbhome

export ORACLE_SID=prim1

source .bash_profile

Oracle user env: ORACLE_HOME → DB home, SID → prim1.

18

oracleasm configure -I

# User: grid | Group: oinstall

# Start on boot: y | Scan on boot: y

Configure ASMLib driver owner, group and boot settings.

19

/usr/sbin/oracleasm init

# Mounts /dev/oracleasm filesystem

Initialize and mount Oracle ASMLib driver filesystem.

 

2. ASM DISK CONFIGURATION

 

S.NO

STEPS / COMMANDS

DESCRIPTION

20

SHUT DOWN NODE1 & NODE2

Power off both VMs before adding shared disks.

21

VirtualBox > File > Virtual Media Manager > SHAREABLE

Mark each data disk as Shareable so both nodes can attach it.

22

fdisk -l

# sda:100G sdb:10G sdc:10G sdd:10G

# sde:5G  sdf:5G  sdg:5G

List disks to confirm 6 shared disks are visible.

23

fdisk /dev/sdb → n → p → [Enter]×3 → w

# Repeat for sdc, sdd, sde, sdf, sdg

Create one primary partition on each data disk.

24

oracleasm createdisk DISK1 /dev/sdb1

oracleasm createdisk DISK2 /dev/sdc1

... (DISK3–DISK6)

oracleasm listdisks  # shows DISK1–DISK6

Label each partition as an ASM disk.

25

cd /dev/oracleasm/disks/ && ll

# brw-rw---- 1 grid oinstall DISK1–6

Verify ASM disk ownership under /dev/oracleasm/disks/.

26

POWEROFF NODE1 > ATTACH DISKS TO NODE2 > START NODE2

Attach Node1 shared disks to Node2 in VirtualBox.

27

oracleasm listdisks   # on node2

# If missing: oracleasm scandisks

Verify all 6 ASM disks visible on Node2.

 


Figure: Steps 18–24: ASMLib configure/init, createdisk and listdisks output

3. DNS & SCAN CONFIGURATION

 

S.NO

STEPS / COMMANDS

DESCRIPTION

28

vi /etc/hosts  # on BOTH nodes

# Public: 192.168.56.71/72

# Private: 192.168.10.1/2

# VIP: 192.168.56.81/82

# SCAN: 192.168.56.91/92/93

Configure /etc/hosts with all 4 IP types on both nodes.

29

yum install dnsmasq

chkconfig dnsmasq on

vi /etc/resolv.conf

  nameserver 127.0.0.1

  search homelab.org

  nameserver 8.8.8.8

Install dnsmasq and set nameserver to localhost so SCAN IPs resolve.

30

vi /etc/scanipaddress

192.168.56.91/92/93  node-scan.homelab.org

Document all 3 SCAN IPs.

31

vi /etc/dnsmasq.conf

address=/node-scan.homelab.org/192.168.56.91

address=/node-scan.homelab.org/192.168.56.92

address=/node-scan.homelab.org/192.168.56.93

Configure dnsmasq to resolve SCAN to all 3 IPs.

32

chattr +i /etc/resolv.conf

Lock resolv.conf against accidental DHCP overwrite.

33

service dnsmasq restart

Restart dnsmasq to apply configuration.

34

reboot

Reboot both nodes to apply all changes.

35

nslookup node-scan

# Returns: 192.168.56.91/92/93

Verify SCAN resolution returns all 3 IPs.

 


Figure: Steps 28–35: /etc/hosts configuration and nslookup SCAN verification

4. GRID SOFTWARE & CLUSTER SETUP

 

S.NO

STEPS / COMMANDS

DESCRIPTION

36

ip addr show | grep inet

ip link set enp0s9 up

Verify all 3 network interfaces are UP on both nodes.

37

unzip LINUX.X64_193000_grid_home.zip -d $ORACLE_HOME

Upload and unzip Grid Infrastructure software as grid user.

38

export CV_ASSUME_DISTID=OL8

Bypass OEL7/OL8 compatibility check.

39

vi /etc/ssh/sshd_config

  PermitRootLogin yes

  UseDNS no

Enable root SSH login and disable DNS lookup for SSH.

40

./sshUserSetup.sh -user grid -hosts "node1 node2"

  -noPromptPassphrase -confirm -advance

Set up passwordless SSH for grid user between both nodes.

41

./runcluvfy.sh stage -pre crsinst

  -n node1,node2 -verbose

Run Cluster Verification Utility – must pass all checks.

42

# SSH error workaround:

mv /usr/bin/scp /usr/bin/scp.orig

echo '/usr/bin/scp.orig -T $*' > /usr/bin/scp

chmod 755 /usr/bin/scp

Fix for scp protocol errors during installation.

43

rpm -ivh cvuqdisk-1.0.10-1.rpm  # node1

scp cvuqdisk... root@node2:/tmp

rpm -ivh cvuqdisk...  # node2

Install cvuqdisk on BOTH nodes.

44

systemctl status chronyd

systemctl enable chronyd

systemctl start chronyd

Ensure time sync (chrony/NTP) running on both nodes.

45

export CV_ASSUME_DISTID=OL8

Re-export before launching gridSetup.

46

cd $ORACLE_HOME

./gridSetup.sh

Launch Grid Infrastructure installer GUI.

 



Figure: Steps 40–41: Passwordless SSH setup for grid user and cluvfy pre-check passing

Grid Infrastructure Installer Wizard (./gridSetup.sh)


Figure: gridSetup.sh Step 1: Select 'Configure Oracle Grid Infrastructure for a New Cluster'


Figure: gridSetup.sh Step 2: Select 'Configure an Oracle Standalone Cluster'


Figure: gridSetup.sh Step 3: Cluster Name 'homelab-cluster' and SCAN name 'node-scan.homelab.org'


Figure: gridSetup.sh Step 7: ASM Disk Group 'DATA' – select DISK1, DISK2, DISK3

Running root.sh after Grid Installation


Figure: Step 46 (post): Running orainstRoot.sh and root.sh as root on Node1 – Clusterware stack started

5. ORACLE DATABASE INSTALLATION

 

S.NO

STEPS / COMMANDS

DESCRIPTION

47

unzip LINUX.X64_193000_db_home.zip -d $ORACLE_HOME

Upload Oracle 19c Database software and unzip to ORACLE_HOME.

48

./sshUserSetup.sh -user oracle -hosts "node1 node2"

  -noPromptPassphrase -confirm -advance

Set up passwordless SSH for oracle user between both nodes.

49

./runInstaller

Launch Oracle Database installer GUI. Select RAC, use ASM storage.

50

dbca

Create RAC database using DBCA wizard. Set SID prefix, passwords, character set.

 


Figure: Steps 47–49: Oracle DB software unzip, SSH setup and runInstaller with root.sh


Figure: Step 50: DBCA – Creating Oracle 19c RAC database (prim1/prim2) on ASM storage

TROUBLESHOOTING: SSH CONNECTION ISSUES

 

Recreate id_rsa Key Pair

cd ~/.ssh

ssh-copy-id -i ~/.ssh/id_rsa.pub grid@node1

ssh -i ~/.ssh/id_rsa grid@node1

Fix Permissions

chmod 600 ~/.ssh/id_rsa

chmod 700 ~/.ssh

chmod 600 ~/.ssh/authorized_keys

Backup & Clean Old Keys

cp ~/.ssh/authorized_keys ~/.ssh/authorized_keys.bak

> ~/.ssh/authorized_keys

Verify & Test SSH

ssh node1 date

ssh node2 date

ssh -o BatchMode=yes grid@node2 echo 'SSH OK'

Copy Fresh Keys from BOTH Nodes (grid user)

On node1:

ssh-copy-id -i ~/.ssh/id_rsa.pub grid@node1

ssh-copy-id -i ~/.ssh/id_rsa.pub grid@node2

On node2:

ssh-copy-id -i ~/.ssh/id_rsa.pub grid@node1

ssh-copy-id -i ~/.ssh/id_rsa.pub grid@node2