KingbaseES V8R6数据库备份恢复案例之---物理备份后状态测试

案例说明:
KingbaseES V8R6数据库执行物理备份后状态测试。
适用版本:
KingbaseES V8R6

一、执行备份前状态
如下所示,执行备份前状态:

test=# select sys_is_in_backup();
 sys_is_in_backup()
--------------------
 f
(1 row)

二、执行备份初始化
1、执行初始化

[kingbase@node201 bin]$ ./sys_backup.sh init
# pre-condition: check the non-archived WAL files
# generate single sys_rman.conf...DONE
# update single archive_command with sys_rman.archive-push...DONE
# create stanza and check...(maybe 60+ seconds)
# create stanza and check...DONE
# initial first full backup...(maybe several minutes)
# initial first full backup...DONE
# Initial sys_rman OK.
'sys_backup.sh start' should be executed when need back-rest feature.

2、查看备份状态
如下所示,执行初始化会创建一次全备,备份完成后,备份状态恢复正常:

[kingbase@node201 bin]$ ./ksql -U system test
Type "help" for help.

test=# select sys_is_in_backup();
 sys_is_in_backup()
--------------------
 f
(1 row)

三、执行增量备份

1、完成增量备份

[kingbase@node201 bin]$ /home/kingbase/cluster/R6C8/HAC8/kingbase/bin/sys_rman --config=/home/kingbase/kbbr_repo/sys_rman.conf --stanza=kingbase info
WARN: set process-max 4 is too large, auto set to CPU core count 1
stanza: kingbase
    status: ok
    cipher: none

    db (current)
        wal archive min/max (V008R006C008B0014): 0000003D00000002000000F1/000000450000000300000019

        full backup: 20240913-144315F
            timestamp start/stop: 2024-09-13 14:43:15 / 2024-09-13 14:43:23
            wal start/stop: 000000450000000300000017 / 000000450000000300000017
            database size: 400.9MB, database backup size: 400.9MB
            repo1: backup set size: 400.9MB, backup size: 400.9MB

        incr backup: 20240913-144315F_20240913-144420I
            timestamp start/stop: 2024-09-13 14:44:20 / 2024-09-13 14:44:21
            wal start/stop: 000000450000000300000019 / 000000450000000300000019
            database size: 400.9MB, database backup size: 16.3MB
            repo1: backup set size: 400.9MB, backup size: 16.3MB
            backup reference list: 20240913-144315F

2、增量备份后状态
如下所示,增量备份结束后,备份状态恢复正常:

[kingbase@node201 bin]$ ./ksql -U system test
Type "help" for help.

test=# select sys_is_in_backup();
 sys_is_in_backup()
--------------------
 f
(1 row)

四、查看备份日志
如下所示,在执行sys_rman备份时,开始执行sys_start_backup()函数,结束时执行sys_stop_backup()函数:

[kingbase@node201 bin]$ cat /home/kingbase/cluster/R6C8/HAC8/kingbase/log/sys_rman_backup_incr.log
2024-01-05 04:00:01.621 P00   INFO: backup command begin 2.27: --archive-copy --no-archive-statistics --archive
-timeout=600 --band-width=0 --cmd-ssh=/home/kingbase/cluster/R6C8/HAC8/kingbase/bin/sys_securecmd --compress-le
vel=3 --compress-type=none --config=/home/kingbase/kbbr_repo/sys_rman.conf --exec-id=5070-437ab32e --kb2-host=1
92.168.1.202 --kb2-host-user=kingbase --kb1-path=/home/kingbase/cluster/R6C8/HAC8/kingbase/data --kb2-path=/hom
e/kingbase/cluster/R6C8/HAC8/kingbase/data --kb1-port=54321 --kb2-port=54321 --kb1-user=esrep --kb2-user=esrep
--log-level-console=info --log-level-file=info --log-path=/home/kingbase/cluster/R6C8/HAC8/kingbase/log --log-s
ubprocess --non-archived-space=1024 --process-max=4 --repo1-path=/home/kingbase/kbbr_repo --repo1-retention-ful
l=5 --stanza=kingbase --start-fast --type=incr
WARN: set process-max 4 is too large, auto set to CPU core count 1
2024-01-05 04:00:02.978 P00   INFO: Get pageCheckSum flag from ControlFile is 1
2024-01-05 04:00:03.036 P00   INFO: last backup label = 20231205-164735F, version = 2.27
2024-01-05 04:00:03.036 P00   INFO: Check the non archvied WAL space under the setting 1024 MB
2024-01-05 04:00:03.036 P00   INFO: Non archived WAL files have 0 MB.

2024-01-05 04:00:03.036 P00   INFO: execute non-exclusive sys_start_backup(): backup begins after the requested immediate checkpoint completes
2024-01-05 04:00:03.360 P00   INFO: backup start archive = 0000001100000000000000CD, lsn = 0/CD000028
2024-01-05 04:00:03.360 P00   INFO: check archive for prior segment 0000001100000000000000CC
.......
			
2024-09-13 14:44:21.191 P00   INFO: execute non-exclusive sys_stop_backup() and wait for all WAL segments to archive
2024-09-13 14:44:21.258 P00   INFO: backup stop archive = 000000450000000300000019, lsn = 3/19000128
2024-09-13 14:44:21.275 P00   INFO: check archive for segment(s) 000000450000000300000019:000000450000000300000019
2024-09-13 14:44:21.418 P00   INFO: new backup label = 20240913-144315F_20240913-144420I
2024-09-13 14:44:21.520 P00   INFO: incr backup size = 16.3MB, file total = 5095
2024-09-13 14:44:21.521 P00   INFO: backup command end: completed successfully (1629ms)
2024-09-13 14:44:21.521 P00   INFO: expire command begin 2.27: --no-archive-statistics --band-width=0 --config=/home/kingbase/kbbr_repo/sys_rman.conf --exec-id=27543-a4cdc406 --log-level-console=info --log-level-file=info --log-path=/home/kingbase/cluster/R6C8/HAC8/kingbase/log --process-max=1 --repo1-path=/home/kingbase/kbbr_repo --repo1-retention-full=5 --stanza=kingbase
2024-09-13 14:44:21.534 P00   INFO: expire command end: completed successfully (13ms)

如下图所示,开始和结束备份:

posted @ 2024-09-13 16:09  天涯客1224  阅读(30)  评论(0编辑  收藏  举报