達夢資料庫主備實時叢集搭建和維護
一 :環境說明
1.1 硬體需求
至少需要三臺伺服器, 1 主、 1 從、 1 監視器,由於資源有限,將監視器安裝在主庫機器上,本次實驗使用 2 臺虛擬機器。
1.2 網路需求
心跳 IP 和外部 IP 不同網段,本次實驗沒有單獨配置,和外部 IP 相同。
1.3 注意事項
在搭建資料守護系統前,應注意資料守護系統中各例項使用的 DM 伺服器版本應一致,同時還應注意各例項所在主機的作業系統位數、大小端模式、時區及時間設定都應一致,以及使用同一個使用者啟動 DM 伺服器和守護程式 dmwatcher ,以免系統在執行時出現意想不到的錯誤。
|
主庫 |
備庫 |
監視庫 |
主機名 |
cjc-db-03 |
cjc-db-04 |
cjc-db-03 |
物理 IP |
172.16.6.101 |
172.16.6.102 |
172.16.6.101 |
心跳 IP |
172.16.6.101 |
172.16.6.102 |
172.16.6.101 |
資料庫埠 |
5238 |
5238 |
5238 |
MAL_INST_DW_PORT |
33141 |
33142 |
不涉及 |
MAL_PORT |
61141 |
61142 |
|
MAL_DW_PORT |
52141 |
52142 |
|
DBNAME |
CHEN |
CJC |
|
資料庫版本 |
V8 |
V8 |
|
參考:
https://eco.dameng.com/document/dm/zh-cn/pm/data-guard-construction.html
二:環境準備
配置資料守護 V4.0 之前,必須先透過備份還原方式同步各資料庫的資料,確保各資料的資料保持完全一致。主庫可以是新初始化的資料庫,也可以是正在生產、使用中的資料庫。
不能使用分別初始化庫或者直接複製資料檔案的方法,原因如下:
1. 每個庫都有一個永久魔數( permenant_magic ),一經生成,永遠不會改變,主庫傳送日誌時會判斷這個值是否一樣,確保是來自同一個資料守護環境中的庫,否則傳送不了日誌。
2. 由於 dminit 初始化資料庫時,會生成隨機金鑰用於加密,每次生成的金鑰都不相同,備庫無法解析採用主庫金鑰加密的資料。
3. 每個庫都有一個資料庫魔數( DB_MAGIC ),每經過一次還原、恢復操作, DB_MAGIC 就會產生變化,需要透過這種方式來區分同一個資料守護環境中各個不同的庫。
2.1 主庫離線備份
啟動 DMAP 服務
[dmdba@cjc-db-03 dm8]$ cd /dm8/bin/service_template/ [dmdba@cjc-db-03 service_template]$ ./DmAPService start
離線備份
[dmdba@cjc-db-03 service_template]$ dmrman CTLSTMT="BACKUP DATABASE '/dm8/data/CHEN/dm.ini' FULL TO BACKUP_FILE1 BACKUPSET '/dm8/bak/BACKUP_FILE_01'"
檢視備份檔案
[dmdba@cjc-db-03 bak]$ ll -rth BACKUP_FILE_01/ total 7.1M -rw-r--r--. 1 dmdba dinstall 7.0M Oct 10 15:33 BACKUP_FILE_01.bak -rw-r--r--. 1 dmdba dinstall 81K Oct 10 15:33 BACKUP_FILE_01.meta
壓縮
[dmdba@cjc-db-03 dm8]$ tar -zcvf bak.tar.gz bak/
傳到備庫
[dmdba@cjc-db-03 dm8]$ scp bak.tar.gz dmdba@172.16.6.102:/dm8
2.2 備庫離線恢復
安裝 DM 資料庫軟體
[dmdba@cjc-db-04 mnt]$ ./DMInstall.bin -i
建立 DM資料庫例項
[dmdba@cjc-db-04 mnt]$ dminit path=/dm8/data DB_NAME=CJC instance_name=CJC port_num=5238
恢復備份
[dmdba@cjc-db-04 dm8]$ tar -zxvf bak.tar.gz [dmdba@cjc-db-04 dm8]$ /dm8/bin/service_template/DmAPService start [dmdba@cjc-db-04 dm8]$ dmrman CTLSTMT="restore database '/dm8/data/CJC/dm.ini' from backupset '/dm8/bak/BACKUP_FILE_01'" [dmdba@cjc-db-04 dm8]$ dmrman CTLSTMT="recover database '/dm8/data/CJC/dm.ini' from backupset '/dm8/bak/BACKUP_FILE_01'" [dmdba@cjc-db-04 dm8]$ dmrman CTLSTMT="recover database '/dm8/data/CJC/dm.ini' update DB_MAGIC "
三:配置主庫 CHEN
庫名和例項名 :CHEN
[dmdba@cjc-db-03 CHEN]$ disql SYSDBA/Dameng123:5238 Server[LOCALHOST:5238]:mode is normal, state is open login used time : 6.215(ms) disql V8 SQL> select name from v$database; LINEID NAME ---------- ---- 1 CHEN used time: 14.585(ms). Execute id is 500. SQL> select instance_name from v$instance; LINEID INSTANCE_NAME ---------- ------------- 1 CHEN used time: 1.817(ms). Execute id is 501.
3.1配置 dm.ini(主庫 )
在主庫機器上配置主庫的例項名為 CHEN , dm.ini 引數修改如下:
注意:
1. 例項名,總長度不能超過 16
2. 下面引數已經存在 dm.ini 檔案中,需要修改對應的值。
[dmdba@cjc-db-03 CHEN]$ vi dm.ini
INSTANCE_NAME = CHEN PORT_NUM = 5238 ##資料庫例項監聽埠 DW_INACTIVE_INTERVAL = 60 ##接收守護程式訊息超時時間,預設60 ALTER_MODE_STATUS = 1 ##不允許手工方式修改例項模式/狀態/OGUID,預設1 ENABLE_OFFLINE_TS = 2 ##不允許備庫OFFLINE表空間,預設1 MAL_INI = 1 ##開啟MAL系統,預設0 ARCH_INI = 1 ##開啟歸檔配置,預設0 RLOG_SEND_APPLY_MON = 64 ##統計最近64次的日誌傳送資訊,預設64
3.2配置 dmmal.ini(主庫 )
配置 MAL 系統,各主備庫的 dmmal.ini 配置必須完全一致,
MAL_HOST 使用內部網路 IP ,
MAL_PORT 與 dm.ini 中 PORT_NUM 使用不同的埠值, MAL_DW_PORT 是各例項對應的守護程式之間,以及守護程式和監視器之間的通訊埠,配置如下:
[dmdba@cjc-db-03 CHEN]$ vi dmmal.ini
MAL_CHECK_INTERVAL = 5 ##MAL鏈路檢測時間間隔 MAL_CONN_FAIL_INTERVAL = 5 ##判定MAL鏈路斷開的時間 [MAL_INST1] MAL_INST_NAME = CHEN ##例項名,和dm.ini中的INSTANCE_NAME一致 MAL_HOST = 172.16.6.101 ##MAL系統監聽TCP連線的IP地址 MAL_PORT = 61141 ##MAL系統監聽TCP連線的埠 MAL_INST_HOST = 172.16.6.101 ##例項的對外服務IP地址 MAL_INST_PORT = 5238 ##例項的對外服務埠,和dm.ini中的PORT_NUM一致 MAL_DW_PORT = 52141 ##例項本地的守護程式監聽TCP連線的埠 MAL_INST_DW_PORT = 33141 ##例項監聽守護程式TCP連線的埠 [MAL_INST2] MAL_INST_NAME = CJC MAL_HOST = 172.16.6.102 MAL_PORT = 61142 MAL_INST_HOST = 172.16.6.102 MAL_INST_PORT = 5238 MAL_DW_PORT = 52142 MAL_INST_DW_PORT = 33142
3.3配置 dmarch.ini(主庫 )
修改 dmarch.ini ,配置本地歸檔和實時歸檔。
除了本地歸檔外,其他歸檔配置項中的 ARCH_DEST 表示例項是 Primary 模式時,需要同步歸檔資料的目標例項名。
當前例項 CHEN 是主庫,需要向 CJC (實時備庫)同步資料,因此實時歸檔的 ARCH_DEST 配置為 CJC 。
[dmdba@cjc-db-03 CHEN]$ mkdir arch
[dmdba@cjc-db-03 CHEN]$ pwd
/dm8/data/CHEN
[dmdba@cjc-db-03 CHEN]$ vi dmarch.ini
[ARCHIVE_REALTIME] ARCH_TYPE = REALTIME ##實時歸檔型別 ARCH_DEST = CJC ##實時歸檔目標例項名 [ARCHIVE_LOCAL1] ARCH_TYPE = LOCAL ##本地歸檔型別 ARCH_DEST = /dm8/data/CHEN/arch ##本地歸檔檔案存放路徑 ARCH_FILE_SIZE = 128 ##單位Mb,本地單個歸檔檔案最大值 ARCH_SPACE_LIMIT = 0 ##單位Mb,0表示無限制,範圍1024~2147483647M
3.4配置 dmwatcher.ini(主庫 )
修改 dmwatcher.ini 配置守護程式,配置為全域性守護型別,使用自動切換模式。
[dmdba@cjc-db-03 CHEN]$ vi dmwatcher.ini
[GRP1] DW_TYPE = GLOBAL ##全域性守護型別 DW_MODE = AUTO ##自動切換模式 DW_ERROR_TIME = 10 ##遠端守護程式故障認定時間 INST_RECOVER_TIME = 60 ##主庫守護程式啟動恢復的間隔時間 INST_ERROR_TIME = 10 ##本地例項故障認定時間 INST_OGUID = 453331 ##守護系統唯一OGUID值 INST_INI = /dm8/data/CHEN/dm.ini ##dm.ini配置檔案路徑 INST_AUTO_RESTART = 1 ##開啟例項的自動啟動功能 INST_STARTUP_CMD = /dm8/bin/dmserver ##命令列方式啟動 RLOG_SEND_THRESHOLD = 0 ##指定主庫傳送日誌到備庫的時間閾值,預設關閉 RLOG_APPLY_THRESHOLD = 0 ##指定備庫重演日誌的時間閾值,預設關閉
3.5啟動主庫
以 Mount 方式啟動主庫
[root@cjc-db-03 dm8]# systemctl stop DmServiceCJC.service [dmdba@cjc-db-03 CHEN]$ dmserver /dm8/data/CHEN/dm.ini mount file dm.key not found, use default license! version info: develop DM Database Server 64 V8 03134283890-20220720-165295-10045 startup... Normal of FAST Normal of DEFAULT Normal of RECYCLE Normal of KEEP Normal of ROLL Database mode = 0, oguid = 0 License will expire on 2023-07-20 file lsn: 39941 ndct db load finished ndct second level fill fast pool finished ndct third level fill fast pool finished ndct second level fill fast pool finished ndct third level fill fast pool finished ndct fill fast pool finished nsvr_startup end. aud sys init success. aud rt sys init success. systables desc init success. ndct_db_load_info success. SYSTEM IS READY.
注意
一定要以 Mount 方式啟動資料庫例項,否則系統啟動時會重構回滾表空間,生成 Redo 日誌;
並且,啟動後應用可能連線到資料庫例項進行操作,破壞主備庫的資料一致性。
資料守護配置結束後,守護程式會自動 Open 資料庫。
3.6 設定 OGUID
啟動命令列工具 DIsql ,登入主庫設定 OGUID 值。
[dmdba@cjc-db-03 CHEN]$ disql SYSDBA/Dameng123:5238 SQL>SP_SET_PARA_VALUE(1, 'ALTER_MODE_STATUS', 1); SQL>sp_set_oguid(453331); SQL>SP_SET_PARA_VALUE(1, 'ALTER_MODE_STATUS', 0);
注意
系統透過 OGUID 值確定一個守護程式組,由使用者保證 OGUID 值的唯一性,並確保資料守護系統中,資料庫、守護程式和監視器配置相同的 OGUID 值。
3.7 修改資料庫模式
啟動命令列工具 DIsql ,登入主庫修改資料庫為 Primary 模式
SQL>alter database primary;
四:配置備庫 CJC
4.1 配置 dm.ini( 備庫 )
在主庫機器上配置主庫的例項名為 CJC , dm.ini 引數修改如下:
注意:
1. 例項名,總長度不能超過 16
2. 下面引數已經存在 dm.ini 檔案中,需要修改對應的值。
[dmdba@cjc-db-04 dm8]$ cd /dm8/data/CJC/
[dmdba@cjc-db-04 CJC]$ vi dm.ini
INSTANCE_NAME = CJC PORT_NUM = 5238 ##資料庫例項監聽埠 DW_INACTIVE_INTERVAL = 60 ##接收守護程式訊息超時時間,預設60 ALTER_MODE_STATUS = 0 ##不允許手工方式修改例項模式/狀態/OGUID,預設1 ENABLE_OFFLINE_TS = 2 ##不允許備庫OFFLINE表空間,預設1 MAL_INI = 1 ##開啟MAL系統,預設0 ARCH_INI = 1 ##開啟歸檔配置,預設0 RLOG_SEND_APPLY_MON = 64 ##統計最近64次的日誌重演資訊
4.2 配置 dmmal.ini( 備庫 )
配置 MAL 系統,各主備庫的 dmmal.ini 配置必須完全一致, MAL_HOST 使用內部網路 IP , MAL_PORT 與 dm.ini 中 PORT_NUM 使用不同的埠值, MAL_DW_PORT 是各例項對應的守護程式之間,以及守護程式和監視器之間的通訊埠,配置如下:
[dmdba@cjc-db-04 CJC]$ vi dmmal.ini
MAL_CHECK_INTERVAL = 5 ##MAL鏈路檢測時間間隔 MAL_CONN_FAIL_INTERVAL = 5 ##判定MAL鏈路斷開的時間 [MAL_INST1] MAL_INST_NAME = CHEN ##例項名,和dm.ini中的INSTANCE_NAME一致 MAL_HOST = 172.16.6.101 ##MAL系統監聽TCP連線的IP地址 MAL_PORT = 61141 ##MAL系統監聽TCP連線的埠 MAL_INST_HOST = 172.16.6.101 ##例項的對外服務IP地址 MAL_INST_PORT = 5238 ##例項的對外服務埠,和dm.ini中的PORT_NUM一致 MAL_DW_PORT = 52141 ##例項本地的守護程式監聽TCP連線的埠 MAL_INST_DW_PORT = 33141 ##例項監聽守護程式TCP連線的埠 [MAL_INST2] MAL_INST_NAME = CJC MAL_HOST = 172.16.6.102 MAL_PORT = 61142 MAL_INST_HOST = 172.16.6.102 MAL_INST_PORT = 5238 MAL_DW_PORT = 52142 MAL_INST_DW_PORT = 33142
4.3配置 dmarch.ini(備庫 )
修改 dmarch.ini ,配置本地歸檔和實時歸檔。
除了本地歸檔外,其他歸檔配置項中的 ARCH_DEST 表示例項是 Primary 模式時,需要同步歸檔資料的目標例項名。
當前例項 CJC 是備庫,守護系統配置完成後,可能在各種故障處理中, CJC 切換為新的主庫,正常情況下, CHEN 會切換為新的備庫,需要向 CHEN 同步資料,因此實時歸檔的 ARCH_DEST 配置為 CHEN 。
[dmdba@cjc-db-04 CJC]$ vi dmarch.ini
[ARCHIVE_REALTIME] ARCH_TYPE = REALTIME ##實時歸檔型別 ARCH_DEST = CHEN ##實時歸檔目標例項名 [ARCHIVE_LOCAL1] ARCH_TYPE = LOCAL ##本地歸檔型別 ARCH_DEST = /dm8/data/CJC/arch ##本地歸檔檔案路徑 ARCH_FILE_SIZE = 128 ##單位Mb,本地單個歸檔檔案最大值 ARCH_SPACE_LIMIT = 0 ##單位Mb,0表示無限制,範圍1024~2147483647M
4.4 配置 dmwatcher.ini( 備庫 )
修改 dmwatcher.ini 配置守護程式,配置為全域性守護型別,使用自動切換模式。
[GRP1] DW_TYPE = GLOBAL ##全域性守護型別 DW_MODE = AUTO ##自動切換模式 DW_ERROR_TIME = 10 ##遠端守護程式故障認定時間 INST_RECOVER_TIME = 60 ##主庫守護程式啟動恢復的間隔時間 INST_ERROR_TIME = 10 ##本地例項故障認定時間 INST_OGUID = 453331 ##守護系統唯一OGUID值 INST_INI = /dm8/data/CJC/dm.ini##dm.ini配置檔案路徑 INST_AUTO_RESTART = 1 ##開啟例項的自動啟動功能 INST_STARTUP_CMD = /dm8/bin/dmserver ##命令列方式啟動 RLOG_APPLY_THRESHOLD = 0 ##指定備庫重演日誌的時間閾值,預設關閉
4.5 啟動備庫
以 Mount 方式啟動備庫
[dmdba@cjc-db-04 CJC]$ dmserver /dm8/data/CJC/dm.ini mount [dmdba@cjc-db-04 dm8]$ disql SYSDBA/Dameng123:5238
注意
一定要以 Mount 方式啟動資料庫例項,否則系統啟動時會重構回滾表空間,生成 Redo 日誌;並且,啟動後應用可能連線到資料庫例項進行操作,破壞主備庫的資料一致性。資料守護配置結束後,守護程式會自動 Open 資料庫。
4.6 設定 OGUID
啟動命令列工具 DIsql ,登入備庫設定 OGUID 值為 453331
SQL>SP_SET_PARA_VALUE(1, 'ALTER_MODE_STATUS', 1); SQL>sp_set_oguid(453331); SQL>SP_SET_PARA_VALUE(1, 'ALTER_MODE_STATUS', 0);
注意
系統透過 OGUID 值確定一個守護程式組,由使用者保證 OGUID 值的唯一性,並確保資料守護系統中,資料庫、守護程式和監視器配置相同的 OGUID 值。
4.6 修改資料庫模式
啟動命令列工具 DIsql ,登入備庫修改資料庫為 Standby 模式。
如果當前資料庫不是 Normal 模式,需要先修改 dm.ini 中 ALTER_MODE_STATUS 值為 1 ,允許修改資料庫模式,修改 Standby 模式成功後再改回為 0 。
如果是 Normal 模式,請忽略下面的第 1 步和第 3 步。
SQL>SP_SET_PARA_VALUE(1, 'ALTER_MODE_STATUS', 1); ----第1步 SQL>alter database standby; ----第2步 SQL>SP_SET_PARA_VALUE(1, 'ALTER_MODE_STATUS', 0); ----第3步
五:配置監視器
在 CJC-DB-03 機器上配置。
配置監視器時可以選擇配置單例項監視器或配置多例項監視器,下面將分別介紹配置單例項監視器以及多例項監視器時 dmmonitor.ini 配置檔案中的配置資訊。
配置單例項監視器
由於主庫和實時備庫的守護程式配置為自動切換模式,因此這裡選擇配置確認監視器。
和普通監視器相比,確認監視器除了相同的命令支援外,在主庫發生故障時,能夠自動通知實時備庫接管為新的主庫,具有自動故障處理的功能。
注意
故障自動切換模式下,必須配置確認監視器,且確認監視器最多隻能配置一個
5.1 配置 dmmonitor.ini
修改 dmmonitor.ini 配置確認監視器,其中 MON_DW_IP 中的 IP 和 PORT 和 dmmal.ini 中的 MAL_HOST 和 MAL_DW_PORT 配置項保持一致。
[dmdba@cjc-db-03 CHEN]$ vi dmmonitor.ini
MON_DW_CONFIRM = 1 ##確認監視器模式 MON_LOG_PATH = /dm8/data/log ##監視器日誌檔案存放路徑 MON_LOG_INTERVAL = 60 ##每隔60s定時記錄系統資訊到日誌檔案 MON_LOG_FILE_SIZE = 32 ##每個日誌檔案最大32M MON_LOG_SPACE_LIMIT = 0 ##不限定日誌檔案總佔用空間 [GRP1] MON_INST_OGUID = 453331 ##組GRP1的唯一OGUID值 MON_DW_IP = 172.16.6.101:52141 MON_DW_IP = 172.16.6.102:52142
六:配置主從
6.1 啟動守護程式
啟動各個主備庫上的守護程式:
主:
[dmdba@cjc-db-03 CHEN]$ dmwatcher /dm8/data/CHEN/dmwatcher.ini
從:
[dmdba@cjc-db-04 ~]$ dmwatcher /dm8/data/CHEN/dmwatcher.ini
守護程式啟動後,進入 Startup 狀態,此時例項都處於 Mount 狀態。
守護程式開始廣播自身和其監控例項的狀態資訊,結合自身資訊和遠端守護程式的廣播資訊,守護程式將本地例項 Open ,並切換為 Open 狀態。
6.2 啟動監視器
[dmdba@cjc-db-03 CHEN]$ dmmonitor /dm8/data/CHEN/dmmonitor.ini
監視器提供一系列命令,支援當前守護系統狀態檢視以及故障處理,可輸入 help 命令,檢視各種命令說明使用,結合實際情況選擇使用。
至此一主一備的實時資料守護系統搭建完畢,在搭建步驟和各項配置都正確的情況下,在監視器上執行 show 命令,可以監控到所有例項都處於 Open 狀態,所有守護程式也都處於 Open 狀態,即為正常執行狀態。
七:資料同步測試
7.1 主庫新增資料
主庫
[dmdba@cjc-db-03 dm8]$ disql SYSDBA/Dameng123:5238 SQL> select name,status$,role$ from v$database; LINEID NAME STATUS$ ROLE$ ---------- ---- ----------- ----------- 1 CHEN 4 1
建立表
SQL> create table t1(id int); executed successfully used time: 39.548(ms). Execute id is 6. SQL> insert into t1 values(1),(2),(3); affect rows 3 used time: 3.138(ms). Execute id is 7. SQL> commit; executed successfully used time: 30.124(ms). Execute id is 8.
7.2從庫檢查資料同步
從庫
[dmdba@cjc-db-04 ~]$ disql SYSDBA/Dameng123:5238 Server[LOCALHOST:5238]:mode is standby, state is open login used time : 5.973(ms) disql V8 SQL> select name,status$,role$ from v$database; LINEID NAME STATUS$ ROLE$ ---------- ---- ----------- ----------- 1 CHEN 4 2 used time: 9.511(ms). Execute id is 100. SQL> select * from t1; LINEID ID ---------- ----------- 1 1 2 2 3 3 used time: 3.325(ms). Execute id is 102.
從庫只讀
SQL> insert into t1 values(4),(5); insert into t1 values(4),(5); [-2018]:Error in line: 1 Try to insert/update/delete table table is not temporary or contains lob on standby mode. used time: 2.128(ms). Execute id is 0.
八:資料庫主從切換
使用 dmmonitor 工具進行主從切換
相關命令如下
37.switchover [group_name[.]] [db_name] --switchover specified database of specified group as primary database 38.takeover [group_name[.]] [db_name] --use specified database of specified group to takeover as primary database 39.takeover force [group_name[.]] [db_name] --use specified database of specified group to takeover as primary database forcefully
7.1 手動切換
檢視主從狀態
show global info
2022-10-10 16:50:51 #================================================================================# GROUP OGUID MON_CONFIRM MODE MPP_FLAG GRP1 453331 TRUE AUTO FALSE <<DATABASE GLOBAL INFO:>> DW_IP MAL_DW_PORT WTIME WTYPE WCTLSTAT WSTATUS INAME INST_OK N_EP N_OK ISTATUS IMODE DSC_STATUS RTYPE RSTAT 172.16.6.101 52141 2022-10-10 16:50:50 GLOBAL VALID OPEN CHEN OK 1 1 OPEN PRIMARY DSC_OPEN REALTIME VALID DW_IP MAL_DW_PORT WTIME WTYPE WCTLSTAT WSTATUS INAME INST_OK N_EP N_OK ISTATUS IMODE DSC_STATUS RTYPE RSTAT 172.16.6.102 52142 2022-10-10 16:50:50 GLOBAL VALID OPEN CJC OK 1 1 OPEN STANDBY DSC_OPEN REALTIME VALID #================================================================================#
開始切換
switchover GRP1.CJC [monitor] 2022-10-10 16:40:15: Not login dmmonitor or server public key changed, please try to login again!
登入
login username:SYSDBA password: [monitor] 2022-10-10 16:50:19: Login dmmonitor success!
再次切換
switchover GRP1.CJC
日誌如下:
[monitor] 2022-10-10 16:51:27: Start to switchover instance CJC [monitor] 2022-10-10 16:51:27: Notify dmwatcher(CHEN) switch to SWITCHOVER status [monitor] 2022-10-10 16:51:27: Dmwatcher process CHEN status switching [OPEN-->SWITCHOVER] [monitor] 2022-10-10 16:51:29: Switch dmwatcher CHEN to SWITCHOVER status success [monitor] 2022-10-10 16:51:29: Notify dmwatcher(CJC) switch to SWITCHOVER status [monitor] 2022-10-10 16:51:29: Dmwatcher process CJC status switching [OPEN-->SWITCHOVER] [monitor] 2022-10-10 16:51:29: Switch dmwatcher CJC to SWITCHOVER status success [monitor] 2022-10-10 16:51:29: Instance CHEN start to execute sql SP_SET_GLOBAL_DW_STATUS(0, 6) [monitor] 2022-10-10 16:51:29: Instance CHEN execute sql SP_SET_GLOBAL_DW_STATUS(0, 6) success [monitor] 2022-10-10 16:51:29: Instance CJC start to execute sql SP_SET_GLOBAL_DW_STATUS(0, 6) [monitor] 2022-10-10 16:51:29: Instance CJC execute sql SP_SET_GLOBAL_DW_STATUS(0, 6) success [monitor] 2022-10-10 16:51:29: Instance CHEN start to execute sql ALTER DATABASE MOUNT [monitor] 2022-10-10 16:51:29: Instance CHEN execute sql ALTER DATABASE MOUNT success [monitor] 2022-10-10 16:51:29: Instance CJC start to execute sql SP_APPLY_KEEP_PKG() [monitor] 2022-10-10 16:51:29: Instance CJC execute sql SP_APPLY_KEEP_PKG() success [monitor] 2022-10-10 16:51:29: Instance CJC start to execute sql ALTER DATABASE MOUNT [monitor] 2022-10-10 16:51:29: Instance CJC execute sql ALTER DATABASE MOUNT success [monitor] 2022-10-10 16:51:29: Instance CHEN start to execute sql ALTER DATABASE STANDBY [monitor] 2022-10-10 16:51:30: Instance CHEN execute sql ALTER DATABASE STANDBY success [monitor] 2022-10-10 16:51:30: Instance CJC start to execute sql ALTER DATABASE PRIMARY [monitor] 2022-10-10 16:51:31: Instance CJC execute sql ALTER DATABASE PRIMARY success [monitor] 2022-10-10 16:51:31: Notify instance CJC to change all arch status to be invalid [monitor] 2022-10-10 16:51:31: Succeed to change all instances arch status to be invalid [monitor] 2022-10-10 16:51:31: Instance CHEN start to execute sql ALTER DATABASE OPEN FORCE [monitor] 2022-10-10 16:51:32: Instance CHEN execute sql ALTER DATABASE OPEN FORCE success [monitor] 2022-10-10 16:51:32: Instance CJC start to execute sql ALTER DATABASE OPEN FORCE [monitor] 2022-10-10 16:51:32: Instance CJC execute sql ALTER DATABASE OPEN FORCE success [monitor] 2022-10-10 16:51:32: Instance CHEN start to execute sql SP_SET_GLOBAL_DW_STATUS(6, 0) [monitor] 2022-10-10 16:51:32: Instance CHEN execute sql SP_SET_GLOBAL_DW_STATUS(6, 0) success [monitor] 2022-10-10 16:51:32: Instance CJC start to execute sql SP_SET_GLOBAL_DW_STATUS(6, 0) [monitor] 2022-10-10 16:51:32: Instance CJC execute sql SP_SET_GLOBAL_DW_STATUS(6, 0) success [monitor] 2022-10-10 16:51:32: Notify dmwatcher(CHEN) switch to OPEN status [monitor] 2022-10-10 16:51:32: Dmwatcher process CHEN status switching [SWITCHOVER-->OPEN] [monitor] 2022-10-10 16:51:32: Switch dmwatcher CHEN to OPEN status success [monitor] 2022-10-10 16:51:32: Notify dmwatcher(CJC) switch to OPEN status [monitor] 2022-10-10 16:51:33: Dmwatcher process CJC status switching [SWITCHOVER-->OPEN] [monitor] 2022-10-10 16:51:33: Switch dmwatcher CJC to OPEN status success [monitor] 2022-10-10 16:51:33: Notify group(GRP1)'s dmwatcher to do clear [monitor] 2022-10-10 16:51:34: Clean request of dmwatcher processer CHEN success 2022-10-10 16:51:34 #================================================================================# GROUP OGUID MON_CONFIRM MODE MPP_FLAG GRP1 453331 TRUE AUTO FALSE <<DATABASE GLOBAL INFO:>> DW_IP MAL_DW_PORT WTIME WTYPE WCTLSTAT WSTATUS INAME INST_OK N_EP N_OK ISTATUS IMODE DSC_STATUS RTYPE RSTAT 172.16.6.102 52142 2022-10-10 16:51:33 GLOBAL VALID OPEN CJC OK 1 1 OPEN PRIMARY DSC_OPEN REALTIME VALID EP INFO: INST_IP INST_PORT INST_OK INAME ISTATUS IMODE DSC_SEQNO DSC_CTL_NODE RTYPE RSTAT FSEQ FLSN CSEQ CLSN DW_STAT_FLAG 172.16.6.102 5238 OK CJC OPEN PRIMARY 0 0 REALTIME VALID 6432 43497 6432 43498 NONE <<DATABASE GLOBAL INFO:>> DW_IP MAL_DW_PORT WTIME WTYPE WCTLSTAT WSTATUS INAME INST_OK N_EP N_OK ISTATUS IMODE DSC_STATUS RTYPE RSTAT 172.16.6.101 52141 2022-10-10 16:51:34 GLOBAL VALID OPEN CHEN OK 1 1 OPEN STANDBY DSC_OPEN REALTIME INVALID EP INFO: INST_IP INST_PORT INST_OK INAME ISTATUS IMODE DSC_SEQNO DSC_CTL_NODE RTYPE RSTAT FSEQ FLSN CSEQ CLSN DW_STAT_FLAG 172.16.6.101 5238 OK CHEN OPEN STANDBY 0 0 REALTIME INVALID 6431 42139 6431 42139 NONE DATABASE(CHEN) APPLY INFO FROM (CJC), REDOS_PARALLEL_NUM (1): DSC_SEQNO[0], (RSEQ, SSEQ, KSEQ)[6431, 6431, 6431], (RLSN, SLSN, KLSN)[42139, 42139, 42139], N_TSK[0], TSK_MEM_USE[0] REDO_LSN_ARR: (42139) #================================================================================# [monitor] 2022-10-10 16:51:34: Clean request of dmwatcher processer CJC success [monitor] 2022-10-10 16:51:34: Switchover instance CJC success [monitor] 2022-10-10 16:51:35: Dmwatcher process CJC status switching [OPEN-->RECOVERY] WTIME WSTATUS INST_OK INAME ISTATUS IMODE RSTAT N_OPEN FLSN CLSN 2022-10-10 16:51:35 RECOVERY OK CJC OPEN PRIMARY VALID 5 43498 43498 [monitor] 2022-10-10 16:51:38: Dmwatcher process CJC status switching [RECOVERY-->OPEN] WTIME WSTATUS INST_OK INAME ISTATUS IMODE RSTAT N_OPEN FLSN CLSN 2022-10-10 16:51:37 OPEN OK CJC OPEN PRIMARY VALID 5 43499 43499
檢視主從狀態,切換成功
show global info
2022-10-10 16:53:01 #================================================================================# GROUP OGUID MON_CONFIRM MODE MPP_FLAG GRP1 453331 TRUE AUTO FALSE <<DATABASE GLOBAL INFO:>> DW_IP MAL_DW_PORT WTIME WTYPE WCTLSTAT WSTATUS INAME INST_OK N_EP N_OK ISTATUS IMODE DSC_STATUS RTYPE RSTAT 172.16.6.102 52142 2022-10-10 16:53:01 GLOBAL VALID OPEN CJC OK 1 1 OPEN PRIMARY DSC_OPEN REALTIME VALID DW_IP MAL_DW_PORT WTIME WTYPE WCTLSTAT WSTATUS INAME INST_OK N_EP N_OK ISTATUS IMODE DSC_STATUS RTYPE RSTAT 172.16.6.101 52141 2022-10-10 16:53:01 GLOBAL VALID OPEN CHEN OK 1 1 OPEN STANDBY DSC_OPEN REALTIME VALID #================================================================================#
新主庫插入資料測試
[dmdba@cjc-db-04 ~]$ disql SYSDBA/Dameng123:5238 SQL> insert into t1 values(4),(5); SQL> commit;
新從庫查詢資料同步
[dmdba@cjc-db-03 ~]$ disql SYSDBA/Dameng123:5238 SQL> select * from t1; LINEID ID ---------- ----------- 1 1 2 2 3 3 4 4 5 5 used time: 6.220(ms). Execute id is 600.
回切
switchover GRP1.CHEN
檢視主從狀態,回切成功
show global info
2022-10-10 16:56:38 #================================================================================# GROUP OGUID MON_CONFIRM MODE MPP_FLAG GRP1 453331 TRUE AUTO FALSE <<DATABASE GLOBAL INFO:>> DW_IP MAL_DW_PORT WTIME WTYPE WCTLSTAT WSTATUS INAME INST_OK N_EP N_OK ISTATUS IMODE DSC_STATUS RTYPE RSTAT 172.16.6.101 52141 2022-10-10 16:56:38 GLOBAL VALID OPEN CHEN OK 1 1 OPEN PRIMARY DSC_OPEN REALTIME VALID DW_IP MAL_DW_PORT WTIME WTYPE WCTLSTAT WSTATUS INAME INST_OK N_EP N_OK ISTATUS IMODE DSC_STATUS RTYPE RSTAT 172.16.6.102 52142 2022-10-10 16:56:37 GLOBAL VALID OPEN CJC OK 1 1 OPEN STANDBY DSC_OPEN REALTIME VALID #================================================================================#
7.2自動切換
停止主庫
SQL> shutdown immediate; executed successfully used time: 2.060(ms). Execute id is 0.
檢視主從狀態
show global info
2022-10-10 16:59:20 #================================================================================# GROUP OGUID MON_CONFIRM MODE MPP_FLAG GRP1 453331 TRUE AUTO FALSE <<DATABASE GLOBAL INFO:>> DW_IP MAL_DW_PORT WTIME WTYPE WCTLSTAT WSTATUS INAME INST_OK N_EP N_OK ISTATUS IMODE DSC_STATUS RTYPE RSTAT 172.16.6.101 52141 2022-10-10 16:59:20 GLOBAL VALID OPEN CHEN OK 1 1 OPEN PRIMARY DSC_OPEN REALTIME VALID DW_IP MAL_DW_PORT WTIME WTYPE WCTLSTAT WSTATUS INAME INST_OK N_EP N_OK ISTATUS IMODE DSC_STATUS RTYPE RSTAT 172.16.6.102 52142 2022-10-10 16:59:19 GLOBAL VALID OPEN CJC OK 1 1 OPEN STANDBY DSC_OPEN REALTIME VALID #================================================================================#
原主庫被自動拉起了,沒有發生自動切換
檢視 dmwatcher 自動啟動主庫日誌:
Waitpid error! file dm.key not found, use default license! version info: develop DM Database Server 64 V8 03134283890-20220720-165295-10045 startup... Normal of FAST Normal of DEFAULT Normal of RECYCLE Normal of KEEP Normal of ROLL Database mode = 1, oguid = 453331 License will expire on 2023-07-20 file lsn: 45230 ndct db load finished ndct second level fill fast pool finished ndct third level fill fast pool finished ndct second level fill fast pool finished ndct third level fill fast pool finished ndct fill fast pool finished nsvr_startup end. aud sys init success. aud rt sys init success. systables desc init success. ndct_db_load_info success. SYSTEM IS READY. iid page's trxid[13037] NEXT TRX ID = 13038 pseg_collect_mgr_items, total collect 0 active_trxs, 0 cmt_trxs, 0 pre_cmt_trxs, 0 to_release_trxs, 0 active_pages, 0 cmt_pages, 0 pre_cmt_pages, 0 to_release_pages, 0 mgr pages, 0 mgr recs! iid page's trxid[14039] NEXT TRX ID = 15041. total 0 active crash trx, pseg_crash_trx_rollback sys_only(0) begin ... pseg_crash_trx_rollback end, total 0 active crash trx, include 0 empty_trxs, 0 empty_pages which only need to delete mgr recs. pseg_crash_trx_rollback end pseg recv finished nsvr_process_before_open begin. nsvr_process_before_open success. total 0 active crash trx, pseg_crash_trx_rollback sys_only(0) begin ... pseg_crash_trx_rollback end, total 0 active crash trx, include 0 empty_trxs, 0 empty_pages which only need to delete mgr recs. pseg_crash_trx_rollback end
九:日常維護
9.1 停資料庫
dmmonitor 相關命令
19.startup dmwatcher [group_name] --startup watching specified group 20.stop dmwatcher [group_name] --stop watching specified group 21.startup group [group_name] --startup all databases of specified group 22.stop group [group_name] --exit all databases of specified group 23.kill group [group_name] --kill all active databases of specified group
stop group GRP1
停止所有資料庫
[monitor] 2022-10-10 17:07:25: Stop dmwatcher process of instance CHEN[PRIMARY, OPEN, ISTAT_SAME:TRUE] [monitor] 2022-10-10 17:07:25: Dmwatcher process CHEN status switching [OPEN-->SHUTDOWN] [monitor] 2022-10-10 17:07:26: Stop dmwatcher process of instance CHEN[PRIMARY, OPEN, ISTAT_SAME:TRUE] success [monitor] 2022-10-10 17:07:26: Stop dmwatcher process of instance CJC[STANDBY, OPEN, ISTAT_SAME:TRUE] [monitor] 2022-10-10 17:07:26: Dmwatcher process CJC status switching [OPEN-->SHUTDOWN] [monitor] 2022-10-10 17:07:26: Stop dmwatcher process of instance CJC[STANDBY, OPEN, ISTAT_SAME:TRUE] success [monitor] 2022-10-10 17:07:26: Notify instance(CHEN) shutdown.
檢視狀態,停止成功
show global info
2022-10-10 17:08:02 #================================================================================# GROUP OGUID MON_CONFIRM MODE MPP_FLAG GRP1 453331 TRUE AUTO FALSE ERROR DATABASE: <<DATABASE GLOBAL INFO:>> DW_IP MAL_DW_PORT WTIME WTYPE WCTLSTAT WSTATUS INAME INST_OK N_EP N_OK ISTATUS IMODE DSC_STATUS RTYPE RSTAT 172.16.6.101 52141 2022-10-10 17:08:01 GLOBAL VALID SHUTDOWN CHEN ERROR 1 1 SHUTDOWN PRIMARY DSC_OPEN REALTIME VALID DW_IP MAL_DW_PORT WTIME WTYPE WCTLSTAT WSTATUS INAME INST_OK N_EP N_OK ISTATUS IMODE DSC_STATUS RTYPE RSTAT 172.16.6.102 52142 2022-10-10 17:08:01 GLOBAL VALID SHUTDOWN CJC ERROR 1 1 SHUTDOWN STANDBY DSC_OPEN NONE VALID #================================================================================#
9.2停止 dmwatcher
stop dmwatcher GRP1
在 SHUTDOWN 狀態下無法停止 dmwatcher
[monitor] 2022-10-10 17:08:59: Dmwatcher CHEN is already in SHUTDOWN status [monitor] 2022-10-10 17:08:59: Dmwatcher CJC is already in SHUTDOWN status [monitor] 2022-10-10 17:08:59: Cannot stop dmwatcher process group GRP1
執行 crtl+c 強制中斷
9.3 停止 dmmonitor
執行 crtl+c 強制中斷
9.4 啟動
先啟動 dmwatcher
主庫
dmwatcher /dm8/data/CHEN/dmwatcher.ini
從庫
dmwatcher /dm8/data/CJC/dmwatcher.ini
再啟動 dmmonitor
dmmonitor /dm8/data/CHEN/dmmonitor.ini
可以看到,資料庫自動啟動了
[dmdba@cjc-db-03 CHEN]$ dmmonitor /dm8/data/CHEN/dmmonitor.ini [monitor] 2022-10-10 17:16:14: DMMONITOR[4.0] V8 [monitor] 2022-10-10 17:16:14: DMMONITOR[4.0] IS READY. [monitor] 2022-10-10 17:16:15: Received message from(CHEN) WTIME WSTATUS INST_OK INAME ISTATUS IMODE RSTAT N_OPEN FLSN CLSN 2022-10-10 17:16:14 OPEN OK CHEN OPEN PRIMARY VALID 8 48148 48149 [monitor] 2022-10-10 17:16:15: Received message from(CJC) WTIME WSTATUS INST_OK INAME ISTATUS IMODE RSTAT N_OPEN FLSN CLSN 2022-10-10 17:16:14 OPEN OK CJC OPEN STANDBY VALID 8 48148 48148
檢視程式
[dmdba@cjc-db-03 ~]$ ps -ef|grep dmm|grep -v grep dmdba 6322 4182 0 17:16 pts/1 00:00:00 dmmonitor /dm8/data/CHEN/dmmonitor.ini [dmdba@cjc-db-03 ~]$ ps -ef|grep dmw|grep -v grep dmdba 6213 4731 0 17:15 pts/3 00:00:00 dmwatcher /dm8/data/CHEN/dmwatcher.ini [dmdba@cjc-db-03 ~]$ ps -ef|grep dms|grep -v grep dmdba 6227 1 0 17:15 ? 00:00:00 /dm8/bin/dmserver /dm8/data/CHEN/dm.ini mount
透過 dmmonitor啟動
啟動資料庫
startup group GRP1
啟動 dmwatcher
startup dmwatcher GRP1
手動啟動方式
監控伺服器
dmmonitor /dm8/data/CHEN/dmmonitor.ini
主庫
dmserver /dm8/data/CHEN/dm.ini dmwatcher /dm8/data/CHEN/dmwatcher.ini
從庫
dmserver /dm8/data/CJC/dm.ini dmwatcher /dm8/data/CJC/dmwatcher.ini
9.5 dmwatcher常用命令
檢視幫助資訊
help Dameng dmwatcher supports the following command: 1.help --dmwatcher help info 2.status --show dmwatcher status 3.show --show local database information of all dmwatcher groups 4.show group group_name --show local database information of specified group 5.show version --show self dmwatcher version 6.show monitor config --help for dmmonitor configuration 7.show link --show tcp connect info of local dmwatcher 8.exit --exit dmwatcher status 2022-10-10 17:06:17 -------------------------- GROUP_NAME = GRP1 DW_STATUS = OPEN DW_SUB_STATUS = SUB_STATE_START
9.6 dmmonitor常用命令
檢視幫助資訊 help
help Dmmonitor supports the following commands: NOTE: [group_name] in command should be specified if exists more than one group, [db_name] in command should be specified if exists more than one instance, [group_name] and [db_name] should be separated by '.' for [show monitor] command, if [db_name] is empty, then use first active dmwatcher in dmmonitor ini file. #=============================================================================================# #------------------------------------FOR GLOBAL COMMAND---------------------------------------# 1.help --show help information 2.exit --exit dmmonitor 3.show version --show self dmmonitor version 4.show global info --show global database information of all groups 5.show database [group_name.]db_name --show detail database information of specified database 6.show [group_name] --show detail database information of specified group, if not specified, it will show all groups 7.show i[nterval] n --auto show database information in console every n seconds 8.q --cancel 'auto show' in console 9.list [[group_name.]db_name] --list configuration of specified dmwatcher, if not specified, it will show all dmwatchers 10.show open info [group_name.]db_name --show open history of specified database 11.show arch send info [group_name.]db_name --show source database arch send info to specified database(include recover time info) 12.show apply stat [group_name.]db_name --show specified database apply stat 13.show monitor [group_name[.]] [db_name] --show all dmmonitor connection info of specified dmwatcher 14 show state --show state of all monitors which are in the same monitor group with current monitor 15.tip --show system currently working status 16.login --login dmmonitor 17.logout --logout dmmonitor 18.get takeover time --get how much time will delay before standby instance will do takeover 19.startup dmwatcher [group_name] --startup watching specified group 20.stop dmwatcher [group_name] --stop watching specified group 21.startup group [group_name] --startup all databases of specified group 22.stop group [group_name] --exit all databases of specified group 23.kill group [group_name] --kill all active databases of specified group 24.choose switchover [group_name] --choose databases which can do switchover 25.choose takeover [group_name] --choose databases which can do takeover 26.choose takeover force [group_name] --choose databases which can do takeover force 27.set group [group_name] auto restart on --set all instances of specified group auto restart on 28.set group [group_name] auto restart off --set all instances of specified group auto restart off 29.set group [group_name] para_name para_value --set all dmwatchers of specified group configuration(set both ini file and value in memory) --if group_name not specified, it will notify all groups to execute --para_name: specified parameter name, para_value: specified parameter value --can set parameters: DW_ERROR_TIME/INST_RECOVER_TIME/INST_ERROR_TIME/INST_AUTO_RESTART/ INST_SERVICE_IP_CHECK/RLOG_SEND_THRESHOLD/RLOG_APPLY_THRESHOLD 30.set group [group_name] recover time time_value --set all standby database of specified group recover time with time_value(time_value is an integer: 3~86400(s))(only set value in dmwatcher memory) --if group_name not specified, it will notify all groups to execute 31.set group [group_name] arch invalid --set all standby databases of specified group arch status invalid --if group_name not specified, it will notify all groups to execute 32.clear group [group_name] arch send info --clear source database recent arch send info to all standby databases of specified group(notify source database to execute) --if group_name not specified, it will notify all groups to execute 33.clear group [group_name] apply stat --clear all standby databases of specified group recent arch apply stat(notify all standby databases to execute) --if group_name not specified, it will notify all groups to execute 34.check recover [group_name.]db_name --check specified database of specified group can be auto recovered or not 35.check open [group_name.]db_name --check specified database of specified group can be auto opened or not 36.open database [group_name.]db_name --open specified database of specified group 37.switchover [group_name[.]] [db_name] --switchover specified database of specified group as primary database 38.takeover [group_name[.]] [db_name] --use specified database of specified group to takeover as primary database 39.takeover force [group_name[.]] [db_name] --use specified database of specified group to takeover as primary database forcefully 40.set database [group_name.]db_name recover time time_value --set specified database of specified group recover time with time_value(time_value is an integer: 3~86400(s))(only set in dmwatcher memory) 41.set database [group_name.]db_name arch invalid --set specified database of specified group arch status invalid 42.detach database [group_name.]db_name --detach specified standby database from specified group 43.attach database [group_name.]db_name --attach specified standby database to specified group 44.startup dmwatcher database [group_name.]db_name --startup watching specified database 45.stop dmwatcher database [group_name.]db_name --stop watching specified database 46.startup database [group_name.]db_name --startup specified database of specified group 47.stop database [group_name.]db_name --stop specified database of specified group 48.kill database [group_name.]db_name --kill specified database of specified group 49.clear database [group_name.]db_name arch send info --clear primary database recent arch send info to specified standby database(notify primary database to execute) 50.clear database [group_name.]db_name apply stat --clear specified standby database recent arch apply stat(notify standby database to execute) 51.set database [group_name.]db_name until time time_val --set specified database of specified group archive send until time with time_val 52.cancel database [group_name.]db_name until time --cancel specified database of specified group archive send until time 53.show mpp --show mpp site info 54.startup dmwatcher all --startup watching all groups 55.stop dmwatcher all --stop watching all groups 56.startup group all --startup all database of all groups 57.stop group all --exit all database of all groups 58.kill group all --kill active database of all groups 59.check mppctl --check all active primary databases' dmmpp.ctl files are same or not 60.recover mppctl --recover all active primary databases' dmmpp.ctl files to be same ---Type q/Q <return> to quit, or <return> to continue---
檢視當前工作狀態
tip
[monitor] 2022-10-10 16:41:05: Instance CHEN[PRIMARY, OPEN, ISTAT_SAME:TRUE] cannot join other instances, dmwatcher status is OPEN, SYSOPENHISTORY status is VALID [monitor] 2022-10-10 16:41:05: Instance CHEN[PRIMARY, OPEN, ISTAT_SAME:TRUE] has no command to execute currently [monitor] 2022-10-10 16:41:05: Instance CHEN[PRIMARY, OPEN, ISTAT_SAME:TRUE] is OK, dmwatcher status is OPEN, dw_type is GLOBAL [monitor] 2022-10-10 16:41:05: Instance CJC[STANDBY, OPEN, ISTAT_SAME:TRUE] can join instance CHEN[PRIMARY, OPEN, ISTAT_SAME:TRUE] [monitor] 2022-10-10 16:41:05: Instance CJC[STANDBY, OPEN, ISTAT_SAME:TRUE] has no command to execute currently [monitor] 2022-10-10 16:41:05: Instance CJC[STANDBY, OPEN, ISTAT_SAME:TRUE] is OK, dmwatcher status is OPEN, dw_type is GLOBAL [monitor] 2022-10-10 16:41:05: Group(GRP1) current active instances are OK [monitor] 2022-10-10 16:41:05: All groups' current active instances are OK!
檢視詳細資訊 show
show
2022-10-10 16:07:22 #================================================================================# GROUP OGUID MON_CONFIRM MODE MPP_FLAG GRP1 453331 TRUE AUTO FALSE <<DATABASE GLOBAL INFO:>> DW_IP MAL_DW_PORT WTIME WTYPE WCTLSTAT WSTATUS INAME INST_OK N_EP N_OK ISTATUS IMODE DSC_STATUS RTYPE RSTAT 172.16.6.101 52141 2022-10-10 16:07:22 GLOBAL VALID OPEN CHEN OK 1 1 OPEN PRIMARY DSC_OPEN REALTIME VALID EP INFO: INST_IP INST_PORT INST_OK INAME ISTATUS IMODE DSC_SEQNO DSC_CTL_NODE RTYPE RSTAT FSEQ FLSN CSEQ CLSN DW_STAT_FLAG 172.16.6.101 5238 OK CHEN OPEN PRIMARY 0 0 REALTIME VALID 5527 41213 5527 41214 NONE <<DATABASE GLOBAL INFO:>> DW_IP MAL_DW_PORT WTIME WTYPE WCTLSTAT WSTATUS INAME INST_OK N_EP N_OK ISTATUS IMODE DSC_STATUS RTYPE RSTAT 172.16.6.102 52142 2022-10-10 16:07:21 GLOBAL VALID OPEN CJC OK 1 1 OPEN STANDBY DSC_OPEN REALTIME VALID EP INFO: INST_IP INST_PORT INST_OK INAME ISTATUS IMODE DSC_SEQNO DSC_CTL_NODE RTYPE RSTAT FSEQ FLSN CSEQ CLSN DW_STAT_FLAG 172.16.6.102 5238 OK CJC OPEN STANDBY 0 0 REALTIME VALID 5510 41212 5510 41212 NONE DATABASE(CJC) APPLY INFO FROM (CHEN), REDOS_PARALLEL_NUM (1): DSC_SEQNO[0], (RSEQ, SSEQ, KSEQ)[5526, 5526, 5527], (RLSN, SLSN, KLSN)[41212, 41212, 41213], N_TSK[0], TSK_MEM_USE[512] REDO_LSN_ARR: (41212) #================================================================================#
檢視資料庫資訊
show global info
2022-10-10 16:23:28 #================================================================================# GROUP OGUID MON_CONFIRM MODE MPP_FLAG GRP1 453331 TRUE AUTO FALSE <<DATABASE GLOBAL INFO:>> DW_IP MAL_DW_PORT WTIME WTYPE WCTLSTAT WSTATUS INAME INST_OK N_EP N_OK ISTATUS IMODE DSC_STATUS RTYPE RSTAT 172.16.6.101 52141 2022-10-10 16:23:26 GLOBAL VALID OPEN CHEN OK 1 1 OPEN PRIMARY DSC_OPEN REALTIME VALID DW_IP MAL_DW_PORT WTIME WTYPE WCTLSTAT WSTATUS INAME INST_OK N_EP N_OK ISTATUS IMODE DSC_STATUS RTYPE RSTAT 172.16.6.102 52142 2022-10-10 16:23:27 GLOBAL VALID OPEN CJC OK 1 1 OPEN STANDBY DSC_OPEN REALTIME VALID #================================================================================#
檢視日誌
[dmdba@cjc-db-03 log]$ tail -10f dmmonitor_20221010155019.log
[monitor] 2022-10-10 15:54:19: GROUP OGUID MON_CONFIRM MODE MPP_FLAG GRP1 453331 TRUE AUTO FALSE <<DATABASE GLOBAL INFO:>> DW_IP MAL_DW_PORT WTIME WTYPE WCTLSTAT WSTATUS INAME INST_OK N_EP N_OK ISTATUS IMODE DSC_STATUS RTYPE RSTAT 172.16.6.101 52141 2022-10-10 15:54:18 GLOBAL VALID STARTUP CHEN OK 1 1 MOUNT PRIMARY DSC_OPEN REALTIME VALID EP INFO: INST_IP INST_PORT INST_OK INAME ISTATUS IMODE DSC_SEQNO DSC_CTL_NODE RTYPE RSTAT FSEQ FLSN CSEQ CLSN DW_STAT_FLAG 172.16.6.101 5238 OK CHEN MOUNT PRIMARY 0 0 REALTIME VALID 5510 39941 5510 39941 NONE
十:故障排查
10.1 啟動 dmwatcher 後資料庫沒有自動 OPEN
問題現象:
1. 啟動 dmwatcher 後資料庫沒有自動 OPEN 。
2. 啟動 dmmonitor 後,沒有備庫資訊,主庫狀態為 MOUNT 。
主庫
[dmdba@cjc-db-03 dm8]$ disql SYSDBA/Dameng123:5238 Server[LOCALHOST:5238]:mode is primary, state is mount login used time : 4.614(ms) disql V8 SQL> select status$ from v$instance; LINEID STATUS$ ---------- ------- 1 MOUNT used time: 12.026(ms). Execute id is 0.
嘗試手動啟動,報錯
SQL> alter database open; alter database open; [-720]:Error in line: 1 Dmwatcher is active, or current configuration(ALTER_MODE_STATUS) not allowed to alter database. used time: 0.733(ms). Execute id is 0.
問題原因:
主、備庫的防火牆和 selinux 沒有關閉
解決方案:
關閉主、備庫的防火牆和 selinux ,恢復正常。
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/29785807/viewspace-2917691/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- 達夢DEM部署主備守護叢集
- 達夢資料庫DM8主備叢集測試記錄資料庫
- 達夢資料庫單例項轉實時同步叢集資料庫單例
- 達夢資料守護系統(主備架構)如何正確重啟備庫架構
- G015-DM-INS-03 達夢資料庫 DM 8 實時主備搭建資料庫
- 達夢資料庫日常運維資料庫運維
- 達夢資料庫DM8共享叢集測試記錄資料庫
- 達夢資料庫備份恢復資料庫
- DM8 資料守護實時主備搭建
- 達夢(DM)資料庫的表空間建立和遷移維護資料庫
- 達夢DMDSC叢集搭建
- 搭建達夢DSC叢集
- 達夢資料庫的備份與還原資料庫
- 時序資料庫的叢集方案?資料庫
- 如何運維多叢集資料庫?58 同城 NebulaGraph Database 運維實踐運維資料庫Database
- 達夢DM7 資料庫之資料守護DG搭建資料庫
- 達夢資料庫如何解除主從關係資料庫
- rac叢集日常維護命令
- 資料庫國產化實戰之達夢資料庫資料庫
- 重啟資料庫叢集伺服器( 主庫伺服器/備庫伺服器 )步驟資料庫伺服器
- SAP RETAIL MM41維護商品主資料的時候可以維護分類資料AI
- 淺談達夢資料庫的備份與恢復資料庫
- 基於X-86平臺的達夢8守護叢集搭建
- 達夢資料庫安裝資料庫
- 初識達夢資料庫資料庫
- 達夢資料庫開發資料庫
- 達夢資料庫學習資料庫
- ODPS主備叢集雙向資料複製導致主備中心網路打爆問題
- MySQL叢集搭建(1)-主備搭建MySql
- 達夢8MPP叢集(2節點+順序備)linux下部署Linux
- 【資料庫】Redis叢集篇資料庫Redis
- 【達夢】Docker安裝達夢資料庫 dm8Docker資料庫
- 達夢資料庫(DM8)大規模並行叢集MPP 2節點安裝部署資料庫並行
- 達夢資料庫基礎知識(三)達夢資料庫記憶體結構資料庫記憶體
- 通過memberlist庫實現gossip管理叢集以及叢集資料互動Go
- 架構設計|基於 raft-listener 實現實時同步的主備叢集架構Raft
- 資料庫常用維護命令資料庫
- Kubernetes實戰:高可用叢集的搭建和部署