达梦数据库学习笔记之 — 当current redo和undo都损坏(无备份),只有歇菜
本站文章除注明转载外,均为本站原创: 转载自love wife love life —Roger的Oracle/MySQL/PostgreSQL数据恢复博客
之前测试了达梦数据库的几种恢复场景,比如redo丢失,undo丢失都没问题;其中redo丢失后,进行了简单构造,竟然能恢复成功也不丢失;
当时怀疑难道达梦不会进行脏数据落盘嘛?这里进行了简单测试:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 |
+++测试验证赃块是否会落盘 SQL> create tablespace roger datafile '/opt/dm/dmdbms/data/enmotech/roger01.dbf' size 32; executed successfully used time: 28.953(ms). Execute id is 34. SQL> create table test0829(a varchar2(20),b number) tablespace roger; executed successfully used time: 9.220(ms). Execute id is 35. SQL> insert into test0829 values('enmotech.com',10); affect rows 1 used time: 1.772(ms). Execute id is 36. SQL> insert into test0829 values('baidu.com',11); affect rows 1 used time: 1.322(ms). Execute id is 37. SQL> insert into test0829 values('killdb.com',12); affect rows 1 used time: 1.528(ms). Execute id is 38. SQL> commit; executed successfully used time: 2.107(ms). Execute id is 39. SQL> select id,path,STATUS$,TOTAL_SIZE,FREE_SIZE,PAGE_SIZE from v$datafile; ID PATH STATUS$ TOTAL_SIZE FREE_SIZE PAGE_SIZE ----------- ------------------------------------------- ----------- -------------------- -------------------- ----------- 0 /opt/dm/dmdbms/data/enmotech/SYSTEM.DBF 1 3072 2295 8192 0 /opt/dm/dmdbms/data/enmotech/ROLL.DBF 1 59264 58979 8192 0 /opt/dm/dmdbms/data/enmotech/TEMP.DBF 1 131072 131064 8192 0 /opt/dm/dmdbms/data/enmotech/MAIN.DBF 1 552960 6706 8192 0 /opt/dm/dmdbms/data/enmotech/enmotech01.dbf 1 521728 503931 8192 1 /opt/dm/dmdbms/data/enmotech/enmotech02.dbf 1 24704 24692 8192 0 /opt/dm/dmdbms/data/enmotech/roger01.dbf 1 4096 4081 8192 7 rows got used time: 7.026(ms). Execute id is 40. SQL> select HEADER_FILE,HEADER_BLOCK,BYTES,BLOCKS,EXTENTS,RELATIVE_FNO from DBA_SEGMENTS where segment_name=upper('test0829'); HEADER_FILE HEADER_BLOCK BYTES BLOCKS EXTENTS RELATIVE_FNO ----------- ------------ -------------------- -------------------- -------------------- ------------ 0 16 131072 16 1 0 used time: 122.130(ms). Execute id is 41. SQL> SQL> select rowid,a,b,dump(a,16),dump(b,16) from test0829 order by 1; ROWID A B DUMP(A,16) DUMP(B,16) -------------------- ------------ -- ------------------------------------------------- ----------------- 10753 enmotech.com 10 Typ=2 Len=12: 65,6e,6d,6f,74,65,63,68,2e,63,6f,6d Typ=9 Len=2: c1,b 10754 baidu.com 11 Typ=2 Len=9: 62,61,69,64,75,2e,63,6f,6d Typ=9 Len=2: c1,c 10755 killdb.com 12 Typ=2 Len=10: 6b,69,6c,6c,64,62,2e,63,6f,6d Typ=9 Len=2: c1,d used time: 2.009(ms). Execute id is 44. SQL> SQL> select dump(9,16),dump(10,16),dump(11,16),dump(12,16) from dual; DUMP(9,16) DUMP(10,16) DUMP(11,16) DUMP(12,16) -------------------- -------------------- -------------------- -------------------- Typ=7 Len=4: 9,0,0,0 Typ=7 Len=4: a,0,0,0 Typ=7 Len=4: b,0,0,0 Typ=7 Len=4: c,0,0,0 used time: 2.155(ms). Execute id is 45. SQL> |
将该表所在数据文件的一个extent block全部进行dd dump:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 |
[dmdba@mogdb ~]$ dd if=/opt/dm/dmdbms/data/enmotech/roger01.dbf of=/tmp/dd1.dbf bs=8192 skip=16 count=18 18+0 records in 18+0 records out 147456 bytes (147 kB) copied, 0.00070668 s, 209 MB/s [dmdba@mogdb ~]$ [dmdba@mogdb ~]$ od -x /tmp/dd1.dbf 0000000 0007 0000 0010 0000 ffff ffff ffff ffff 0000020 ffff ffff 0014 0000 0000 0000 04b8 0530 0000040 0000 0000 0002 0062 0000 0000 0000 ffff 0000060 0052 005a ffff 006e 0001 0507 0200 ffff 0000100 ffff ffff ffff ffff 0007 0000 0008 0000 0000120 0034 0000 0000 0000 0000 ffff ffff ffff 0000140 ffff 0000 0001 0000 0012 0000 0000 0000 0000160 0000 0000 0014 0000 0000 0000 0000 0000 0000200 0000 0000 0000 0000 0000 0000 0000 0000 * 0017760 0000 0000 005a 0052 0000 0000 0000 0000 0020000 0007 0000 0011 0000 ffff ffff ffff ffff 0020020 ffff ffff 1a1a 1a1a 0000 0000 04cc 0530 0020040 0000 0000 0002 0062 0000 0000 0000 ffff 0020060 0052 005a ffff 006e 0000 0000 0000 0000 0020100 0000 0000 0000 0001 0000 0003 0000 0000 0020120 0000 ffff ffff ffff 7fff ffff ffff ffff 0020140 ffff 0000 0000 0000 0000 0000 0000 0000 0020160 0000 0000 0000 0000 0000 0000 0000 0000 * 0037760 0000 0000 005a 0052 0000 0000 0000 0000 0040000 0007 0000 0012 0000 ffff ffff ffff 0000 0040020 0013 0000 0014 0000 0000 0000 04b8 0530 0040040 0000 0000 0002 0062 0000 0000 0000 ffff 0040060 0052 005a ffff 006e 0000 0507 0200 0000 0040100 0000 0000 0000 0000 0000 0000 0000 0000 0040120 0000 0013 0000 0000 0000 ffff ffff ffff 0040140 ffff 0000 0000 0000 0000 0000 0000 0000 0040160 0000 0000 0000 0000 0000 0000 0000 0000 * 0057760 0000 0000 005a 0052 0000 0000 0000 0000 0060000 0007 0000 0013 0000 0000 0012 0000 ffff 0060020 ffff ffff 0014 0000 0000 0000 04b8 0530 0060040 0000 0000 0002 0062 0000 0000 0000 ffff 0060060 0052 005a ffff 006e 0000 0507 0200 0000 0060100 0000 0000 0000 0000 0000 0000 0000 0000 0060120 0000 0000 0000 0000 0000 ffff ffff ffff 0060140 ffff 0000 0000 0000 0000 0000 0000 0000 0060160 0000 0000 0000 0000 0000 0000 0000 0000 * 0077760 0000 0000 005a 0052 0000 0000 0000 0000 0100000 0007 0000 0014 0000 ffff ffff ffff 0000 0100020 0015 0000 0014 0000 0000 0000 04b8 0530 0100040 0000 0000 0002 0062 0000 0000 0000 ffff 0100060 0052 005a ffff 006e 0000 0507 0200 0000 0100100 0000 0000 0000 0000 0000 0000 0000 0000 0100120 0000 0015 0000 0000 0000 ffff ffff ffff 0100140 ffff 0000 0000 0000 0000 0000 0000 0000 0100160 0000 0000 0000 0000 0000 0000 0000 0000 * 0117760 0000 0000 005a 0052 0000 0000 0000 0000 0120000 0007 0000 0015 0000 0000 0014 0000 ffff 0120020 ffff ffff 0014 0000 0000 0000 04c9 0530 0120040 0000 0000 0005 00bd 0000 0000 0003 ffff 0120060 0052 005a ffff 00cf 0000 0507 0200 0000 0120100 0000 0000 0000 0000 0000 0000 0000 0000 0120120 0000 0000 0000 0000 0000 ffff ffff ffff 0120140 ffff 2000 8c00 6e65 6f6d 6574 6863 632e --enmotech.com 0120160 6d6f c182 ff0b ffff 7fff ffff 4885 000d 0120200 0000 1d00 8900 6162 6469 2e75 6f63 826d --baidu.com 0120220 0cc1 ffff ffff ff7f 85ff 0d48 0000 0000 0120240 001e 6b8a 6c69 646c 2e62 6f63 826d 0dc1 --roger.com 0120260 ffff ffff ff7f 85ff 0d48 0000 0000 0000 0120300 0000 0000 0000 0000 0000 0000 0000 0000 * 0137740 0000 0000 0000 0000 0000 0000 0000 005a 0137760 009f 0082 0062 0052 0000 0000 0000 0000 0140000 0000 0000 0000 0000 0000 0000 0000 0000 * 0440000 [dmdba@mogdb ~]$ |
可以看到,很容易找到我们这个测试表的几条数据;接下来手工插入一下数据,并触发checkpoint:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 |
---session 1 SQL> insert into test0829 values('mogdb.com',66); affect rows 1 used time: 2.582(ms). Execute id is 46. SQL> select checkpoint(100); CHECKPOINT(100) --------------- 0 used time: 6.470(ms). Execute id is 47. SQL> alter system switch logfile; executed successfully used time: 7.887(ms). Execute id is 0. SQL> alter system archive log current; executed successfully used time: 1.424(ms). Execute id is 0. SQL> SQL> select dump('mogdb.com',16),dump(66,16) from dual; DUMP('mogdb.com',16) DUMP(66,16) --------------------------------------- --------------------- Typ=2 Len=9: 6d,6f,67,64,62,2e,63,6f,6d Typ=7 Len=4: 42,0,0,0 used time: 1.582(ms). Execute id is 48. SQL> --session 2 [dmdba@mogdb ~]$ disql sysdba/roger007 Server[LOCALHOST:5236]:mode is normal, state is open login used time : 7.446(ms) disql V8 SQL> select * from test0829; LINEID A B ---------- ------------ -- 1 enmotech.com 10 2 baidu.com 11 3 killdb.com 12 used time: 6.783(ms). Execute id is 204. SQL> --再次dump 表数据 [dmdba@mogdb ~]$ dd if=/opt/dm/dmdbms/data/enmotech/roger01.dbf of=/tmp/dd2.dbf bs=8192 skip=16 count=50 50+0 records in 50+0 records out 409600 bytes (410 kB) copied, 0.00091234 s, 449 MB/s [dmdba@mogdb ~]$ od -x /tmp/dd2.dbf 0000000 0007 0000 0010 0000 ffff ffff ffff ffff 0000020 ffff ffff 0014 0000 0000 0000 04b8 0530 0000040 0000 0000 0002 0062 0000 0000 0000 ffff 0000060 0052 005a ffff 006e 0001 0507 0200 ffff 0000100 ffff ffff ffff ffff 0007 0000 0008 0000 0000120 0034 0000 0000 0000 0000 ffff ffff ffff 0000140 ffff 0000 0001 0000 0012 0000 0000 0000 0000160 0000 0000 0014 0000 0000 0000 0000 0000 0000200 0000 0000 0000 0000 0000 0000 0000 0000 * 0017760 0000 0000 005a 0052 0000 0000 0000 0000 0020000 0007 0000 0011 0000 ffff ffff ffff ffff 0020020 ffff ffff 1a1a 1a1a 0000 0000 04cc 0530 0020040 0000 0000 0002 0062 0000 0000 0000 ffff 0020060 0052 005a ffff 006e 0000 0000 0000 0000 0020100 0000 0000 0000 0001 0000 0003 0000 0000 0020120 0000 ffff ffff ffff 7fff ffff ffff ffff 0020140 ffff 0000 0000 0000 0000 0000 0000 0000 0020160 0000 0000 0000 0000 0000 0000 0000 0000 * 0037760 0000 0000 005a 0052 0000 0000 0000 0000 0040000 0007 0000 0012 0000 ffff ffff ffff 0000 0040020 0013 0000 0014 0000 0000 0000 04b8 0530 0040040 0000 0000 0002 0062 0000 0000 0000 ffff 0040060 0052 005a ffff 006e 0000 0507 0200 0000 0040100 0000 0000 0000 0000 0000 0000 0000 0000 0040120 0000 0013 0000 0000 0000 ffff ffff ffff 0040140 ffff 0000 0000 0000 0000 0000 0000 0000 0040160 0000 0000 0000 0000 0000 0000 0000 0000 * 0057760 0000 0000 005a 0052 0000 0000 0000 0000 0060000 0007 0000 0013 0000 0000 0012 0000 ffff 0060020 ffff ffff 0014 0000 0000 0000 04b8 0530 0060040 0000 0000 0002 0062 0000 0000 0000 ffff 0060060 0052 005a ffff 006e 0000 0507 0200 0000 0060100 0000 0000 0000 0000 0000 0000 0000 0000 0060120 0000 0000 0000 0000 0000 ffff ffff ffff 0060140 ffff 0000 0000 0000 0000 0000 0000 0000 0060160 0000 0000 0000 0000 0000 0000 0000 0000 * 0077760 0000 0000 005a 0052 0000 0000 0000 0000 0100000 0007 0000 0014 0000 ffff ffff ffff 0000 0100020 0015 0000 0014 0000 0000 0000 04b8 0530 0100040 0000 0000 0002 0062 0000 0000 0000 ffff 0100060 0052 005a ffff 006e 0000 0507 0200 0000 0100100 0000 0000 0000 0000 0000 0000 0000 0000 0100120 0000 0015 0000 0000 0000 ffff ffff ffff 0100140 ffff 0000 0000 0000 0000 0000 0000 0000 0100160 0000 0000 0000 0000 0000 0000 0000 0000 * 0117760 0000 0000 005a 0052 0000 0000 0000 0000 0120000 0007 0000 0015 0000 0000 0014 0000 ffff 0120020 ffff ffff 0014 0000 0000 0000 04d0 0530 0120040 0000 0000 0006 00da 0000 0000 0004 ffff 0120060 0052 005a ffff 00ee 0000 0507 0200 0000 0120100 0000 0000 0000 0000 0000 0000 0000 0000 0120120 0000 0000 0000 0000 0000 ffff ffff ffff 0120140 ffff 2000 8c00 6e65 6f6d 6574 6863 632e 0120160 6d6f c182 ff0b ffff 7fff ffff 4885 000d 0120200 0000 1d00 8900 6162 6469 2e75 6f63 826d 0120220 0cc1 ffff ffff ff7f 85ff 0d48 0000 0000 0120240 001e 6b8a 6c69 646c 2e62 6f63 826d 0dc1 0120260 ffff ffff ff7f 85ff 0d48 0000 0000 001d 0120300 6d89 676f 6264 632e 6d6f c182 ff43 ffff ---6d 6f 67 64 62 2e 63 6f 6d (mogdb.com) 0120320 7fff ffff 4886 000d 0000 0000 0000 0000 0120340 0000 0000 0000 0000 0000 0000 0000 0000 * 0137740 0000 0000 0000 0000 0000 0000 005a 00bd 0137760 009f 0082 0062 0052 0000 0000 0000 0000 0140000 0000 0000 0000 0000 0000 0000 0000 0000 * 1440000 [dmdba@mogdb ~]$ |
我们可以看到,脏数据已经在数据文件中了;虽然事务没有提交。
下面我们继续测试当current redo丢失,同时undo文件也损坏或者丢失的情况下,达梦数据库有办法能够打开吗?
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 |
+++++测试如果同时删掉undo和redo,那么达梦还能正常起来吗 SQL> select a.rowid,a.* from test0829 a; ROWID A B -------------------- ------------ -- 10753 enmotech.com 10 10754 baidu.com 11 10755 killdb.com 12 used time: 1.007(ms). Execute id is 16. SQL> delete from test0829 where rowid=10754; affect rows 1 used time: 1.396(ms). Execute id is 17. SQL> select CKPT_LSN,FILE_LSN,FLUSH_LSN,CUR_LSN,NEXT_SEQ,CUR_FILE,CUR_OFFSET,FREE_SPACE from v$rlog; CKPT_LSN FILE_LSN FLUSH_LSN CUR_LSN NEXT_SEQ CUR_FILE CUR_OFFSET FREE_SPACE -------------------- -------------------- -------------------- -------------------- -------------------- ----------- -------------------- -------------------- 87034072 87034077 87034077 87034078 394 0 85315072 9504270336 used time: 2.243(ms). Execute id is 19. SQL> SQL> select group_id,file_id,path,RLOG_SIZE from v$rlogfile; GROUP_ID FILE_ID PATH RLOG_SIZE ----------- ----------- ------------------------------------------- -------------------- 2 0 /opt/dm/dmdbms/data/enmotech/enmotech01.log 3145728000 2 1 /opt/dm/dmdbms/data/enmotech/enmotech02.log 3145728000 2 2 /opt/dm/dmdbms/data/enmotech/enmotech03.log 3145728000 2 3 /opt/dm/dmdbms/data/enmotech/enmotech04.log 33554432 2 4 /opt/dm/dmdbms/data/enmotech/enmotech05.log 33554432 used time: 1.656(ms). Execute id is 21. SQL> select id,path,status$,rw_status from v$datafile; ID PATH STATUS$ RW_STATUS ----------- ------------------------------------------- ----------- ----------- 0 /opt/dm/dmdbms/data/enmotech/SYSTEM.DBF 1 2 0 /opt/dm/dmdbms/data/enmotech/ROLL.DBF 1 2 0 /opt/dm/dmdbms/data/enmotech/TEMP.DBF 1 2 0 /opt/dm/dmdbms/data/enmotech/MAIN.DBF 1 2 0 /opt/dm/dmdbms/data/enmotech/enmotech01.dbf 1 2 1 /opt/dm/dmdbms/data/enmotech/enmotech02.dbf 1 2 0 /opt/dm/dmdbms/data/enmotech/roger01.dbf 1 2 7 rows got used time: 3.221(ms). Execute id is 22. SQL> host rm -rf /opt/dm/dmdbms/data/enmotech/enmotech01.log 3145728000 SQL> host rm -rf /opt/dm/dmdbms/data/enmotech/ROLL.DBF SQL> shutdown abort; executed successfully used time: 2.397(ms). Execute id is 0. SQL> |
同时删除current redo和undo后,此时去启动数据库会报什么错误呢?
1 2 3 4 5 6 7 8 9 10 11 |
[dmdba@mogdb ~]$ DmServicedmdb start Starting DmServicedmdb: [ FAILED ] file dm.key not found, use default license! version info: develop Use normal os_malloc instead of HugeTLB Use normal os_malloc instead of HugeTLB DM Database Server x64 V8 1-1-126-20.09.04-126608-ENT startup... Database mode = 0, oguid = 0 [WARN]tablespace TEST_RECOVER is corrupted(state: 3), restore or drop please. /opt/dm/dmdbms/data/enmotech/ROLL.DBF not exist, can not startup [dmdba@mogdb ~]$ |
直接提示我们的回滚段文件不存在,无法启动数据库。ok!既然如此,那么我们接下来重建一下控制文件,将回滚段文件从控制文件中删除:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 |
+++ 重建控制文件,并从控制文件中删掉回滚段表空间 [dmdba@mogdb enmotech]$ dmctlcvt c2t dm.ctl dm_0830.txt DMCTLCVT V8 convert ctl to txt success! -- 编辑dm_0830.txt文件,将回滚段文件信息注释掉 # table space name #ts_name=ROLL # table space ID #ts_id=1 # table space status #ts_state=0 # table space cache ts_cache= # DSC node number #ts_nth=0 # table space create time #ts_create_time=DATETIME '2021-5-26 2:6:28' # table space modify time #ts_modify_time=DATETIME '2021-5-26 2:6:28' # table space encrypt flag #ts_encrypt_flag=0 # table space copy num #ts_copy_num=0 # table space region size flag #ts_size_flag=0 #----------------------------------------------- # file path #fil_path=/opt/dm/dmdbms/data/enmotech/ROLL.DBF # mirror path #mirror_path= # file id #fil_id=0 # whether the file is auto extend autoextend=1 # file create time #fil_create_time=DATETIME '2021-5-26 2:6:28' # file modify time #fil_modify_time=DATETIME '2021-5-26 2:6:28' # the max size of file #fil_max_size=0 # next size of file #fil_next_size=0 [dmdba@mogdb enmotech]$ dmctlcvt t2c dm_0830.txt dm.ctl DMCTLCVT V8 convert txt to ctl success! [dmdba@mogdb enmotech]$ |
接下来我们继续构造丢失的redo文件:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 |
+++ 构造current redo [dmdba@mogdb enmotech]$ cp enmotech02.log enmotech01.log [dmdba@mogdb enmotech]$ [dmdba@mogdb enmotech]$ dmmdf TYPE=2 FILE=enmotech01.log dmmdf V8 ********************************************************** 1 sig = DMRLOG 2 ver = 7006 3 chksum = -1166114605 4 sta = 0 5 n_magic = 7 6 db_magic = 148545590 7 len = 3145728000 8 free = 2528041472 9 clsn = 0 10 clsn_fil = 0 11 clsn_off = 0 12 pemnt_magic = 272050232 13 fil_id = 1 15 next_seq = 0 16 g_next_seq = 0 17 arch_lsn = 0 18 arch_seq = 0 19 dbversion = 0x7000b 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 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: 13 Input the new value: 0 ********************************************************** 1 sig = DMRLOG 2 ver = 7006 3 chksum = -1166114606 4 sta = 0 5 n_magic = 7 6 db_magic = 148545590 7 len = 3145728000 8 free = 2528041472 9 clsn = 0 10 clsn_fil = 0 11 clsn_off = 0 12 pemnt_magic = 272050232 13 fil_id = 0 15 next_seq = 0 16 g_next_seq = 0 17 arch_lsn = 0 18 arch_seq = 0 19 dbversion = 0x7000b 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@mogdb enmotech]$ dmmdf TYPE=2 FILE=enmotech01.log dmmdf V8 ********************************************************** 1 sig = DMRLOG 2 ver = 7006 3 chksum = -1166114606 4 sta = 0 5 n_magic = 7 6 db_magic = 148545590 7 len = 3145728000 8 free = 2528041472 9 clsn = 0 10 clsn_fil = 0 11 clsn_off = 0 12 pemnt_magic = 272050232 13 fil_id = 0 15 next_seq = 0 16 g_next_seq = 0 17 arch_lsn = 0 18 arch_seq = 0 19 dbversion = 0x7000b 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 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: 4 Input the new value: 1 ********************************************************** 1 sig = DMRLOG 2 ver = 7006 3 chksum = -1166114605 4 sta = 1 5 n_magic = 7 6 db_magic = 148545590 7 len = 3145728000 8 free = 2528041472 9 clsn = 0 10 clsn_fil = 0 11 clsn_off = 0 12 pemnt_magic = 272050232 13 fil_id = 0 15 next_seq = 0 16 g_next_seq = 0 17 arch_lsn = 0 18 arch_seq = 0 19 dbversion = 0x7000b 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@mogdb enmotech]$ dmmdf TYPE=2 FILE=enmotech01.log dmmdf V8 ********************************************************** 1 sig = DMRLOG 2 ver = 7006 3 chksum = -1166114605 4 sta = 1 5 n_magic = 7 6 db_magic = 148545590 7 len = 3145728000 8 free = 2528041472 9 clsn = 0 10 clsn_fil = 0 11 clsn_off = 0 12 pemnt_magic = 272050232 13 fil_id = 0 15 next_seq = 0 16 g_next_seq = 0 17 arch_lsn = 0 18 arch_seq = 0 19 dbversion = 0x7000b 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 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: 9 Input the new value: 87034082 ********************************************************** 1 sig = DMRLOG 2 ver = 7006 3 chksum = -1085372367 4 sta = 1 5 n_magic = 7 6 db_magic = 148545590 7 len = 3145728000 8 free = 2528041472 9 clsn = 87034082 10 clsn_fil = 0 11 clsn_off = 0 12 pemnt_magic = 272050232 13 fil_id = 0 15 next_seq = 0 16 g_next_seq = 0 17 arch_lsn = 0 18 arch_seq = 0 19 dbversion = 0x7000b 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@mogdb enmotech]$ dmmdf TYPE=2 FILE=enmotech01.log dmmdf V8 ********************************************************** 1 sig = DMRLOG 2 ver = 7006 3 chksum = -1085372367 4 sta = 1 5 n_magic = 7 6 db_magic = 148545590 7 len = 3145728000 8 free = 2528041472 9 clsn = 87034082 10 clsn_fil = 0 11 clsn_off = 0 12 pemnt_magic = 272050232 13 fil_id = 0 15 next_seq = 0 16 g_next_seq = 0 17 arch_lsn = 0 18 arch_seq = 0 19 dbversion = 0x7000b 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 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: 16 Input the new value: 739441 ********************************************************** 1 sig = DMRLOG 2 ver = 7006 3 chksum = -1274611407 4 sta = 1 5 n_magic = 7 6 db_magic = 148545590 7 len = 3145728000 8 free = 2528041472 9 clsn = 87034082 10 clsn_fil = 0 11 clsn_off = 0 12 pemnt_magic = 272050232 13 fil_id = 0 15 next_seq = 0 16 g_next_seq = 739441 17 arch_lsn = 0 18 arch_seq = 0 19 dbversion = 0x7000b 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! |
最后我们来尝试启动数据库,看看效果:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
[dmdba@mogdb enmotech]$ DmServicedmdb start Starting DmServicedmdb: /opt/dmdbms/bin/DmServicedmdb: line 400: 11268 Floating point exception(core dumped) eval exec "\"$EXEC_PROG_FULL_PATH\"" "$STARTUP_PARAMS" -noconsole $TMP_START_MODE > "$SERVICE_LOG_FILE" 2>&1 [ FAILED ] file dm.key not found, use default license! version info: develop Use normal os_malloc instead of HugeTLB Use normal os_malloc instead of HugeTLB DM Database Server x64 V8 1-1-126-20.09.04-126608-ENT startup... Database mode = 0, oguid = 0 [WARN]tablespace TEST_RECOVER is corrupted(state: 3), restore or drop please. License will expire on 2021-09-13 file lsn: 87034082 ndct db load finished ndct fill fast pool finished iid page's trxid[874536] [dmdba@mogdb enmotech]$ |
此时数据库日志信息如下:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 |
2021-08-30 05:39:55.118 [INFO] database P0000011679 T0000000000000011679 iid_set_new_next_trxid_if_necessary, next_trxid: 874536 2021-08-30 05:39:55.118 [INFO] database P0000011679 T0000000000000011679 iid page's trxid[874536] 2021-08-30 05:39:55.118 [FATAL] database P0000011679 T0000000000000011679 Fail to find file in current system. tsid:1, fileid:0 2021-08-30 05:39:55.118 [FATAL] database P0000011679 T0000000000000011679 code = -1, dm_sys_halt now!!! 2021-08-30 05:39:55.118 [INFO] database P0000011679 T0000000000000011679 total 5 rfil opened! 2021-08-30 05:39:55.119 [INFO] database P0000011679 T0000000000000011679 begin generate gdb thread info... 2021-08-30 05:39:55.681 [INFO] database P0000011679 T0000000000000011679 gdb thread info Thread 17 (Thread 0x7fa827801700 (LWP 11683)): #0 0x00007fa9a4916965 in pthread_cond_wait@@GLIBC_2.3.2 () #1 0x000000000041d0db in os_semaphore_p () #2 0x00000000013ae462 in nsvr_quit_thread () #3 0x00007fa9a4912dd5 in start_thread () from /lib64/libpthread.so.0 #4 0x00007fa9a3e2eead in clone () from /lib64/libc.so.6 Thread 16 (Thread 0x7fa81942d700 (LWP 11684)): #0 0x00007fa9a4916965 in pthread_cond_wait@@GLIBC_2.3.2 () #1 0x000000000041d0db in os_semaphore_p () #2 0x0000000000416622 in os_io_thread_sema () #3 0x000000000041699b in os_io_thread () #4 0x00007fa9a4912dd5 in start_thread () from /lib64/libpthread.so.0 #5 0x00007fa9a3e2eead in clone () from /lib64/libc.so.6 Thread 15 (Thread 0x7fa81932c700 (LWP 11685)): #0 0x00007fa9a4916965 in pthread_cond_wait@@GLIBC_2.3.2 () #1 0x000000000041d0db in os_semaphore_p () #2 0x0000000000416622 in os_io_thread_sema () #3 0x000000000041699b in os_io_thread () #4 0x00007fa9a4912dd5 in start_thread () from /lib64/libpthread.so.0 #5 0x00007fa9a3e2eead in clone () from /lib64/libc.so.6 Thread 14 (Thread 0x7fa81922b700 (LWP 11686)): #0 0x00007fa9a4916965 in pthread_cond_wait@@GLIBC_2.3.2 () #1 0x000000000041d0db in os_semaphore_p () #2 0x0000000000416622 in os_io_thread_sema () #3 0x000000000041699b in os_io_thread () #4 0x00007fa9a4912dd5 in start_thread () from /lib64/libpthread.so.0 #5 0x00007fa9a3e2eead in clone () from /lib64/libc.so.6 Thread 13 (Thread 0x7fa81912a700 (LWP 11687)): #0 0x00007fa9a4916965 in pthread_cond_wait@@GLIBC_2.3.2 () #1 0x000000000041d0db in os_semaphore_p () #2 0x0000000000416622 in os_io_thread_sema () #3 0x000000000041699b in os_io_thread () #4 0x00007fa9a4912dd5 in start_thread () from /lib64/libpthread.so.0 #5 0x00007fa9a3e2eead in clone () from /lib64/libc.so.6 Thread 12 (Thread 0x7fa819029700 (LWP 11688)): #0 0x00007fa9a4916965 in pthread_cond_wait@@GLIBC_2.3.2 () #1 0x000000000041d0db in os_semaphore_p () #2 0x00000000011d5c1c in rtsk_queue_check () #3 0x00000000011d16f8 in rsys_work_thread () #4 0x00007fa9a4912dd5 in start_thread () from /lib64/libpthread.so.0 #5 0x00007fa9a3e2eead in clone () from /lib64/libc.so.6 Thread 11 (Thread 0x7fa818f28700 (LWP 11689)): #0 0x00007fa9a4916965 in pthread_cond_wait@@GLIBC_2.3.2 () #1 0x000000000041d0db in os_semaphore_p () #2 0x00000000011d5c1c in rtsk_queue_check () #3 0x00000000011d16f8 in rsys_work_thread () #4 0x00007fa9a4912dd5 in start_thread () from /lib64/libpthread.so.0 #5 0x00007fa9a3e2eead in clone () from /lib64/libc.so.6 Thread 10 (Thread 0x7fa818e27700 (LWP 11690)): #0 0x00007fa9a4916965 in pthread_cond_wait@@GLIBC_2.3.2 () #1 0x000000000041d0db in os_semaphore_p () #2 0x00000000011d5c1c in rtsk_queue_check () #3 0x00000000011d16f8 in rsys_work_thread () #4 0x00007fa9a4912dd5 in start_thread () from /lib64/libpthread.so.0 #5 0x00007fa9a3e2eead in clone () from /lib64/libc.so.6 Thread 9 (Thread 0x7fa818d26700 (LWP 11693)): #0 0x00007fa9a4916965 in pthread_cond_wait@@GLIBC_2.3.2 () #1 0x000000000040e14c in os_event2_wait () #2 0x000000000081aaa2 in ckpt2_flush_thread () #3 0x00007fa9a4912dd5 in start_thread () from /lib64/libpthread.so.0 #4 0x00007fa9a3e2eead in clone () from /lib64/libc.so.6 Thread 8 (Thread 0x7fa818c25700 (LWP 11694)): #0 0x00007fa9a4916965 in pthread_cond_wait@@GLIBC_2.3.2 () #1 0x000000000040e14c in os_event2_wait () #2 0x0000000000493a94 in rlog4_flush_thread () #3 0x00007fa9a4912dd5 in start_thread () from /lib64/libpthread.so.0 #4 0x00007fa9a3e2eead in clone () from /lib64/libc.so.6 Thread 7 (Thread 0x7fa818b24700 (LWP 11695)): #0 0x00007fa9a4916965 in pthread_cond_wait@@GLIBC_2.3.2 () #1 0x000000000041d0db in os_semaphore_p () #2 0x0000000001311600 in hio_thread_sema () #3 0x000000000131190e in hio_thread () #4 0x00007fa9a4912dd5 in start_thread () from /lib64/libpthread.so.0 #5 0x00007fa9a3e2eead in clone () from /lib64/libc.so.6 Thread 6 (Thread 0x7fa818a23700 (LWP 11696)): #0 0x00007fa9a4916965 in pthread_cond_wait@@GLIBC_2.3.2 () #1 0x000000000041d0db in os_semaphore_p () #2 0x0000000001311600 in hio_thread_sema () #3 0x000000000131190e in hio_thread () #4 0x00007fa9a4912dd5 in start_thread () from /lib64/libpthread.so.0 #5 0x00007fa9a3e2eead in clone () from /lib64/libc.so.6 Thread 5 (Thread 0x7fa818922700 (LWP 11697)): #0 0x00007fa9a4916965 in pthread_cond_wait@@GLIBC_2.3.2 () #1 0x000000000041d0db in os_semaphore_p () #2 0x0000000001311600 in hio_thread_sema () #3 0x000000000131190e in hio_thread () #4 0x00007fa9a4912dd5 in start_thread () from /lib64/libpthread.so.0 #5 0x00007fa9a3e2eead in clone () from /lib64/libc.so.6 Thread 4 (Thread 0x7fa818821700 (LWP 11698)): #0 0x00007fa9a4916965 in pthread_cond_wait@@GLIBC_2.3.2 () #1 0x000000000041d0db in os_semaphore_p () #2 0x0000000001311600 in hio_thread_sema () #3 0x000000000131190e in hio_thread () #4 0x00007fa9a4912dd5 in start_thread () from /lib64/libpthread.so.0 #5 0x00007fa9a3e2eead in clone () from /lib64/libc.so.6 Thread 3 (Thread 0x7fa818720700 (LWP 11699)): #0 0x00007fa9a4916d12 in pthread_cond_timedwait@@GLIBC_2.3.2 () #1 0x000000000040e2a1 in os_event2_wait_timeout () #2 0x00000000013dbdc2 in slog_flush_thread () #3 0x00007fa9a4912dd5 in start_thread () from /lib64/libpthread.so.0 #4 0x00007fa9a3e2eead in clone () from /lib64/libc.so.6 Thread 2 (Thread 0x7fa81861f700 (LWP 11700)): #0 0x00007fa9a4916d12 in pthread_cond_timedwait@@GLIBC_2.3.2 () #1 0x000000000040e2a1 in os_event2_wait_timeout () #2 0x000000000075d32a in purg2_thread () #3 0x00007fa9a4912dd5 in start_thread () from /lib64/libpthread.so.0 #4 0x00007fa9a3e2eead in clone () from /lib64/libc.so.6 Thread 1 (Thread 0x7fa9a4f34740 (LWP 11679)): #0 0x00007fa9a3e1ff8d in read () from /lib64/libc.so.6 #1 0x00007fa9a3dacb14 in __GI__IO_file_underflow () from /lib64/libc.so.6 #2 0x00007fa9a3dae063 in __GI__IO_default_xsgetn () from /lib64/libc.so.6 #3 0x00007fa9a3d9ffdf in fread () from /lib64/libc.so.6 #4 0x000000000042a11b in dm_sys_halt_gdb () #5 0x000000000042a41a in dm_sys_halt_low () #6 0x0000000000483ff3 in fil_prepare_io () #7 0x0000000000484218 in fil_io () #8 0x0000000000484339 in fil_read_hd () #9 0x00000000004c10df in buf4_page_get_in_fast_pool () #10 0x00000000004c11ff in buf4_page_get_low_for_LRU () #11 0x00000000004adacf in buf4_page_get_org () #12 0x0000000000785961 in pseg_get_nth_slot_page () #13 0x0000000000786f7e in pseg_set_gtv_trxid () #14 0x0000000000793e22 in pseg_recv_if_necessary () #15 0x00000000013a727d in nsvr_startup () #16 0x000000000040818c in main () |
最后我们参考达梦数据库官方文档建议,将如下参数修改为0:
1 2 3 |
[dmdba@mogdb enmotech]$ cat dm.ini |grep PSEG_RECV PSEG_RECV = 0 #Whether to rollback active transactions and purge committed transactions when system restarts after failure [dmdba@mogdb enmotech]$ |
关于该参数的说明如下:
PSEG_RECV 参数释意:
系统故障重启时,对活动事务和已提交事务的处理方式。
0:跳过回滚活动事务和 PURGE 已经提交事务的步骤。
1:回滚活动事务并 PURGE 已经提交事务;
2:延迟 PURGE 已提交事务,延迟回滚活动事务;
3:回滚活动事务,延迟 PURGE 已提交事务
简单的讲,参数修改为0之后,达梦数据库能够跳过未提交的活动事务;类似Oracle 跳过未提交事务的方式。
不过不幸的是,我尝试了多次启动;发现均不行:
1 2 3 4 5 6 7 8 9 |
2021-08-30 05:28:58.236 [INFO] database P0000011360 T0000000000000011360 plog_redo_init, rlog is null, dsc_seqno:15, set plog_redo->redo_lsn from 0 to 0 2021-08-30 05:28:58.236 [INFO] database P0000011360 T0000000000000011360 os_file_open_normal_rw handle : 12 path : /opt/dm/dmdbms/data/enmotech/dm.ctl 2021-08-30 05:28:58.236 [INFO] database P0000011360 T0000000000000011360 os_file_close_normal : handle: 12 2021-08-30 05:28:58.288 [INFO] database P0000011360 T0000000000000011360 main rfil[/opt/dm/dmdbms/data/enmotech/enmotech01.log]'s sta is active 2021-08-30 05:28:58.288 [ERROR] database P0000011360 T0000000000000011360 Read rfil['/opt/dm/dmdbms/data/enmotech/enmotech01.log'] from offset[0] failed, code[-723] 2021-08-30 05:28:58.288 [INFO] database P0000011360 T0000000000000011360 rfil[/opt/dm/dmdbms/data/enmotech/enmotech01.log], first local_rpkg_seqno = 0, global_rpkg_seqno = 0, first_startup = 0 2021-08-30 05:28:58.288 [INFO] database P0000011360 T0000000000000011360 EP[0]'s cur_lsn[87034082] 2021-08-30 05:28:58.288 [FATAL] database P0000011360 T0000000000000011360 redo_pwr_collect error, code = -723 2021-08-30 05:28:58.288 [INFO] database P0000011360 T0000000000000011360 hlog_sys_destroy, n_logs[1], adjust_sta[0] |
从达梦数据库产生的core文件来看,跟之前的信息类似:
1 2 3 4 5 6 7 8 9 10 11 12 13 |
(gdb) bt #0 0x000000000042a3be in dm_sys_halt_low () #1 0x0000000000483ff3 in fil_prepare_io () #2 0x0000000000484218 in fil_io () #3 0x0000000000484339 in fil_read_hd () #4 0x00000000004c10df in buf4_page_get_in_fast_pool () #5 0x00000000004c11ff in buf4_page_get_low_for_LRU () #6 0x00000000004adacf in buf4_page_get_org () #7 0x0000000000785961 in pseg_get_nth_slot_page () #8 0x0000000000786f7e in pseg_set_gtv_trxid () #9 0x0000000000793e22 in pseg_recv_if_necessary () #10 0x00000000013a727d in nsvr_startup () #11 0x000000000040818c in main () |
由此可见,似乎设置参数之后,达梦数据库仍然没有去跳过事务检查,再检查过程中仍然发现了未交提交的活动事务;最后出现导致无法启动。
这里我尝试通过gdb 设置断点的方式,试着去打开数据库,均以失败告终!
如果是Oracle数据库的话,类似这样的场景,我们处理起来是相对容易的,最起码我们还可以bbed修改block。
不幸的是,达梦数据库提供的dmmdf工具,功能非常有限,对于system文件而言,仅能修改3个属性;相对来讲,对于redo的修改支持更多一点。
对于这里测试的极端场景,如果没有备份,估计是没什么办法了。(因为达梦还没有数据抽取工具)。
Leave a Reply
You must be logged in to post a comment.