注册
达梦数据库归档不连续导致归档全备失败处理
培训园地/ 文章详情 /

达梦数据库归档不连续导致归档全备失败处理

DM_628462 2022/11/07 979 0 0

测试环境介绍:

在centos7系统上安装DM8数据库,对归档的操作执行了“打开 -->关闭–>打开” 的操作,在第一次

开启归档后生成了归档日志导致第二次打开归档进行归档全备时,数据库认为归档不连续;需要对

第一次开启归档时生成的归档日志进行清理;

归档全备报错如下:

查看方法1:使用达梦归档检测工具dmrachk对产生的归档进行校验,命令如下:

[dmdba@dm8 bin]$ /dm8/bin/dmrachk arch_path=/dm8/arch

[dmdba@dm8 bin]$ ./dmrachk arch_path=/dm8/arch
rachk V8
the database pmnt_magic: 937432124
the database db_magic: 1733577320
/*******************************************************************/
归档文件/dm8/arch/ARCHIVE_LOCAL1_0x67544A68_EP0_2022-10-30_17-40-38.log明细.
version        : 0x7007
status         : INACTIVE
enc_flag       : FALSE
n_rpkgs        : 23
pmnt_magic     : 937432124
db_magic       : 1733577320
src_db_magic   : 1733577320
arch_lsn       : 67230
arch_seq       : 18120
clsn           : 68763
next_seq       : 18142
g_next_seq     : 18142
file len       : 204800
file free      : 204800
dsc seqno      : 0
dsc node       : 1
create time    : 2022-10-30 17:40:38.667194 time_zone:+08:00
close time     : 2022-10-30 17:41:42.990316 time_zone:+08:00
llog first time     : 1900-01-01 00:00:00.000000 time_zone:+08:00
llog last time      : 1900-01-01 00:00:00.000000 time_zone:+08:00
/*******************************************************************/
/*******************************************************************/
归档文件/dm8/arch/ARCHIVE_LOCAL1_0x67544A68_EP0_2022-10-30_17-45-50.log明细.
version        : 0x7007
status         : INACTIVE
enc_flag       : FALSE
n_rpkgs        : 295
pmnt_magic     : 937432124
db_magic       : 1733577320
src_db_magic   : 1733577320
arch_lsn       : 70340
arch_seq       : 18201
clsn           : 72160
next_seq       : 18495
g_next_seq     : 18495
file len       : 364544
file free      : 364544
dsc seqno      : 0
dsc node       : 1
create time    : 2022-10-30 17:45:50.555376 time_zone:+08:00
close time     : 2022-10-30 17:59:45.367537 time_zone:+08:00
llog first time     : 1900-01-01 00:00:00.000000 time_zone:+08:00
llog last time      : 1900-01-01 00:00:00.000000 time_zone:+08:00
/*******************************************************************/
/*******************************************************************/
归档文件/dm8/arch/ARCHIVE_LOCAL1_0x67544A68_EP0_2022-10-30_17-59-47.log明细.
version        : 0x7007
status         : INACTIVE
enc_flag       : FALSE
n_rpkgs        : 46
pmnt_magic     : 937432124
db_magic       : 1733577320
src_db_magic   : 1733577320
arch_lsn       : 72161
arch_seq       : 18496
clsn           : 72205
next_seq       : 18541
g_next_seq     : 18541
file len       : 27648
file free      : 27648
dsc seqno      : 0
dsc node       : 1
create time    : 2022-10-30 17:59:47.289282 time_zone:+08:00
close time     : 2022-10-30 18:01:59.357771 time_zone:+08:00
llog first time     : 1900-01-01 00:00:00.000000 time_zone:+08:00
llog last time      : 1900-01-01 00:00:00.000000 time_zone:+08:00
/*******************************************************************/
/*******************************************************************/
归档文件/dm8/arch/ARCHIVE_LOCAL1_0x67544A68_EP0_2022-10-30_18-02-02.log明细.
version        : 0x7007
status         : INACTIVE
enc_flag       : FALSE
n_rpkgs        : 634
pmnt_magic     : 937432124
db_magic       : 1733577320
src_db_magic   : 1733577320
arch_lsn       : 72206
arch_seq       : 18542
clsn           : 72945
next_seq       : 19175
g_next_seq     : 19175
file len       : 353280
file free      : 353280
dsc seqno      : 0
dsc node       : 1
create time    : 2022-10-30 18:02:02.625146 time_zone:+08:00
close time     : 2022-10-30 18:31:40.929389 time_zone:+08:00
llog first time     : 1900-01-01 00:00:00.000000 time_zone:+08:00
llog last time      : 1900-01-01 00:00:00.000000 time_zone:+08:00
/*******************************************************************/
/*******************************************************************/
归档文件/dm8/arch/ARCHIVE_LOCAL1_0x67544A68_EP0_2022-10-30_18-31-43.log明细.
version        : 0x7007
status         : INACTIVE
enc_flag       : FALSE
n_rpkgs        : 5
pmnt_magic     : 937432124
db_magic       : 1733577320
src_db_magic   : 1733577320
arch_lsn       : 72946
arch_seq       : 19176
clsn           : 72950
next_seq       : 19180
g_next_seq     : 19180
file len       : 6656
file free      : 6656
dsc seqno      : 0
dsc node       : 1
create time    : 2022-10-30 18:31:43.266608 time_zone:+08:00
close time     : 2022-10-30 18:31:57.017248 time_zone:+08:00
llog first time     : 1900-01-01 00:00:00.000000 time_zone:+08:00
llog last time      : 1900-01-01 00:00:00.000000 time_zone:+08:00
/*******************************************************************/
/*******************************************************************/
归档文件/dm8/arch/ARCHIVE_LOCAL1_0x67544A68_EP0_2022-10-30_18-31-58.log明细.
version        : 0x7007
status         : INACTIVE
enc_flag       : FALSE
n_rpkgs        : 1
pmnt_magic     : 937432124
db_magic       : 1733577320
src_db_magic   : 1733577320
arch_lsn       : 72951
arch_seq       : 19181
clsn           : 72951
next_seq       : 19181
g_next_seq     : 19181
file len       : 4608
file free      : 4608
dsc seqno      : 0
dsc node       : 1
create time    : 2022-10-30 18:31:58.304611 time_zone:+08:00
close time     : 2022-10-30 18:31:58.452587 time_zone:+08:00
llog first time     : 1900-01-01 00:00:00.000000 time_zone:+08:00
llog last time      : 1900-01-01 00:00:00.000000 time_zone:+08:00
/*******************************************************************/
/*******************************************************************/
归档文件/dm8/arch/ARCHIVE_LOCAL1_0x67544A68_EP0_2022-10-30_18-32-00.log明细.
version        : 0x7007
status         : INACTIVE
enc_flag       : FALSE
n_rpkgs        : 1
pmnt_magic     : 937432124
db_magic       : 1733577320
src_db_magic   : 1733577320
arch_lsn       : 72952
arch_seq       : 19182
clsn           : 72952
next_seq       : 19182
g_next_seq     : 19182
file len       : 4608
file free      : 4608
dsc seqno      : 0
dsc node       : 1
create time    : 2022-10-30 18:32:00.820179 time_zone:+08:00
close time     : 2022-10-30 18:32:00.898637 time_zone:+08:00
llog first time     : 1900-01-01 00:00:00.000000 time_zone:+08:00
llog last time      : 1900-01-01 00:00:00.000000 time_zone:+08:00
/*******************************************************************/
/*******************************************************************/
归档文件/dm8/arch/ARCHIVE_LOCAL1_0x67544A68_EP0_2022-10-30_18-32-04.log明细.
version        : 0x7007
status         : INACTIVE
enc_flag       : FALSE
n_rpkgs        : 90
pmnt_magic     : 937432124
db_magic       : 1733577320
src_db_magic   : 1733577320
arch_lsn       : 72953
arch_seq       : 19183
clsn           : 73053
next_seq       : 19272
g_next_seq     : 19272
file len       : 51712
file free      : 51712
dsc seqno      : 0
dsc node       : 1
create time    : 2022-10-30 18:32:04.318354 time_zone:+08:00
close time     : 2022-10-30 18:35:52.644409 time_zone:+08:00
llog first time     : 1900-01-01 00:00:00.000000 time_zone:+08:00
llog last time      : 1900-01-01 00:00:00.000000 time_zone:+08:00
/*******************************************************************/
/*******************************************************************/
归档文件/dm8/arch/ARCHIVE_LOCAL1_0x67544A68_EP0_2022-10-30_18-35-55.log明细.
version        : 0x7007
status         : INACTIVE
enc_flag       : FALSE
n_rpkgs        : 115
pmnt_magic     : 937432124
db_magic       : 1733577320
src_db_magic   : 1733577320
arch_lsn       : 73054
arch_seq       : 19273
clsn           : 73410
next_seq       : 19387
g_next_seq     : 19387
file len       : 84480
file free      : 84480
dsc seqno      : 0
dsc node       : 1
create time    : 2022-10-30 18:35:55.892035 time_zone:+08:00
close time     : 2022-10-30 18:41:03.931978 time_zone:+08:00
llog first time     : 1900-01-01 00:00:00.000000 time_zone:+08:00
llog last time      : 1900-01-01 00:00:00.000000 time_zone:+08:00
/*******************************************************************/
/*******************************************************************/
归档文件/dm8/arch/ARCHIVE_LOCAL1_0x67544A68_EP0_2022-10-30_18-41-08.log明细.
version        : 0x7007
status         : INACTIVE
enc_flag       : FALSE
n_rpkgs        : 37
pmnt_magic     : 937432124
db_magic       : 1733577320
src_db_magic   : 1733577320
arch_lsn       : 73411
arch_seq       : 19388
clsn           : 74889
next_seq       : 19424
g_next_seq     : 19424
file len       : 192512
file free      : 192512
dsc seqno      : 0
dsc node       : 1
create time    : 2022-10-30 18:41:08.062289 time_zone:+08:00
close time     : 2022-10-30 18:42:43.732940 time_zone:+08:00
llog first time     : 1900-01-01 00:00:00.000000 time_zone:+08:00
llog last time      : 1900-01-01 00:00:00.000000 time_zone:+08:00
/*******************************************************************/
/*******************************************************************/
归档文件/dm8/arch/ARCHIVE_LOCAL1_0x67544A68_EP0_2022-10-30_18-43-56.log明细.
version        : 0x7007
status         : INACTIVE
enc_flag       : FALSE
n_rpkgs        : 493
pmnt_magic     : 937432124
db_magic       : 1733577320
src_db_magic   : 1733577320
arch_lsn       : 74890
arch_seq       : 19425
clsn           : 76913
next_seq       : 19917
g_next_seq     : 19917
file len       : 469504
file free      : 469504
dsc seqno      : 0
dsc node       : 1
create time    : 2022-10-30 18:43:56.623852 time_zone:+08:00
close time     : 2022-10-30 19:07:37.622440 time_zone:+08:00
llog first time     : 1900-01-01 00:00:00.000000 time_zone:+08:00
llog last time      : 1900-01-01 00:00:00.000000 time_zone:+08:00
/*******************************************************************/
/*******************************************************************/
归档文件/dm8/arch/ARCHIVE_LOCAL1_0x67544A68_EP0_2022-10-30_19-07-38.log明细.
version        : 0x7007
status         : INACTIVE
enc_flag       : FALSE
n_rpkgs        : 4
pmnt_magic     : 937432124
db_magic       : 1733577320
src_db_magic   : 1733577320
arch_lsn       : 76914
arch_seq       : 19918
clsn           : 76917
next_seq       : 19921
g_next_seq     : 19921
file len       : 6144
file free      : 6144
dsc seqno      : 0
dsc node       : 1
create time    : 2022-10-30 19:07:38.956587 time_zone:+08:00
close time     : 2022-10-30 19:07:47.564290 time_zone:+08:00
llog first time     : 1900-01-01 00:00:00.000000 time_zone:+08:00
llog last time      : 1900-01-01 00:00:00.000000 time_zone:+08:00
/*******************************************************************/
/*******************************************************************/
归档文件/dm8/arch/ARCHIVE_LOCAL1_0x67544A68_EP0_2022-10-30_19-07-50.log明细.
version        : 0x7007
status         : INACTIVE
enc_flag       : FALSE
n_rpkgs        : 4
pmnt_magic     : 937432124
db_magic       : 1733577320
src_db_magic   : 1733577320
arch_lsn       : 76918
arch_seq       : 19922
clsn           : 76921
next_seq       : 19925
g_next_seq     : 19925
file len       : 6144
file free      : 6144
dsc seqno      : 0
dsc node       : 1
create time    : 2022-10-30 19:07:50.984111 time_zone:+08:00
close time     : 2022-10-30 19:08:00.650099 time_zone:+08:00
llog first time     : 1900-01-01 00:00:00.000000 time_zone:+08:00
llog last time      : 1900-01-01 00:00:00.000000 time_zone:+08:00
/*******************************************************************/
/*******************************************************************/
归档文件/dm8/arch/ARCHIVE_LOCAL1_0x67544A68_EP0_2022-10-30_19-08-03.log明细.
version        : 0x7007
status         : INACTIVE
enc_flag       : FALSE
n_rpkgs        : 380
pmnt_magic     : 937432124
db_magic       : 1733577320
src_db_magic   : 1733577320
arch_lsn       : 76922
arch_seq       : 19926
clsn           : 77550
next_seq       : 20305
g_next_seq     : 20305
file len       : 221184
file free      : 221184
dsc seqno      : 0
dsc node       : 1
create time    : 2022-10-30 19:08:03.013992 time_zone:+08:00
close time     : 2022-10-30 19:26:11.152691 time_zone:+08:00
llog first time     : 1900-01-01 00:00:00.000000 time_zone:+08:00
llog last time      : 1900-01-01 00:00:00.000000 time_zone:+08:00
/*******************************************************************/
/*******************************************************************/
归档文件/dm8/arch/ARCHIVE_LOCAL1_0x67544A68_EP0_2022-10-31_09-00-43.log明细.
version        : 0x7007
status         : INACTIVE
enc_flag       : FALSE
n_rpkgs        : 307
pmnt_magic     : 937432124
db_magic       : 1733577320
src_db_magic   : 1733577320
arch_lsn       : 77551
arch_seq       : 20306
clsn           : 79518
next_seq       : 20612
g_next_seq     : 20612
file len       : 353280
file free      : 353280
dsc seqno      : 0
dsc node       : 1
create time    : 2022-10-31 09:00:43.591364 time_zone:+08:00
close time     : 2022-10-31 09:15:51.261250 time_zone:+08:00
llog first time     : 1900-01-01 00:00:00.000000 time_zone:+08:00
llog last time      : 1900-01-01 00:00:00.000000 time_zone:+08:00
/*******************************************************************/
/*******************************************************************/
归档文件/dm8/arch/ARCHIVE_LOCAL1_0x67544A68_EP0_2022-10-31_09-16-04.log明细.
version        : 0x7007
status         : INACTIVE
enc_flag       : FALSE
n_rpkgs        : 13
pmnt_magic     : 937432124
db_magic       : 1733577320
src_db_magic   : 1733577320
arch_lsn       : 79519
arch_seq       : 20613
clsn           : 81195
next_seq       : 20625
g_next_seq     : 20625
file len       : 199168
file free      : 199168
dsc seqno      : 0
dsc node       : 1
create time    : 2022-10-31 09:16:04.084625 time_zone:+08:00
close time     : 2022-10-31 09:16:37.359206 time_zone:+08:00
llog first time     : 1900-01-01 00:00:00.000000 time_zone:+08:00
llog last time      : 1900-01-01 00:00:00.000000 time_zone:+08:00
/*******************************************************************/
/*******************************************************************/
归档文件/dm8/arch/ARCHIVE_LOCAL1_0x67544A68_EP0_2022-10-31_09-16-54.log明细.
version        : 0x7007
status         : INACTIVE
enc_flag       : FALSE
n_rpkgs        : 310
pmnt_magic     : 937432124
db_magic       : 1733577320
src_db_magic   : 1733577320
arch_lsn       : 81196
arch_seq       : 20626
clsn           : 83178
next_seq       : 20935
g_next_seq     : 20935
file len       : 356864
file free      : 356864
dsc seqno      : 0
dsc node       : 1
create time    : 2022-10-31 09:16:54.339421 time_zone:+08:00
close time     : 2022-10-31 09:31:56.639627 time_zone:+08:00
llog first time     : 1900-01-01 00:00:00.000000 time_zone:+08:00
llog last time      : 1900-01-01 00:00:00.000000 time_zone:+08:00
/*******************************************************************/
/*******************************************************************/
归档文件/dm8/arch/ARCHIVE_LOCAL1_0x67544A68_EP0_2022-10-31_09-34-24.log明细.
version        : 0x7007
status         : INACTIVE
enc_flag       : FALSE
n_rpkgs        : 11268
pmnt_magic     : 937432124
db_magic       : 1733577320
src_db_magic   : 1733577320
arch_lsn       : 83179
arch_seq       : 20936
clsn           : 268839
next_seq       : 32203
g_next_seq     : 32203
file len       : 28522496
file free      : 28522496
dsc seqno      : 0
dsc node       : 1
create time    : 2022-10-31 09:34:24.343481 time_zone:+08:00
close time     : 2022-10-31 16:16:31.345700 time_zone:+08:00
llog first time     : 1900-01-01 00:00:00.000000 time_zone:+08:00
llog last time      : 1900-01-01 00:00:00.000000 time_zone:+08:00
/*******************************************************************/
/*******************************************************************/
归档文件/dm8/arch/ARCHIVE_LOCAL1_0x67544A68_EP0_2022-10-31_16-17-22.log明细.
version        : 0x7007
status         : INACTIVE
enc_flag       : FALSE
n_rpkgs        : 52
pmnt_magic     : 937432124
db_magic       : 1733577320
src_db_magic   : 1733577320
arch_lsn       : 268840
arch_seq       : 32204
clsn           : 270630
next_seq       : 32255
g_next_seq     : 32255
file len       : 256000
file free      : 256000
dsc seqno      : 0
dsc node       : 1
create time    : 2022-10-31 16:17:22.485936 time_zone:+08:00
close time     : 2022-10-31 16:19:57.512296 time_zone:+08:00
llog first time     : 1900-01-01 00:00:00.000000 time_zone:+08:00
llog last time      : 1900-01-01 00:00:00.000000 time_zone:+08:00
/*******************************************************************/
/*******************************************************************/
归档文件/dm8/arch/ARCHIVE_LOCAL1_0x67544A68_EP0_2022-10-31_16-21-29.log明细.
version        : 0x7007
status         : INACTIVE
enc_flag       : FALSE
n_rpkgs        : 150
pmnt_magic     : 937432124
db_magic       : 1733577320
src_db_magic   : 1733577320
arch_lsn       : 270631
arch_seq       : 32256
clsn           : 272445
next_seq       : 32405
g_next_seq     : 32405
file len       : 271872
file free      : 271872
dsc seqno      : 0
dsc node       : 1
create time    : 2022-10-31 16:21:29.411224 time_zone:+08:00
close time     : 2022-10-31 16:28:54.286904 time_zone:+08:00
llog first time     : 1900-01-01 00:00:00.000000 time_zone:+08:00
llog last time      : 1900-01-01 00:00:00.000000 time_zone:+08:00
/*******************************************************************/
/*******************************************************************/
归档文件/dm8/arch/ARCHIVE_LOCAL1_0x67544A68_EP0_2022-10-31_16-30-27.log明细.
version        : 0x7007
status         : ACTIVE
enc_flag       : FALSE
n_rpkgs        : 245
pmnt_magic     : 937432124
db_magic       : 1733577320
src_db_magic   : 1733577320
arch_lsn       : 272446
arch_seq       : 32406
clsn           : 274131
next_seq       : 32650
g_next_seq     : 32650
file len       : 67108864
file free      : 301056
dsc seqno      : 0
dsc node       : 1
create time    : 2022-10-31 16:30:27.186607 time_zone:+08:00
close time     : 2022-10-31 16:30:27.186607 time_zone:+08:00
llog first time     : 1900-01-01 00:00:00.000000 time_zone:+08:00
llog last time      : 1900-01-01 00:00:00.000000 time_zone:+08:00
/*******************************************************************/

概要(节点[0]):
总计: 21 个文件
正确: 21 个文件
错误: 0 个文件
重复: 0 个文件


ARCH_PATH的归档文件链表是不连续的。
breakpoint 0:
the left file /dm8/arch/ARCHIVE_LOCAL1_0x67544A68_EP0_2022-10-30_17-40-38.log, clsn: 68763, next_seq: 18142
the right file /dm8/arch/ARCHIVE_LOCAL1_0x67544A68_EP0_2022-10-30_17-45-50.log, arch_lsn: 70340, arch_seq: 18201
the rachk tool running cost 763.570 ms

可以看到 lsn发生了中断,由68763跳到了70340;

查看方法2:使用数据字典v$archived_log查询归档的情况:
归档中断.png
从视图中可以更清楚的看到归档发生了中断,从68763直接跳到了70340,为了在控制文件中将第

一次开启归档产生的归档日志清除,需要调用SF_ARCHIVELOG_DELETE_BEFORE_LSN

删除LSN 值小于70340的归档日志文件:
SQL> select SF_ARCHIVELOG_DELETE_BEFORE_LSN(70340);

可以看到第一次开启归档生成的归档日志已经被系统自动清除;

再次执行全部归档的备份,可以看到没问题了:

达梦应该有类似于oracle crosscheck archivelog自动将第一次开启归档后生成的归档日志标记为

obsoleted的功能,目前还没找到,还需要进一步的学习。

评论
后发表回复

作者

文章

阅读量

获赞

扫一扫
联系客服