rman单机本地备份操作步骤
一、配置物理备份前提条件
1、创建备份目录
mkdir /home/kingbase/kbbr_repo
2、数据库开启归档
(1)修改配置文件kingbase.conf中参数:
archive_mode=on
archive_command=’’
(2)重启数据库
sys_ctl restart -D /home/kingbase/KingbaseES/V8/data
3、配置ssh免密登录
kingbase用户执行
ssh-keygen -t rsa
ssh-copy-id -i /home/kingbase/.ssh/id_rsa.pub [email protected].114.13
ssh-copy-id -i /home/kingbase/.ssh/id_rsa.pub root@192.168.114.13
二、配置物理备份
1、修改物理备份配置文件
vi /home/kingbase/KingbaseES/V8/Server/bin/sys_backup.conf
# target db style enum: single/cluster
_target_db_style="single"
# one kingbase node IP
# just provide one IP, script will use 'repmgr cluster show' get other node IP
_one_db_ip="192.168.114.13" --本机物理IP
# local repo IP, inner-REPO, must be same as one_db_ip, means repo located in one db node
# outer repo IP, outer-REPO, means repo located in outer node
_repo_ip="192.168.114.13" --本机物理IP,与_one_db_ip配置相同
# label of this cluster
_stanza_name="kingbase"
# OS user name of database
_os_user_name="kingbase"
# !!!! dir to store the backup files
# should be accessable for the OS user
_repo_path="/home/kingbase/kbbr_repo" --备份路径
# count of keep, over the count FULL-backup will be remove
_repo_retention_full_count=5 --全量备份保留5份
# count of days, interval to do FULL-backup
_crond_full_days=7 --每周一次全量备份
# count of days, interval to do DIFF-backup
_crond_diff_days=0 --不进行差异备份
# count of days, interval to do INCR-backup
_crond_incr_days=1 --每天一次增量备份
# HOUR to do the FULL-backup
_crond_full_hour=2 --每天凌晨两点进行全量备份
# HOUR to do the DIFF-backup
_crond_diff_hour=3
# HOUR to do the INCR-backup
_crond_incr_hour=4 --每天凌晨四点进行增量备份
# OS cmd define
_os_ip_cmd="/usr/sbin/ip"
_os_rm_cmd="/bin/rm"
_os_sed_cmd="/bin/sed"
_os_grep_cmd="/bin/grep"
# !!! these follow 4 parameter ONLY for single style
# data dir of single
_single_data_dir="/home/kingbase/KingbaseES/V8/data"
# bin dir of single
_single_bin_dir="/home/kingbase/KingbaseES/V8/Server/bin"
#_single_bin_dir="/home/kingbase/KingbaseES/V8/Server/bin"
# database user of single
_single_db_user="system"
# database port of single
_single_db_port="54321"
2、执行sys_backup.sh init备份初始化
cd /home/kingbase/KingbaseES/V8/Server/bin/
./sys_backup.sh init
——执行后会在备份文件路径 /home/kingbase/kbbr_repo 创建文件夹、文件、配置文件等,并备份一次全量数据。
3、执行sys_backup.sh start添加定时任务
cd /home/kingbase/KingbaseES/V8/Server/bin/
./sys_backup.sh start
——执行后会在定时任务中添加备份任务
4、查看定时任务