How to Build a Real‑Time Data Guard System for Dameng Database
This guide walks through setting up a Dameng data‑guard service using a primary, standby, and monitor server, covering data preparation, configuration of dm.ini, dmmal.ini, dmarch.ini, dmwatcher.ini, starting services, OGUID setup, mode switching, and monitoring to achieve high‑availability replication.
Introduction
In certain work scenarios the Dameng database data‑guard feature may be required; this article explains how to build the Dameng data‑guard service.
Environment
The setup uses three machines: one primary, one standby, and one monitor. Primary and standby databases must be initialized beforehand.
1. Data Preparation
Ensure primary and standby data stay consistent using the dmrman offline backup/restore method. Stop the primary and perform a full RMAN backup.
./dmrman CTLSTMT="BACKUP DATABASE '/dm8/data/DMDW/dm.ini' FULL TO BACKUP_FILE1 BACKUPSET '/dm8/backup/BACKUP_FILE_01'"2. Primary Configuration Files
dm.ini
INSTANCE_NAME = GRP1_RT_01
PORT_NUM = 32141 # Database instance listening port
DW_INACTIVE_INTERVAL = 60 # Guard message timeout
ALTER_MODE_STATUS = 0 # Disallow manual mode/status/OGUID changes
ENABLE_OFFLINE_TS = 2 # Disallow standby OFFLINE tablespace
MAL_INI = 1 # Enable MAL system
ARCH_INI = 1 # Enable archive configuration
RLOG_SEND_APPLY_MON = 64 # Log send statisticsdmmal.ini
MAL_CHECK_INTERVAL = 5 # MAL link check interval
MAL_CONN_FAIL_INTERVAL = 5 # MAL link failure interval
[MAL_INST1]
MAL_INST_NAME = GRP1_RT_01 # Same as INSTANCE_NAME in dm.ini
MAL_HOST = 192.168.0.141 # MAL system IP
MAL_PORT = 61141 # MAL system port
MAL_INST_HOST = 192.168.1.131 # External service IP
MAL_INST_PORT = 32141 # External service port (same as PORT_NUM)
MAL_DW_PORT = 52141 # Guard process listening port
MAL_INST_DW_PORT = 33141 # Guard process TCP port
[MAL_INST2]
MAL_INST_NAME = GRP1_RT_02
MAL_HOST = 192.168.0.142
MAL_PORT = 61142
MAL_INST_HOST = 192.168.1.132
MAL_INST_PORT = 32142
MAL_DW_PORT = 52142
MAL_INST_DW_PORT = 33142dmarch.ini
[ARCHIVE_REALTIME]
ARCH_TYPE = REALTIME # Real‑time archive type
ARCH_DEST = GRP1_RT_02 # Destination instance for real‑time archive
[ARCHIVE_LOCAL1]
ARCH_TYPE = LOCAL # Local archive type
ARCH_DEST = /dm/data/DAMENG/arch # Local archive path
ARCH_FILE_SIZE = 128 # Max file size (MB)
ARCH_SPACE_LIMIT = 0 # No space limitdmwatcher.ini
[GRP1]
DW_TYPE = GLOBAL # Global guard type
DW_MODE = AUTO # Automatic switch mode
DW_ERROR_TIME = 10 # Remote guard fault detection time
INST_RECOVER_TIME = 60 # Primary guard restart interval
INST_ERROR_TIME = 10 # Local instance fault detection time
INST_OGUID = 453331 # Unique OGUID for the guard system
INST_INI = /dm/data/DAMENG/dm.ini # Path to dm.ini
INST_AUTO_RESTART = 1 # Enable auto‑restart
INST_STARTUP_CMD = /dm/bin/dmserver # Startup command
RLOG_SEND_THRESHOLD = 0 # Primary log send threshold (disabled)
RLOG_APPLY_THRESHOLD = 0 # Standby log apply threshold (disabled)3. Start Primary
./dmserver /dm/data/DAMENG/dm.ini mount4. Set OGUID on Primary
SP_SET_PARA_VALUE(1, 'ALTER_MODE_STATUS', 1);
sp_set_oguid(453331);
SP_SET_PARA_VALUE(1, 'ALTER_MODE_STATUS', 0);5. Change Primary Mode
alter database primary;6. Standby Configuration Files
dm.ini (standby)
INSTANCE_NAME = GRP1_RT_02
PORT_NUM = 32142 # Database instance listening port
DW_INACTIVE_INTERVAL = 60
ALTER_MODE_STATUS = 0
ENABLE_OFFLINE_TS = 2
MAL_INI = 1
ARCH_INI = 1
RLOG_SEND_APPLY_MON = 64dmmal.ini (standby)
MAL_CHECK_INTERVAL = 5
MAL_CONN_FAIL_INTERVAL = 5
[MAL_INST1]
MAL_INST_NAME = GRP1_RT_01
MAL_HOST = 192.168.0.141
MAL_PORT = 61141
MAL_INST_HOST = 192.168.1.131
MAL_INST_PORT = 32141
MAL_DW_PORT = 52141
MAL_INST_DW_PORT = 33141
[MAL_INST2]
MAL_INST_NAME = GRP1_RT_02
MAL_HOST = 192.168.0.142
MAL_PORT = 61142
MAL_INST_HOST = 192.168.1.132
MAL_INST_PORT = 32142
MAL_DW_PORT = 52142
MAL_INST_DW_PORT = 33142dmarch.ini (standby)
[ARCHIVE_REALTIME]
ARCH_TYPE = REALTIME
ARCH_DEST = GRP1_RT_01 # Real‑time archive target (primary)
[ARCHIVE_LOCAL1]
ARCH_TYPE = LOCAL
ARCH_DEST = /dm/data/DAMENG/arch
ARCH_FILE_SIZE = 128
ARCH_SPACE_LIMIT = 0dmwatcher.ini (standby)
[GRP1]
DW_TYPE = GLOBAL
DW_MODE = AUTO
DW_ERROR_TIME = 10
INST_RECOVER_TIME = 60
INST_ERROR_TIME = 10
INST_OGUID = 453331
INST_INI = /dm/data/DAMENG/dm.ini
INST_AUTO_RESTART = 1
INST_STARTUP_CMD = /dm/bin/dmserver
RLOG_APPLY_THRESHOLD = 07. Start Standby
./dmserver /dm/data/DAMENG/dm.ini mount8. Set OGUID on Standby
SP_SET_PARA_VALUE(1, 'ALTER_MODE_STATUS', 1);
sp_set_oguid(453331);
SP_SET_PARA_VALUE(1, 'ALTER_MODE_STATUS', 0);9. Change Standby Mode
SP_SET_PARA_VALUE(1, 'ALTER_MODE_STATUS', 1);
alter database standby;
SP_SET_PARA_VALUE(1, 'ALTER_MODE_STATUS', 0);10. Monitor Configuration
MON_DW_CONFIRM = 1 # Confirmation monitor mode
MON_LOG_PATH = /dm/data/log
MON_LOG_INTERVAL = 60
MON_LOG_FILE_SIZE = 32
MON_LOG_SPACE_LIMIT = 0
[GRP1]
MON_INST_OGUID = 453331
MON_DW_IP = 192.168.0.141:52141
MON_DW_IP = 192.168.0.142:5214211. Start Guard Processes
./dmwatcher /dm/data/DAMENG/dmwatcher.ini
./dmmonitor /dm/data/dmmonitor.iniResult
When all steps and configurations are correct, the primary‑standby real‑time data‑guard system is operational; the show command on the monitor displays all instances and guard processes in the Open state, indicating normal operation.
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
MaGe Linux Operations
Founded in 2009, MaGe Education is a top Chinese high‑end IT training brand. Its graduates earn 12K+ RMB salaries, and the school has trained tens of thousands of students. It offers high‑pay courses in Linux cloud operations, Python full‑stack, automation, data analysis, AI, and Go high‑concurrency architecture. Thanks to quality courses and a solid reputation, it has talent partnerships with numerous internet firms.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
