首页 > 数据库 > > 数据库备份与恢复-数据库备份
本节介绍通过gs_rman工具和backupRestore.sh脚本进行数据库备份的常见场景及操作命令。
./backupRestore.sh -h查看backupRestore.sh脚本命令帮助信息。
./backupRestore.sh [-b|-r] [-i INTERFACE] [-t BACKUP_TYPE] [-u DB_USER] [-p DB_PORT] [ -D DB_PATH ] [-B DB_BACKUP_PATH] [-R REMOTE_IP] [-U REMOTE_USER] [-P REMOTE_PATH]
-b Backup the database
-r Restore the database
-i Interface name to create the babkup [local|scp]
-t Backup type [full|incremental]
-u DB User name
-p DB port
-D DB path
-B DB backup path
-R Remote IP [Required when user pass interface scp]
-U Remote user name
-P Remote path
例如,
[dminstalluser@blrlabvm_171_29 bin]$ ./backupRestore.sh -h
Usage: ./backupRestore.sh [-b|-r] [-i INTERFACE] [-t BACKUP_TYPE] [-u DB_USER] [-W DB_PASSWORD] [-p DB_PORT] [ -D DB_PATH ] [-B DB_BACKUP_PATH] [-R REMOTE_IP] [-U REMOTE_USER] [-W REMOTE_PASS] [-P REMOTE_PATH] [-noprompt]
-b Backup the database
-r Restore the database
-i Interface name to create the backup [local|scp]
-t Backup type [full|incremental]
-u DB User name
-w DB password
-p DB port
-D DB path
-B DB backup path
-R Remote IP [Required when user pass interface scp]
-U Remote user name
-W Remote user password
-noprompt Password in Non Interactive Mode
-P Remote path
Examples: \n
[Backup] local: ./backupRestore.sh -b -i local -t full -u user -p 22202 -w password -D /home/user/userdb/ -B /home/user/db_backup
[Backup] remote: ./backupRestore.sh -b -i local -t full -u user -p 22202 -w password -D /home/user/userdb/ -B /home/user/db_backup -R 10.X.X.X -U ruser -w rpass -P /root
[Restore] ./backupRestore.sh -r -D /home/user/userdb/ -B /home/user/db_backup
[dminstalluser@blrlabvm_171_29 bin]$
./backupRestore.sh -b -i local -t full -u user -p 22202 -D /home/user/userdb/ -B /home/user/db_backup例如,
[dminstalluser@blrlabvm_171_29 bin]$ ./backupRestore.sh -b -i local -t full -u apprim -p 22202 -D /home/dminstalluser/dmserver/primdb/data -B /home/dminstalluser/backup
Enter Database Password:
/home/dminstalluser
Available Disk Space is: 24
INFO: database backup start
NOTICE: pg_stop_backup complete, all required WAL segements have been archived
INFO: validate: 2019-08-12 14:42:49 backup and archive log files by CRC
[dminstalluser@blrlabvm_171_29 bin]$
./backupRestore.sh -b -i local -t inc -u user -p 22202 -D /home/user/userdb/ -B /home/user/db_backup例如,
[dminstalluser@blrlabvm_171_29 bin]$ ./backupRestore.sh -b -i local -t inc -u user -p 22202 -D /home/user/userdb/ -B /home/user/db_backup
Enter Databse Password:
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/69959250/viewspace-3148332/ ,如需转载,请注明出处,否则将追究法律责任。