原文链接:https://www.gbase.cn/community/post/4631
更多精彩内容尽在南大通用GBase技术社区,南大通用致力于成为用户最信赖的数据库产品供应商。
在当今这个数据驱动的时代,数据库的安全性和可靠性对于任何企业来说都是至关重要的。数据库备份和恢复是确保数据安全、防止数据丢失的关键环节。本篇文章我们来讨论如何使用ontape工具进行数据库的备份与恢复,包括增量备份、逻辑日志备份以及整个数据库系统的恢复等功能。无论您是数据库管理员还是IT专业人员,希望本文都能为您提供一些帮助。
ontape工具简介
ontape是数据库备份和恢复工具,它支持多种备份方式,包括全备份、增量备份以及逻辑日志备份。此外,它还支持从备份中恢复整个数据库系统或特定的dbspace。ontape工具的使用不仅限于备份,它还支持标准的I/O读写操作,如文件和管道等。在使用ontape之前,用户需对配置文件做出一定修改。
文件的修改配置
当使用ontape进行备份时,首先需要指定备份将要复制到的存储设备,并指定其块的大小以及最大容量等相关参数,如下图所示。其中,TAPEDEV制定了系统备份的存储设备,LTAPEDEV制定了逻辑日志备份的存储设备。
[root@node1 hdr]# onstat -c | grep TAPE
Your evaluation license will expire on 2024-10-18 00:00:00
# TAPEDEV - The tape device path for backups. To use standard
# TAPEBLK - The tape block size, in KB, for backups
# TAPESIZE - The maximum amount of data to put on one backup
# positive integral multiple of TAPEBLK.
TAPEDEV /dev/null
TAPEBLK 32
TAPESIZE 0
# LTAPEDEV - The tape device path for logical logs
# LTAPEBLK - The tape block size, in KB, for backing up logical
# LTAPESIZE - The maximum amount of data to put on one logical
# positive integral multiple of LTAPEBLK.
LTAPEDEV /home/hdr/backups
LTAPEBLK 32
LTAPESIZE 0
其中各个参数含义见下表:
TAPEDEV |
指定备份设备路径 |
TAPEBLK |
指定备份的块大小(KB) |
TAPESIZE |
指定备份设备的大小(KB) |
LTAPEDEV |
指定逻辑日志备份设备路径 |
LTAPEBLK |
指定逻辑日志备份的块大小(KB) |
LTAPESIZE |
指定逻辑日志备份设备的大小(KB) |
可通过修改参数文件,或使用 onmode -wf 命令,设置GBase 8s的参数。一般情况下除设备路径外其他参数保持默认即可。
[root@node1 hdr]# cd $GBASEDBTDIR
[root@node1 hdr]# mkdir backups
[root@node1 hdr]# chown gbasedbt:gbasedbt backups
[root@node1 hdr]# chmod 777 backups
[root@node1 hdr]# onmode -wf "TAPEDEV=$GBASEDBTDIR/backups"
Your evaluation license will expire on 2024-10-18 00:00:00
Value of TAPEDEV has been changed to /home/hdr/backups.
[root@node1 hdr]# onmode -wf "LTAPEDEV=$GBASEDBTDIR/backups"
Your evaluation license will expire on 2024-10-18 00:00:00
Current value for LTAPEDEV (/home/hdr/backups) was saved in config file.
[root@node1 hdr]# onstat -c | grep TAPEDEV
Your