Data Guard Physical Standby Setup Using the Data Guard Broker in Oracle Database 19c

Assumptions

  • You have two servers (physical or VMs) with an operating system and Oracle installed on them. In this case I've used Oracle Linux 7.6 and Oracle Database 19c.
  • The primary server (ol7-19-dg1.locadomain) has a running instance.
  • The standby server (ol7-19-dg2.locadomain) has a software only installation.
  • There is nothing blocking communication between the machines over the listener ports. If you are using the default 1521 port, node 1 should be able to communicate to node 2 on 1521 and node 2 should be able communicate with node 1 on 1521. Check network and local firewalls are not blocking the communication.

Primary Server Setup

Logging

Check that the primary database is in archivelog mode.

select log_mode from v$database;

LOG_MODE
------------
NOARCHIVELOG

SQL>

If it is noarchivelog mode, switch is to archivelog mode.

shutdown immediate;
startup mount;
alter database archivelog;
alter database open;

Enabled forced logging by issuing the following command.

alter database force logging;
-- Make sure at least one logfile is present.
alter system switch logfile;

Create standby redo logs on the primary database (in case of switchovers). The standby redo logs should be at least as big as the largest online redo log and there should be one extra group per thread compared the online redo logs. In my case, the following standby redo logs must be created on both servers.

-- If Oracle Managed Files (OMF) is used.
alter database add standby logfile thread 1 group 10 size 50m;
alter database add standby logfile thread 1 group 11 size 50m;
alter database add standby logfile thread 1 group 12 size 50m;
alter database add standby logfile thread 1 group 13 size 50m;

-- If Oracle Managed Files (OMF) is not used.
alter database add standby logfile thread 1 group 10 ('/u01/oradata/cdb1/standby_redo01.log') size 50m;
alter database add standby logfile thread 1 group 11 ('/u01/oradata/cdb1/standby_redo02.log') size 50m;
alter database add standby logfile thread 1 group 12 ('/u01/oradata/cdb1/standby_redo03.log') size 50m;
alter database add standby logfile thread 1 group 13 ('/u01/oradata/cdb1/standby_redo04.log') size 50m;

If you want to use flashback database, enable it on the primary now, so it will be enabled on the standby also. It's very useful as you will see below.

alter database flashback on;

Initialization Parameters

Check the setting for the DB_NAME and DB_UNIQUE_NAME parameters. In this case they are both set to "cdb1" on the primary database.

SQL> show parameter db_name

NAME				     TYPE	 VALUE
------------------------------------ ----------- ------------------------------
db_name 			     string	 cdb1

SQL> show parameter db_unique_name

NAME				     TYPE	 VALUE
------------------------------------ ----------- ------------------------------
db_unique_name			     string	 cdb1

SQL>

The DB_NAME of the standby database will be the same as that of the primary, but it must have a different DB_UNIQUE_NAME value. For this example, the standby database will have the value "cdb1_stby".

Make sure the STANDBY_FILE_MANAGEMENT parameter is set.

alter system set standby_file_management=auto;

Service Setup

Entries for the primary and standby databases are needed in the "$ORACLE_HOME/network/admin/tnsnames.ora" files on both servers. You can create these using the Network Configuration Utility (netca) or manually. The following entries were used during this setup. Notice the use of the SID, rather than the SERVICE_NAME in the entries. This is important as the broker will need to connect to the databases when they are down, so the services will not be present.

cdb1 =
  (DESCRIPTION =
    (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = TCP)(HOST = ol7-19-dg1)(PORT = 1521))
    )
    (CONNECT_DATA =
      (SID = cdb1)
    )
  )

cdb1_stby =
  (DESCRIPTION =
 
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

沉淀的羽毛

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值