达梦redo log损坏的处理办法
在一次数据库实例重启的过程中,数据库启动失败,报如下的错误
[dmdba@dsc3 bin]$ ./DmServiceDMSERVER restart
Stopping DmServiceDMSERVER: [ OK ]
Starting DmServiceDMSERVER: [ FAILED ]
file dm.key not found, use default license!
version info: develop
DM Database Server x64 V8 1-2-38-21.07.09-143359-10018-ENT 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 2022-07-09
rfil grp init log file /d| |
mdata/DAMENG/DAMENG01.log error, code = -717
在初步诊断后,发现日志文件DAMENG01.log损坏。
处理过程
重新初始化一个新的数据库,初始化参数要和原库一样,比如页大小、大小写敏感、字符集等。
查看初始化数据库时产生的日志
[dmdba@dsc3 DAMENG.bak]$ cat dminit20211107224222.log
start init database: V8, 2021-11-07 22:42:22
init params:
db path: /dmdata/DAMENG
db name: DAMENG
auto overwrite: 0
page size: 32768
extent size: 16
time zone: +08:00
string case sensitive: 1
charset: 1
length in char: 1
page check mode: 0
priv flag: 0
rlog enc flag: 0
use new hash: 1
blank pad mode: 0
sec priv mode: 0
huge with delta: 1
rlog gen for huge: 0
pseg_mgr_flag: 0
char_fix_storage: 0
sql_log_forbid: 0
secur_flag: 2
log file path: /dmdata/DAMENG/DAMENG01.log
log file path: /dmdata/DAMENG/DAMENG02.log
create ini file /dmdata/DAMENG/dm.ini success.
create rlog file /dmdata/DAMENG/DAMENG01.log success.
create rlog file /dmdata/DAMENG/DAMENG02.log success.
SYSTEM file : /dmdata/DAMENG/SYSTEM.DBF
MAIN file : /dmdata/DAMENG/MAIN.DBF
ROLL file : /dmdata/DAMENG/ROLL.DBF
create dm database success. 2021-11-07 22:42:25
查看原数据库的魔数
[dmdba@dsc3 bin]$ ./dmmdf TYPE=1 FILE=/dmdata/DAMENG/SYSTEM.DBF
dmmdf V8
**********************************************************
**1 db_magic=1502558514**
2 next_trxid=5040
3 pemnt_magic=429000718
**********************************************************
Please input which parameter you want to change(1-3), q to quit:
将原数据库备份后,初始化新的数据库
[dmdba@dsc3 bin]$ ./dminit path=/dmdata PAGE_SIZE=32 EXTENT_SIZE=16
CHARSET=1
initdb V8
db version: 0x7000c
file dm.key not found, use default license!
License will expire on 2022-07-09
Normal of FAST
Normal of DEFAULT
Normal of RECYCLE
Normal of KEEP
Normal of ROLL
log file path: /dmdata/DAMENG/DAMENG01.log
log file path: /dmdata/DAMENG/DAMENG02.log
write to dir [/dmdata/DAMENG].
create dm database success. 2021-11-09 10:52:54
将新生产的DAMENG01.log复制到原库的目录下
[dmdba@dsc3 DAMENG]$ cp DAMENG01.log …/DAMENG.bak/
使用 dmmdf 工具设置 DAMENG01.log 文件的 db_magic,设置为步骤 中记录的值。
[dmdba@dsc3 bin]$ ./dmmdf TYPE=2 FILE=/dmdata/DAMENG/DAMENG01.log
dmmdf V8
**********************************************************
1 sig = DMRLOG
2 ver = 7006
3 chksum = 145635124
4 sta = 1
5 n_magic = 7
6 **db_magic = 121732074**
7 len = 268435456
8 free = 7222784
9 clsn = 33282
10 clsn_fil = 0
11 clsn_off = 7222784
12 pemnt_magic = 429000718
13 fil_id = 0
15 next_seq = 3622
16 g_next_seq = 3622
17 arch_lsn = 0
18 arch_seq = 0
19 dbversion = 0x7000c
20 min_exec_version = V8.1.1.1
21 min_dct_version = 4
22 p_db_magic = 0
23 n_apply_ep = 0
24 apply_info_lsn = 0
pkg_seq_arr: (0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)
apply_lsn_arr: (0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)
25 recv_p_db_magic = 0
26 recv_n_apply_ep = 0
recv_pkg_seq_arr: (0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)
recv_apply_lsn_arr: (0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)
**********************************************************
You can only reset sta(4) or db_magic (6) or clsn (9) or clsn_fil(10) or clsn_off(11) or pemnt_magic(12) or fil_id(13) or next_seq(15) or g_next_seq(16) or p_db_magic(20) or n_apply_ep(21).
**Please input the num which one you want to change, q to quit: 6**
**Input the new value: 1502558514**
**********************************************************
1 sig = DMRLOG
2 ver = 7006
3 chksum = 1449162220
4 sta = 1
5 n_magic = 7
6 db_magic = 1502558514
7 len = 268435456
8 free = 7222784
9 clsn = 33282
10 clsn_fil = 0
11 clsn_off = 7222784
12 pemnt_magic = 429000718
13 fil_id = 0
15 next_seq = 3622
16 g_next_seq = 3622
17 arch_lsn = 0
18 arch_seq = 0
19 dbversion = 0x7000c
20 min_exec_version = V8.1.1.1
21 min_dct_version = 4
22 p_db_magic = 0
23 n_apply_ep = 0
24 apply_info_lsn = 0
pkg_seq_arr: (0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)
apply_lsn_arr: (0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)
25 recv_p_db_magic = 0
26 recv_n_apply_ep = 0
recv_pkg_seq_arr: (0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)
recv_apply_lsn_arr: (0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)
**********************************************************
Do you want to quit and save the change to file (y/n): y
Save to file success!
[dmdba@dsc3 bin]$
修改魔数成功后,重启数据库服务
[dmdba@dsc3 bin]$ ./DmServiceDMSERVER start
Starting DmServiceDMSERVER: [ OK ]
1
数据库启动成功
更多资讯请上达梦技术社区了解:https://eco.dameng.com
————————————————
版权声明:本文为CSDN博主「chenlinlong」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/chenlinlong/article/details/121235184
相关文章