SAP HANA数据库备份方式与工具

时间:2021-07-29 16:57:01

备份的类型

Option Description
Complete Data Backup A data backup includes all the data structures that are required to recover the database.
Differential Data Backup Differential backups store all the data changed since the last full data backup.
Incremental Data Backup

An incremental backup stores the data changed since the last full data backup or the last

delta backup (incremental or differential).

备份的工具

  1. SAP HANA studio

    HANA studio - 右键SID - Backup and Recovery - Back Up system 备份完整数据库或者打开Open Backup Console选择备份类型 

    这里的备份文件命名自动生成,如果是同样的备份路径,上一次备份将会被覆盖


  2. SAP HANA cockpit

    从studio进入或者打开链接

    https://eccqas:4300/sap/hana/admin/cockpit/

    http://eccqas:8000/sap/hana/admin/cockpit/

    SAP HANA Backup - Create Backup创建一个backup马上备份

    SAP HANA数据库备份方式与工具

    或者创建一个schedule周期调度,注意Backup Prefix,调度名字,周期

    SAP HANA数据库备份方式与工具

        如果看不到SAP HANA Backup磁贴,那么需要给登录的HANA数据库用户授权

        sap.hana.backup.roles::Administrator

        如果看不到Create Schedule,那么需要给登录的HANA数据库用户授权

        sap.hana.backup.roles::Scheduler

        与之相关的操作角色是sap.hana.backup.roles::Operator

         SAP HANA数据库备份方式与工具

    注意:调度器默认是不激活的状态,创建调度计划后会提示

    Backups cannot be scheduled, because the XS Job Scheduler is not active. For more information, see SAP HANA Administration Guide


       SAP HANA数据库备份方式与工具

    则需要到URL激活 enable:http://eccqas:8000/sap/hana/xs/admin/jobs/#

    并且需要角色sap.hana.xs.admin.roles::JobSchedulerAdministrator,否则是灰的无法激活

    作业管理角色:sap.hana.xs.admin.roles::JobAdministrator

             SAP HANA数据库备份方式与工具


    3.Native SQLDBA Cockpit for SAP HANA

    过程参考:http://tecadmin.net/backup-sap-hana-database-using-command-line/#

123     #su - sidadm    hdbsql    \c -i 00 -n eccqas:30015 -u system -p Bm2015##


    help:

  hdbsql=> \h

 

 \? or \h[elp]  show help on internal slash commands

 \q[uit]        quit HDBSQL

 \c[onnect]     -i <instance number>

                -n <host>[:<port>]

                -d <database name>

                -u <user_name>

                -p <password>

                -U <user_store_key>

                connecting to the database

 \di[sconnect]  disconnecting from the database

    

    help.sap.com:https://help.sap.com/saphelp_hanaplatform/helpdata/en/75/a06c444e9a4b3287a46a6a40b4ee69/content.htm

   

    可以在系统下用crontab 

    complete 全备:hdbsql -U USER4BACKUP "backup data using file ('complete_backup_prefix')"

    incremental增备:hdbsql -U USER4BACKUP "backup data INCREMENTAL using file     ('incremental_backup_prefix')"

    differential差备:hdbsql -U USER4BACKUP "backup data DIFFERENTIAL using file     ('differential_backup_prefix')"

    异步最后加上ASYNCHRONOUS


1950261 - SAP HANA Database Backup Policy Recommendations and Regular Backup Script

create user <Backup User Name> password "<Password>";
alter user <Backup User Name> DISABLE PASSWORD LIFETIME;
grant backup operator to <Backup User Name>;

hdbuserstore set USER4BACKUP localhost:3<Instance Number>15 <Backup User Name> <Password>

note已经有标准shell脚本

12345678910 #!/bin/sh#/* Backup script */source $HOME/.bashrcdate="$(date +"%Y-%m-%d")"time="$(date +"%Y-%m-%d %H:%M:%S")"backup="backup data using file ('$date')"echo "daily backup  :"  $time  "Start" >> $DIR_INSTANCE/backup.log$DIR_EXECUTABLE/hdbsql -U USER4BACKUP -x $backuptime="$(date +"%Y-%m-%d %H:%M:%S")"echo "daily backup  :"  $time  "End" >> $DIR_INSTANCE/backup.log


周日全备,周一至周六增备

 

12345678910 #!/bin/sh#/* Complete Backup script_completebackup.sh*/source $HOME/.bashrcdate="$(date +"%Y-%m-%d")"time="$(date +"%Y-%m-%d %H:%M:%S")"backup="backup data using file ('$date.complete')"echo "daily backup  :"  $time  "Start" >> $DIR_INSTANCE/backup.log$DIR_EXECUTABLE/hdbsql -U USER4BACKUP -x $backuptime="$(date +"%Y-%m-%d %H:%M:%S")"echo "daily backup  :"  $time  "End" >> $DIR_INSTANCE/backup.log

  

12345678910 #!/bin/sh#/* Incremental Backup script_incrementbackup.sh */source $HOME/.bashrcdate="$(date +"%Y-%m-%d")"time="$(date +"%Y-%m-%d %H:%M:%S")"backup="backup data INCREMENTAL using file ('$date')"echo "daily backup  :"  $time  "Start" >> $DIR_INSTANCE/backup.log$DIR_EXECUTABLE/hdbsql -U USER4BACKUP -x $backuptime="$(date +"%Y-%m-%d %H:%M:%S")"echo "daily backup  :"  $time  "End" >> $DIR_INSTANCE/backup.log


    第三方备份工具将file改成backint


  4.通过SAP HANA Cockpit备份HANA数据库

    事务码:DBACOCKPIT 或者DB13,