4 4 3 Tigon:SAP HANA Backup: Difference between revisions

From SEPsesam
(Fixed navigation to Beefalo V2.)
(Corrected obsolete version note (Tigon).)
(19 intermediate revisions by 2 users not shown)
Line 1: Line 1:
<translate>
<noinclude><translate>
<!--T:1-->
<!--T:1-->
<div class="noprint"><languages />
<div class="noprint"><languages />
{{Copyright SEP AG‎|en}}
{{Copyright SEP AG‎|en}}
{{Draft}}


<!--T:2-->
<!--T:2-->
{{Navigation_latest|release=[[Special:MyLanguage/SEP_sesam_Release_Versions|4.4.3 ''Tigon''/4.4.3 ''Beefalo V2'']]|link=[[Special:MyLanguage/SAP|SAP HANA archive]]}}</div></translate><br />
{{Navigation_latest|release=[[Special:MyLanguage/SEP_sesam_Release_Versions|4.4.3 ''Tigon''/4.4.3 ''Beefalo V2'']]|link=[[Special:MyLanguage/SAP|SAP HANA archive]]}}
{{<translate><!--T:3-->
 
note</translate>|<translate><!--T:4-->
<!--T:354-->
For all installations with '''''SAP HANA version 2.x''''', contact [mailto:support@sep.de SEP sesam support]. The support team will then provide you with further instructions.</translate>}}<br />
{{Outdated_Version/en|[[SEP_sesam_Release_Versions|4.4.3 ''Tigon (V1 and V2)'']]}}</div></translate><br />


<translate>==Overview== <!--T:5--></translate>
<translate>==Overview== <!--T:5--></translate>
Line 19: Line 18:
[[File:SEP_next.png|45px|link=Special:MyLanguage/4_4_3_Tigon:SAP_HANA_Restore|SAP HANA Restore]]</translate>
[[File:SEP_next.png|45px|link=Special:MyLanguage/4_4_3_Tigon:SAP_HANA_Restore|SAP HANA Restore]]</translate>
| style="padding:0px 40px 0px 10px; color: grey; font-size: 90%; text-align:left;" | <translate><!--T:8-->
| style="padding:0px 40px 0px 10px; color: grey; font-size: 90%; text-align:left;" | <translate><!--T:8-->
See also: [[Special:MyLanguage/SAP_Hana_Logbackup_and_Savepoints|SAP HANA Logbackup and Savepoints]] – [[Special:MyLanguage/4_4_3_Tigon:SAP_HANA_Restore|SAP HANA Restore]]</translate>
See also: [[Special:MyLanguage/SAP_Hana_Logbackup_and_Savepoints|SAP HANA Logbackup and Savepoints]] – [[Special:MyLanguage/4_4_3_Tigon:SAP_HANA_Restore|SAP HANA Restore]] – [[Special:MyLanguage/4_4_3_Tigon:SAP_HANA_Configuration|SAP HANA Configuration]]</translate>
|}
 
{|style="margin: auto; margin-bottom:1em; width:100%; border:0px solid grey;"
| rowspan="2" style="padding:0px 10px 0px;" | [[File:SEP_Video.png|45px|link=Video Tutorials & Screencasts|]]
| style="padding:0px 40px 0px 10px; color: grey; font-size: 90%; text-align:left;" |  <translate><!--T:355--> Watch SEP sesam videos [https://www.youtube.com/watch?v=2Sg4NdSlnBc&list=PLoTFTskMneqNf9mFaRFVunX_UwbaGmwTb&index=4 Backup of SAP HANA with SEP sesam] <sup>'''NEW!'''</sup> and [https://www.youtube.com/watch?v=Gb1oF_XlNhM SAP Hana Backup and Bare Metal Introduction].</translate>
|}
|}


Line 34: Line 38:
| style="padding:0px 40px 0px 10px; color: grey; font-size: 90%; text-align:left;" | <translate><!--T:12-->
| style="padding:0px 40px 0px 10px; color: grey; font-size: 90%; text-align:left;" | <translate><!--T:12-->
If you are using an older SEP sesam version, refer to [[Special:MyLanguage/SAP|SAP HANA archive]].</translate>
If you are using an older SEP sesam version, refer to [[Special:MyLanguage/SAP|SAP HANA archive]].</translate>
|}</div>
|}</div></noinclude>
<translate><!--T:13-->
<translate><!--T:236--> SEP sesam provides efficient data protection for your SAP HANA V1 and V2 environment. Among the main technical advantages for using the SEP sesam ''HDBBackint'' integration to back up your SAP HANA database are:</translate>
SEP sesam provides efficient data protection for your SAP HANA environment. Among the main technical advantages for using the SEP sesam ''HDBBackint'' integration to back up your SAP HANA database are:</translate>
* <translate><!--T:237--> SEP sesam ''HDBBackint'' integration is certified and supported by SAP.</translate>
* <translate><!--T:14-->
SEP sesam HDBBackint integration is certified and supported by SAP.</translate>
* <translate><!--T:15-->
* <translate><!--T:15-->
Data consistency checks at the block level.</translate>
Data consistency checks at the block level.</translate>
Line 54: Line 56:
High automation is possible.
High automation is possible.


<!--T:225-->
As of SEP sesam v. [[SEP_sesam_Release_Versions|4.4.3 ''Beefalo V2'']], you can perform SAP HANA housekeeping to delete (purge) SEP sesam backups that are no longer needed or can no longer be used for a recovery, based on a defined retention policy. For details, see section [[Special:MyLanguage/4_4_3_Tigon:SAP_HANA_Backup#housekeeping|SAP HANA housekeeping]].
As of SEP sesam v. [[SEP_sesam_Release_Versions|4.4.3 ''Beefalo V2'']], you can perform SAP HANA housekeeping to delete (purge) SEP sesam backups that are no longer needed or can no longer be used for a recovery, based on a defined retention policy. For details, see section [[Special:MyLanguage/4_4_3_Tigon:SAP_HANA_Backup#housekeeping|SAP HANA housekeeping]].


===Prerequisites=== <!--T:22-->
== {{anchor|backup}}Backing up SAP HANA == <!--T:238-->
 
<!--T:239-->
The SAP HANA backup is always performed by the database itself and is started with an <tt>HDBSQL</tt> command. However, you can start the database backup by using a single command in the command line, a shell script or from the SAP HANA Cockpit or SAP HANA Studio. The command and shell scripts can be started by any scheduler, e.g., the SEP sesam [[Special:MyLanguage/SEP_sesam_Glossary#SEPuler|SEPuler]].
 
<!--T:240-->
The SAP HANA Logbackup is performed by the database automatically. It is not possible or required to trigger the Logbackup.
 
<!--T:241-->
The SAP HANA database engine uses the configured ''*.utl'' files to communicate with SEP sesam via the ''backint'' interface.
 
=== {{anchor|HANA_studio}}Starting a database backup from the HANA Studio (SAP HANA V1 and V2) === <!--T:242-->
 
<!--T:243-->
To start a full backup from HANA studio, open the ''SAP HANA Studio'', right-click ''Backup'' under the desired system and select '''Back Up...''' from the context menu. Then select '''Backint''' as backup target, as shown in the screenshot below.
 
<!--T:244-->
[[File:hanastudio-startbackup2.jpg|link=]] </translate>
<br clear=all>
 
<translate>=== {{anchor|command_line}}Starting a database backup from the command line (SAP HANA V1 and V2) === <!--T:245-->
 
<!--T:246-->
You can start a database backup manually from the command line by using <tt>HDBSQL</tt> command. For details, check SAP portal for ''SAP HANA SQL and System Views Reference''/''SAP HANA SQL Reference Guide for SAP HANA Platform'' documentation, relevant for your SAP HANA version. 
 
<!--T:247-->
'''Simple examples for starting a database backup'''
 
<!--T:248-->
Replace the <tt>-u</tt> and <tt>-p</tt> parameters with the values of your backup user and the <tt><SID></tt> and <tt><instance number></tt> fitting your SAP HANA system.</translate>
 
<ul><li><translate><!--T:249--> '''''SAP HANA V1, complete backup, single instance:'''''</translate></li>
 
/usr/sap/<SID>/HDB<translate><!--T:250--> <instance number></translate>/exe/hdbsql -i <translate><!--T:251--> <instance number></translate> -n localhost -u SYSTEM -p PASSWORD "BACKUP DATA USING BACKINT ('MyBackIntBackup')"
 
<translate><!--T:252--> Data backups are prepended with the prefix ''MyBackIntBackup''.</translate>
 
<li><translate><!--T:253--> '''''SAP HANA V1, complete backup, multiple instances, DB TENANT1:'''''</translate></li>
 
/usr/sap/<SID>/HDB<translate><!--T:254--> <instance number></translate>/exe/hdbsql -i <translate><!--T:255--> <instance number></translate> -n localhost -d SYSTEMDB -u SYSTEM -p PASSWORD "BACKUP DATA FOR TENANT1 USING BACKINT ('MyBackIntBackup')"


<!--T:23-->
<translate><!--T:256--> Data backups are prepended with the prefix ''MyBackIntBackup''. Complete backup of the tenant DB with the name ''TENANT1''.</translate>
To ensure error-free operation of SEP sesam and improve performance, make sure that the following conditions are met:</translate>
*<translate><!--T:24-->
Check the [[Special:MyLanguage/SEP_sesam_OS_and_Database_Support_Matrix#SAP_HANA|support matrix]] for the list of supported SAP HANA versions.</translate>
*<translate><!--T:25-->
Installed SAP HANA database.</translate>
*<translate><!--T:26-->
Installed SEP sesam Client for Linux [[Special:MyLanguage/SEP_sesam_Release_Versions|version ≥ 4.4.1.14]] on the SAP HANA server (≥ 4.4.3.12 for IBM ppc64).</translate>
*<translate><!--T:27-->
Regular file backups must work (the sample ''/etc'' backup has to be successful). For details on backup configuration, see [[Special:MyLanguage/Standard_Backup_Procedure|Standard Backup Procedure]].


=={{anchor|configuration}}Configuring SAP HANA as a client on SEP sesam Server== <!--T:28--></translate>
<li><translate><!--T:257--> '''''SAP HANA V2, complete backup, DB SYSTEMDB:'''''</translate></li>
<ol><li><translate><!--T:29-->
Add the SAP HANA server as a SEP sesam Client in the SEP sesam GUI and check that access mode is ''SM SSH''.</translate></li>
<li><translate><!--T:30-->
Create a backup task HANA <DB_SID> with '''SAP HANA''' task type and '''<DB_SID>''' as a source. For general details on backup procedure, see [[Special:MyLanguage/Creating_a_Backup_Task|Creating a Backup Task]]. Note that SAP HANA task cannot be used for regular file backups. It is necessary only for enabling the SEP sesam Server to accept backups from the SAP HANA system; once all configuration steps are performed, this task is used to transport the database and log backups to the SEP sesam Server or RDS.</translate></li>
<li><translate><!--T:31-->
Create a backup task to back up SAP HANA config files and all other required files by specifying all files except the database files and HANA_CONFIG as a source.</translate></li>
<translate><!--T:32-->
The files are located in the following directories:</translate>
*<translate><!--T:33-->
Global config files:</translate> {{Path|/usr/sap/<sid>/SYS/global/hdb/custom/config}}<br /><translate><!--T:34-->
Example:</translate> {{Path|/usr/sap/SEP/SYS/global/hdb/custom/config}}
*<translate><!--T:35-->
Local config files (on each host):</translate> {{Path|/usr/sap/<sid>/HDB<instance>/<host>}} <br /><translate><!--T:36-->
Example:</translate>{{Path|/usr/sap/SEP/HDB00/saphanix1}}
<li><translate><!--T:37-->
Once you created a task, [[Special:MyLanguage/Creating_a_Schedule|create a schedule]] to specify when you want to back up your data. Then you must create a new backup event. Select '''FULL''' as a backup level to perform a full backup. For general details, see [[Special:MyLanguage/Creating_a_Backup_Event|Creating a Backup Event]].</translate></li>
<li><translate><!--T:38-->
Optionally, create a separate media pool to store the backups.</translate></li></ol>


<translate>== {{anchor|install}}Installing and configuring SAP HANA module on the database server == <!--T:39-->
/usr/sap/<SID>/HDB<translate><!--T:258--> <instance number></translate>/exe/hdbsql -i <translate><!--T:259--> <instance number></translate> -n localhost -d SYSTEMDB -u SYSTEM -p PASSWORD "BACKUP DATA FOR SYSTEMDB USING BACKINT ('MyBackIntBackup')"


<!--T:153-->
<translate><!--T:260--> Data backups are prepended with the prefix ''MyBackIntBackup''. Complete backup of the ''SYSTEMDB'' database.</translate>
The installation procedure differs depending on your SAP HANA version.</translate>
<ol><li><translate><!--T:165--> On the HANA server, login as ''root'' user and run <tt>sm_install_saphana</tt> script. The script installs the module and generates the parameter according to the values you entered during its execution. Proceed as follows according to your version:</translate></li>
*<translate><!--T:166--> [[Special:MyLanguage/4_4_3_Tigon:SAP_HANA_Backup#latest|SAP HANA v. ≥ 2.0]]</translate>
*<translate><!--T:167--> [[Special:MyLanguage/4_4_3_Tigon:SAP_HANA_Backup#previous|SAP HANA v. < 2.0]]</translate>
<translate><!--T:168--> {{anchor|latest}}'''SAP HANA v. ≥ 2.0'''</translate><br />
<translate><!--T:169--> You can run the following <tt>sm_install_saphana2</tt> script by using either SAP (''root'') user key or SAP HANA backup user password.</translate>
{{<translate><!--T:170--> Note</translate>|<translate><!--T:171--> You have to run the script for each database in your instance (SYSTEMDB, TenantDB1, TenantDB2, ... TenantDB<number>).</translate>}}
<ul><li><translate><!--T:172--> '''''Running the script by using the SAP user key'''''</translate></li>
sm_install_saphana2 -s <translate><!--T:173--> <SID_name></translate> -i <translate><!--T:174--> <instance_number></translate> -U <translate><!--T:175--> <user_key></translate> -D <translate><!--T:176--> <database></translate> -j <translate><!--T:177--> <backup_task_name></translate> -m <translate><!--T:178--> <media_pool_for_DB_backup></translate> -C <translate><!--T:179--> <server_hostname></translate>


<!--T:154-->
<li><translate><!--T:261--> '''''SAP HANA V2, complete backup, DB TD1:'''''</translate></li>
''<translate><!--T:180--> For example</translate>'': 
sm_install_saphana2 -s SEP -i 90 -U BackupUser -D SYSTEMDB -j HANA_SystemDB -m MP_HANA -C backup-srv.sep.de
<nowiki></nowiki>
<translate><!--T:181--> <SID_name></translate>= SEP
<translate><!--T:182--> <instance_number></translate>= 90
<translate><!--T:183--> <user_key></translate>= BackupUser (<translate><!--T:184--> For details, see [https://help.sap.com/viewer/52715f71adba4aaeb480d946c742d1f6/2.0.04/en-US/48589b0451294074ada6f1049e964d56.html?q=hdbuserstore Using a User Key when Logging On to a Database].</translate>)
<translate><!--T:185--> <database></translate>= SYSTEMDB
<translate><!--T:186--> <backup_task_name></translate>= HANA_SystemDB
<translate><!--T:187--> <media_pool_for_DB_backup></translate>= MP_HANA
<translate><!--T:188--> <server_hostname></translate>= backup-server.sep.de
<li><translate><!--T:189--> '''''Running the script by using the SAP HANA backup user password'''''</translate></li>
sm_install_saphana2 -s <translate><!--T:190--> <SID_name></translate> -i <translate><!--T:191--> <instance_number></translate> -u <translate><!--T:192--> <username></translate> -p <translate><!--T:193--> <password></translate> -D <translate><!--T:194--> <database></translate> -j <translate><!--T:195--> <backup_task_name></translate> -m <translate><!--T:196--> <media_pool_for_DB_backup></translate> -l <translate><!--T:197--> <media_pool_for_log_backup></translate> -C <translate><!--T:198--> <server_hostname></translate> -S <translate><!--T:199--> <RDS_hostname></translate> -d <translate><!--T:200--> <drive_number></translate>


<!--T:155-->
/usr/sap/<SID>/HDB<translate><!--T:262--> <instance number></translate>/exe/hdbsql -i <translate><!--T:263--> <instance number></translate> -n localhost -d SYSTEMDB -u SYSTEM -p PASSWORD "BACKUP DATA FOR TD1 USING BACKINT ('MyBackIntBackup')"
''<translate><!--T:201--> For example</translate>'': 
 
sm_install_saphana2 -s SH2 -i 01 -u SYSTEM -p secret! -D PRD -j HANA_Production_DB -m MP_HANA_DB -l MP_HANA_LOG -C backup-server.sep.de -S rds01.sep.de -d 7
<translate><!--T:264--> Data backups are prepended with the prefix ''MyBackIntBackup''. Complete backup of the tenant DB ''TD1''.</translate>
<nowiki></nowiki>
<translate><!--T:202--> <SID_name></translate>= SH2
<translate><!--T:203--> <instance_number></translate>= 01
<translate><!--T:204--> <username></translate>= SYSTEM
<translate><!--T:205--> <password></translate>= secret!
<translate><!--T:206--> <database></translate>= PRD
<translate><!--T:207--> <backup_task_name></translate>= HANA_Production_DB
<translate><!--T:208--> <media_pool_for_DB_backup></translate>= MP_HANA_DB
<translate><!--T:209--> <media_pool_for_log_backup></translate>= MP_HANA_LOG
<translate><!--T:210--> <server_hostname></translate>= backup-server.sep.de
<translate><!--T:211--> <RDS_hostname></translate>= rds01.sep.de
<translate><!--T:212--> <drive_number></translate>= 7 (<translate><!--T:213--> exclusive reserved drive for SAP HANA backups, for best performance create a separate drive</translate>)
</ul>
</ul>
<translate><!--T:214--> For details on parameters, see section [[Special:MyLanguage/4_4_3_Tigon:SAP_HANA_Backup#parameter|SAP HANA parameter file]]. Then proceed to [[Special:MyLanguage/4_4_3_Tigon:SAP_HANA_Backup#backint_settings|step 2]].</translate>


<translate><!--T:156--> {{anchor|previous}}'''SAP HANA v. < 2.0'''</translate><br />
<translate>=== {{anchor|script_V2}}Starting a scheduled database backup using a script, optionally SAP HANA backup catalog housekeeping (SAP HANA V2) === <!--T:265-->  
 
<!--T:266-->
As of SEP sesam Client [[SEP_sesam_Release_Versions|4.4.3 '' Beefalo V2'']], SEP sesam provides useful bash script for backing up SAP HANA V2 which also enables housekeeping of the SAP HANA backup catalog.
 
<!--T:267-->
The housekeeping function cleans up (purge) the internal SAP HANA backup catalog in relation to available backups in SEP sesam. All SAP HANA DB backups older then the oldest in SEP sesam available SAP HANA Backup ID (BID) are removed from the SAP HANA backup catalog.
 
<!--T:268-->
The script obtains information about the oldest available backup in SEP sesam from the SEP sesam Server or from a local file on the SAP HANA host. This file is written after every ''FULL'' database backup for each database.</translate>
 
{{<translate> <!--T:269--> Note</translate>|
<translate><!--T:270-->
*The script removes ALL entries from the SAP HANA backup catalog, also entries from the backup to a local file, if the BID is older then the oldest in SEP sesam available BID.
*The script does not remove physical backups from the disk.</translate>}}
 
<translate><!--T:271-->
For detailed information, see [https://help.sap.com/viewer/4fe29514fd584807ac9f2a04f6754767/2.0.03/en-US/22275913eb9e4a5bb539fc8df3da77f1.html#:~:text=From%20the%20system%20database%2C%20you,The%20physical%20backups%20are%20retained SAP HANA SQL Reference Guide for SAP HANA Platform: SQL command <tt>BACKUP CATALOG DELETE Statement</tt>]. Make sure that you select relevant documentation for your SAP HANA version. 
 
<!--T:272-->
The script <tt>sbc_hana.sh</tt> is located in {{Path|/opt/sesam/bin/sesam}}. It is an editable bash script which can be started with different parameters.
 
====Script syntax ==== <!--T:273--></translate>


<!--T:41-->
sbc_hana.sh <ACTION> <OPTIONS> <HANA>
<translate><!--T:157--> The command differs for single and multi instance as follows:</translate>


<ul><li><translate><!--T:42-->
Available actions:
'''''SAP HANA single instance'''''</translate></li>
            -b  backup (default)
  /opt/sesam/bin/sesam/sm_install_saphana -C <translate><!--T:215--> <server_hostname></translate> -j hana_backup_task -m sesam_media_pool -l sesam_media_pool -s <translate><!--T:216--> <SID_name></translate> -i <translate><!--T:217--> <instance_number></translate> -u <translate><!--T:218--> <username></translate> -p <translate><!--T:219--> <password></translate>
            -A  purge: HANA backup catalog housekeeping
          OPTIONS:
              for backup
                -l  Level (full/diff/incr)
                -U  User or user key
                -P  Password for a user
                -o  purge: Start HANA backup catalog housekeeping after a ''FULL'' backup
                -C SEP sesam Server: SEP sesam Server to contact for housekeeping
                -J  Task event: Related backup event for housekeeping
                -j Task: Related backup task for housekeeping<nowiki>


<translate><!--T:43-->
    </nowiki>for housekeeping
where hana_backup_task is the name of the task you created before and the same sesam_media_pool is specified twice in the given command!</translate>
                -U  User or user key
                -P  Password for user
                -s  HANA backup ID (BID)
                -C  SEP sesam Server: SEP sesam Server to contact for housekeeping
                -J  Task event: Related task event for housekeeping
                -j  Task: Related task for housekeeping
          HANA
          <SID>/<INSTANCE>/<DATABASE>
          sbc_hana.sh -b -l <full|diff|incr> -U  <user> -P  <password> <SID>/<instance>/<DB>
<translate>====Backup examples==== <!--T:298--></translate>


<li><translate><!--T:44-->
<ul><li><translate><!--T:299--> '''''FULL backup of the database ''PRD'' with SID ''HDB'' and instance ''99'':'''''</translate></li>
'''''SAP HANA multi instance'''''</translate></li>
sbc_hana.sh -b -l full -U bckadm -P secret HDB/99/PRD
<translate><!--T:220--> For each instance, run the following command:</translate>
<translate><!--T:300--> A user with access to the <tt>SYSTEMDB</tt> is ''bckadm'' and password is ''secret''.</translate>
<li><translate><!--T:301--> '''''Incremental backup of the database ''DEV'' with SID ''HX4'' and instance ''01'':'''''</translate></li>
sbc_hana.sh -b -l incr -U bckuserkey H4X/01/DEV
<translate><!--T:302--> A user key for accessing the <tt>SYSTEMDB</tt> is ''bckuserkey''.</translate>
</ul>


/opt/sesam/bin/sesam/sm_install_saphana -C <translate><!--T:221--> <server_hostname></translate> -j hana_backup_task -m sesam_media_pool -l sesam_media_pool -s <translate><!--T:222--> <SID_name></translate> -i <translate><!--T:223--> <instance_number></translate> -u SYSTEM -p <translate><!--T:224--> <password></translate> -M
<translate>====Backup examples with SAP HANA backup catalog housekeeping==== <!--T:303--></translate>


<translate><!--T:45-->
<ul><li><translate><!--T:304--> '''''FULL backup with housekeeping of the database ''PRD'' with SID ''HDB'' and instance ''99'':'''''</translate></li>
where hana_backup_task is the name of the task you created before, <SID_name> is for example ''H02'', <instance_number> is for example ''04'', and the same sesam_media_pool is specified twice in the given command!</translate>
sbc_hana.sh -b -l full -o purge -C backup-srv -j HANA-PRD -U bckadm -P secret HDB/99/PRD
<translate><!--T:305--> A user with access to the <tt>SYSTEMDB</tt> is ''bckadm'', password is ''secret'', SEP sesam Server is ''backup-srv'' and the task is ''HANA-PRD'' (<tt>get oldest</tt> FULL from SEP sesam Server).</translate>
<li><translate><!--T:306--> '''''FULL backup with housekeeping of the database ''PRD'' with SID ''HDB'' and instance ''99'':'''''</translate></li>
sbc_hana.sh -b -l full -o purge -U bckadm -P secret HDB/99/PRD
<translate><!--T:307--> A user with access to the <tt>SYSTEMDB</tt> is ''bckadm'', password is ''secret'' (<tt>get oldest</tt> FULL from a local file, written by last FULL backup).</translate>
</ul>
</ul>
<translate><!--T:158--> For details on parameters, see section [[Special:MyLanguage/4_4_3_Tigon:SAP_HANA_Backup#parameter|SAP HANA parameter file]]. Then proceed to [[Special:MyLanguage/4_4_3_Tigon:SAP_HANA_Backup#backint_settings|step 2]].</translate>


<li><translate><!--T:47-->
<translate>====Examples for SAP HANA backup catalog housekeeping (w/o backup)==== <!--T:308--></translate>
{{anchor|backint_settings}}Start SAP HANA Studio, click one instance to open it and double-click '''Backup''' in the systems view on the left. Select '''Configuration''', expand ''Backint Settings'' and verify that the following is set:</translate></li>
 
<ul><li><translate><!--T:48-->
<ul><li><translate><!--T:309--> '''''Housekeeping for the database ''DEV'' with SID ''HX4'' and instance ''01'':'''''</translate></li>
''Backint Agent'' should be <tt>/opt/sesam/bin/sesam/hdbbackint</tt>.</translate></li>
sbc_hana.sh -A purge -C backup-srv -j HANA-DEV -U bckuserkey H4X/01/DEV
<li><translate><!--T:49-->
<translate><!--T:310--> A user key for accessing the <tt>SYSTEMDB</tt> is ''bckuserkey'', SEP sesam Server is ''backup-srv'' and the task is ''HANA-DEV'' (<tt>get oldest</tt> FULL from SEP sesam Server).</translate>
Make sure that the ''Destination type'' has changed from ''file'' to '''BACKINT'''.</translate></li>
 
<translate><!--T:50-->
<li><translate><!--T:311--> '''''Housekeeping for the database ''DEV'' with SID ''HX4'' and instance ''01'':'''''</translate></li>
[[File:Hana_studio01.PNG|link=]]</translate>
sbc_hana.sh -A purge -U bckuserkey H4X/01/DEV
<br clear=all>
<translate><!--T:312--> A user key for accessing the <tt>SYSTEMDB</tt> is ''bckuserkey'' (<tt>get oldest</tt> FULL from a local file, written by last FULL backup).</translate>
</ul></ol>


<translate>=== Configure backup for SAP HANA backup catalog === <!--T:149-->
<li><translate><!--T:313--> '''''Housekeeping for the database ''DEV'' with SID ''HX4'', instance ''01'' and Backup ID ''1567001886606'':'''''</translate></li>
sbc_hana.sh -A purge -U bckuserkey -s 1567001886606 H4X/01/DEV
<translate><!--T:314--> A user key for accessing the <tt>SYSTEMDB</tt> is ''bckuserkey''. Script will remove all backups older then BID ''156700188660''6 from the HANA backup catalog.</translate>
</ul>


<!--T:150-->
<translate>===={{anchor|schedule}}Scheduling start of the script==== <!--T:350-->  
The SAP HANA backup catalog registers all backups and contains all backup history details. It enables SAP HANA to check and validate whether recovery is possible, which backups are required for recovery and which backups are no longer needed. Note that the backup catalog does not record the progress of a backup; this is done by the ''backup.log''.
{{warning| Backup catalog is mandatory to be able to restore the SAP HANA instance to a different system! Make sure that you configure backup for SAP HANA catalog as described below.}}


<!--T:151-->
The following screenshot shows the parameters that have to be set in order for SAP HANA to write its backup catalog to SEP sesam. The backup catalog will then be backed up during the LOG backup of the HANA instance.


<!--T:152-->
<!--T:351-->
[[File:20181024_catalog-via-backint.png|link=]]
You can schedule start of the script by configuring a command event in the SEP sesam GUI: '''Configuration''' -> '''Command''' -> '''New''' -> name: '''unique name'''. As shown in the screenshot below, a user must be ''root'' and the script must be in {{Path|/opt/sesam/bin/sesam}}. </translate><br>
</translate>
<br clear=all>


<translate>== {{anchor|backup}}Backing up SAP HANA == <!--T:51--></translate>
<translate> <!--T:352--> [[File:hana-commands.jpg|link=]]</translate>
<ol><li><translate><!--T:52-->
To verify the configuration, start full backup from HANA studio: Open the SAP HANA Studio, right-click ''Backup'' under the desired system and select '''Back Up...''' from the context menu. Then select '''Backint''' as backup target, as shown in the screenshot below.</translate></li>
<translate><!--T:53-->
[[File:hanastudio-startbackup2.jpg|link=]] </translate>
<br clear=all>
<br clear=all>
<translate>
<!--T:353-->
A command event will execute the backup script. For general details on command event configuration, see [[Special:MyLanguage/Creating_a_Command_Event|Creating a Command Event]].</translate></li>


<translate><!--T:54-->
<translate>=== {{anchor|script}}Starting a scheduled database backup using a script (SAP HANA V1) === <!--T:318-->  
You have to wait for backup to be completed successfully (<tt>BACKUP STATUS: Backup was successful</tt>). You should also see the corresponding backup activity on the SEP sesam Server side.</translate>
<ul><li><translate><!--T:55-->
If this '''first backup completes successfully''', you can proceed and configure automatic backups.</li>
<li>If the '''first backup fails''', check the following:
<ul><li>Open the {{path|/var/opt/sesam/var/ini/backint_saphana.utl}} file and check that the path and the directory names are correct (directory names are case sensitive).</translate></li>
<li><translate><!--T:56-->
Make sure that {{path|/var/opt/sesam/var/log/lgc}} is writable for your <tt><sid>adm</tt> operating system user. You can also work around this issue by executing {{path|chmod 777 /var/opt/sesam/var/log/lgc}} in the command line. Note that it is strongly recommended to give the write permissions only to your <tt><sid>adm</tt> user.</translate></li>
<translate><!--T:57-->
You can find additional troubleshooting information in the <tt>hdbbackint</tt> log file in the {{path|/var/opt/sesam/var/log/lgc}} directory and in the [[Special:MyLanguage/Troubleshooting_Guide#SAP_Hana|SAP HANA troubleshooting]].</translate></ul></li></ul>


<li><translate><!--T:58-->
<!--T:319-->
To create scheduled full backups, create the <tt>file hdbbackup.sh</tt> with <tt>vi</tt> or <tt>vim</tt> and then paste one of the following HANA backup scripts into in (depending on you SAP HANA installation: single- or multi-instance).</translate></li>
To configure a scheduled full backup, proceed as follows:</translate>
<ol><li><translate><!--T:320--> Create the file <tt>hdbbackup.sh</tt> with <tt>vi</tt> or <tt>vim</tt> and then paste one of the following HANA backup scripts into in (depending on you SAP HANA installation: single- or multi-instance).</translate></li>


;<translate><!--T:59-->
<translate>
SAP HANA single instance installations only:</translate>
<!--T:321-->
'''SAP HANA single instance installations only:'''</translate>
   
   
  #!/bin/sh
  #!/bin/sh
  # <translate><!--T:60-->
  # <translate><!--T:322--> Example script for starting a full SAP HANA database backup</translate>
Example script for starting a full SAP HANA database backup</translate>
   
   
  # <translate><!--T:61-->
  # <translate><!--T:323--> Create a unique backup prefix using the current timestamp</translate>
Create a unique backup prefix using the current timestamp</translate>
  PREFIX="COMPLETE_DATA_BACKUP_`date "+%Y-%m-%d_%H-%M-%S"`_`hostname -s`"
  PREFIX="COMPLETE_DATA_BACKUP_`date "+%Y-%m-%d_%H-%M-%S"`_`hostname -s`"
  echo "Backup Prefix is: $PREFIX"
  echo "Backup Prefix is: $PREFIX"
   
   
  # <translate><!--T:62-->
  # <translate><!--T:324--> Start backup via hdbsql query</translate>
Start backup via hdbsql query</translate>
  echo "Starting backup via hdbsql..."
  echo "Starting backup via hdbsql..."
   
   
  /usr/sap/<span style="color:red"><SID>/HDB<InstanceNumber></span>/exe/hdbsql -i 0 -n localhost -u <span style="color:red">SYSTEM</span> -p <span style="color:red">PASSWORD"</span> BACKUP DATA USING BACKINT ('$PREFIX')"
  /usr/sap/<span style="color:red"><SID>/HDB<InstanceNumber></span>/exe/hdbsql -i 0 -n localhost -u <span style="color:red">SYSTEM</span> -p <span style="color:red">PASSWORD"</span> BACKUP DATA USING BACKINT ('$PREFIX')"
  # <translate><!--T:63-->
  # <translate><!--T:325--> -i <instanceNumber>, -n <node>, -u <dbuser></translate>
-i <instanceNumber>, -n <node>, -u <dbuser></translate>
  # <translate><!--T:326--> Multi tenancy only: -d <database> has to be added and the SQL command is "BACKUP DATA FOR <tenant_db_name> USING BACKINT ('$PREFIX')"</translate>
  # <translate><!--T:64-->
  # <translate><!--T:327--> Possible backup levels are DIFFERENTIAL and INCREMENTAL. --> example: "BACKUP DATA DIFFERENTIAL [FOR <tenant_db_name>] USING BACKINT ('$PREFIX'_DIFF)"</translate>
Multi tenancy only: -d <database> has to be added and the SQL command is "BACKUP DATA FOR <tenant_db_name> USING BACKINT ('$PREFIX')"</translate>
  # <translate><!--T:65-->
Possible backup levels are DIFFERENTIAL and INCREMENTAL. --> example: "BACKUP DATA DIFFERENTIAL [FOR <tenant_db_name>] USING BACKINT ('$PREFIX'_DIFF)"</translate>
   
   
  # <translate><!--T:66-->
  # <translate><!--T:328--> Collect exit code of hdbsql and pass it as exit code of this backup script</translate>
Collect exit code of hdbsql and pass it as exit code of this backup script</translate>
  EXIT_CODE=$?
  EXIT_CODE=$?
  exit $EXIT_CODE
  exit $EXIT_CODE


<ol type="a">
<ol type="a">
<li><translate><!--T:67-->
<li><translate><!--T:329--> In the example script above, change the <span style="color:red">text in red</span> to match your settings</translate></li>
In the example script above, change the <span style="color:red">text in red</span> to match your settings</translate></li>
*<code><span style="color:red"><SID>/HDB<InstanceNumber></span></code> – <translate><!--T:330--> make sure that you use the correct directory</translate>
*<code><span style="color:red"><SID>/HDB<InstanceNumber></span></code> – <translate><!--T:68-->
*<code>-u <span style="color:red">SYSTEM</span> -p <span style="color:red">PASSWORD</span></code> – <translate><!--T:331--> specify username of the system user (which is most of the time SYSTEM) and the password</translate>
make sure that you use the correct directory</translate>
<li><translate><!--T:332--> Save the script file to keep your changes.</translate></li>
*<code>-u <span style="color:red">SYSTEM</span> -p <span style="color:red">PASSWORD</span></code> – <translate><!--T:69-->
<li><translate><!--T:333--> Change the permission of the script with "chmod 700 hdbbackup.sh".</translate></li></ol>  
specify username of the system user (which is most of the time SYSTEM) and the password</translate>
<li><translate><!--T:70-->
Save the script file to keep your changes.</translate></li>
<li><translate><!--T:71-->
Change the permission of the script with "chmod 700 hdbbackup.sh".</translate></li></ol>  


;<translate><!--T:72-->
<translate><!--T:334--> '''SAP HANA multi instance installations:'''</translate>
SAP HANA multi instance installations:</translate>
  #!/bin/sh
  #!/bin/sh
  # <translate><!--T:73-->
  # <translate><!--T:335--> Example script for starting a full SAP HANA database backup</translate>
Example script for starting a full SAP HANA database backup</translate>
   
   
  # <translate><!--T:74-->
  # <translate><!--T:336--> Create a unique backup prefix using the current timestamp</translate>
Create a unique backup prefix using the current timestamp</translate>
  PREFIX="COMPLETE_DATA_BACKUP_`date "+%Y-%m-%d_%H-%M-%S"`_`hostname -s`"
  PREFIX="COMPLETE_DATA_BACKUP_`date "+%Y-%m-%d_%H-%M-%S"`_`hostname -s`"
  echo "Backup Prefix is: $PREFIX"
  echo "Backup Prefix is: $PREFIX"
   
   
  # <translate><!--T:75-->
  # <translate><!--T:337--> Start backup via hdbsql query</translate>
Start backup via hdbsql query</translate>
  echo "Starting backup via hdbsql..."
  echo "Starting backup via hdbsql..."
   
   
  #<translate><!--T:76-->
  #<translate><!--T:338--> Backup of the first tenant over the system DB</translate>
Backup of the first tenant over the system DB</translate>
  /usr/sap/<span style="color:red">H02/HDB10</span>/exe/hdbsql -i 00 -n localhost -d SYSTEMDB -u <span style="color:red">SYSTEM</span> -p <span style="color:red">PASSWORD</span> "BACKUP DATA FOR <span style="color:red">TDW</span> USING BACKINT ('$PREFIX')"
  /usr/sap/<span style="color:red">H02/HDB10</span>/exe/hdbsql -i 00 -n localhost -d SYSTEMDB -u <span style="color:red">SYSTEM</span> -p <span style="color:red">PASSWORD</span> "BACKUP DATA FOR <span style="color:red">TDW</span> USING BACKINT ('$PREFIX')"
  #<translate><!--T:77-->
  #<translate><!--T:339--> The following lines are examples to backup more tenants. In case you need it, remove the #</translate>
The following lines are examples to backup more tenants. In case you need it, remove the #</translate>
  #/usr/sap/<span style="color:red">H02/HDB10</span>/exe/hdbsql -i 00 -n localhost -d SYSTEMDB -u <span style="color:red">SYSTEM</span> -p <span style="color:red">PASSWORD</span> #"BACKUP DATA FOR <span style="color:red">TD1</span> USING BACKINT ('$PREFIX')"
  #/usr/sap/<span style="color:red">H02/HDB10</span>/exe/hdbsql -i 00 -n localhost -d SYSTEMDB -u <span style="color:red">SYSTEM</span> -p <span style="color:red">PASSWORD</span> #"BACKUP DATA FOR <span style="color:red">TD1</span> USING BACKINT ('$PREFIX')"
  #/usr/sap/<span style="color:red">H02/HDB10</span>/exe/hdbsql -i 00 -n localhost -d SYSTEMDB -u <span style="color:red">SYSTEM</span> -p <span style="color:red">PASSWORD</span> #"BACKUP DATA FOR <span style="color:red">TD2</span> USING BACKINT ('$PREFIX')"
  #/usr/sap/<span style="color:red">H02/HDB10</span>/exe/hdbsql -i 00 -n localhost -d SYSTEMDB -u <span style="color:red">SYSTEM</span> -p <span style="color:red">PASSWORD</span> #"BACKUP DATA FOR <span style="color:red">TD2</span> USING BACKINT ('$PREFIX')"
  #<translate><!--T:78-->
  #<translate><!--T:340--> Backup of the SYSTEMDB</translate>
Backup of the SYSTEMDB</translate>
  /usr/sap/<span style="color:red">H02/HDB10</span>/exe/hdbsql -i 00 -n localhost -d SYSTEMDB -u <span style="color:red">SYSTEM</span> -p <span style="color:red">PASSWORD</span> "BACKUP DATA FOR <span style="color:red">SYSTEMDB</span> USING BACKINT ('$PREFIX')"  
  /usr/sap/<span style="color:red">H02/HDB10</span>/exe/hdbsql -i 00 -n localhost -d SYSTEMDB -u <span style="color:red">SYSTEM</span> -p <span style="color:red">PASSWORD</span> "BACKUP DATA FOR <span style="color:red">SYSTEMDB</span> USING BACKINT ('$PREFIX')"  
  # <translate><!--T:79-->
  # <translate><!--T:341--> Collect exit code of hdbsql and pass it as exit code of this backup script</translate>
Collect exit code of hdbsql and pass it as exit code of this backup script</translate>
  EXIT_CODE=$?
  EXIT_CODE=$?
  exit $EXIT_CODE
  exit $EXIT_CODE


<ol type="a">
<ol type="a">
<li><translate><!--T:80-->
<li><translate>
<!--T:342-->
In the example script above, change the <span style="color:red">text in red</span> to match your settings:</translate></li>
In the example script above, change the <span style="color:red">text in red</span> to match your settings:</translate></li>
*<code><span style="color:red">H02/HDB10</span></code> – <translate><!--T:81-->
*<code><span style="color:red">H02/HDB10</span></code> – <translate>
<!--T:343-->
make sure that you use the correct directory</translate>
make sure that you use the correct directory</translate>
*<code>-u <span style="color:red">SYSTEM</span> -p <span style="color:red">PASSWORD</span></code> – <translate><!--T:82-->
*<code>-u <span style="color:red">SYSTEM</span> -p <span style="color:red">PASSWORD</span></code> – <translate>
<!--T:344-->
specify username of the system user (which is most of the time SYSTEM) and the password</translate>  
specify username of the system user (which is most of the time SYSTEM) and the password</translate>  
*<code><span style="color:red">TDW</span></code> – <translate><!--T:83-->
*<code><span style="color:red">TDW</span></code> – <translate>
<!--T:345-->
the actual name of the tenant/DB</translate>
the actual name of the tenant/DB</translate>
<li><translate><!--T:84-->
<li><translate>
<!--T:346-->
Save the script file to keep your changes.</translate></li>
Save the script file to keep your changes.</translate></li>
<li><translate><!--T:85-->
<li><translate><!--T:347--> Change the permission of the script with "chmod 700 hdbbackup.sh".</translate></li></ol>
Change the permission of the script with "chmod 700 hdbbackup.sh".</translate></li></ol>


<li><translate><!--T:86-->
<li><translate><!--T:348--> Schedule start of the script by configuring a command event in the SEP sesam GUI, as described in the above section [[Special:MyLanguage/4_4_3_Tigon:SAP_HANA_Backup#schedule|Scheduling start of the script]].</translate>
Create a new command event: '''GUI''' -> '''Configuration''' -> '''Command''' -> '''New''' -> name: '''hanabackup_DB_SID'''. As shown in the screenshot below, a user must be ''root'' and a command must be {{Path|/opt/sesam/bin/sesam}}). The command event will execute the backup script. For general details on command event configuration, see [[Special:MyLanguage/Creating_a_Command_Event|Creating a Command Event]].</translate></li>
<translate><!--T:87-->
[[File:hana-commands.jpg|link=]]</translate>
<br clear=all>
<br clear=all>
<li><translate><!--T:88-->
<li><translate><!--T:349--> You also have to wait for the SAP HANA system - SEP sesam results table displays an information about a completed full backup (<tt>end backup time</tt>).</translate></li></ol>
You also have to wait for the SAP HANA system - SEP sesam results table displays an information about a completed full backup (<tt>end backup time</tt>).</translate></li>
<li><translate><!--T:89-->
Change the log backup and get a new log file from ''backint'' file.</translate></li>
<li><translate><!--T:90-->
Check if FDI log backup chain varies, for example, <tt>IFFIIIFIIFII</tt>.</translate></li>
{{<translate><!--T:91-->
note|The FDI backup chain can be orphaned in case of problems with the operations order or the time. For example, when FDI is diplayed as <tt>IIIIIIIII</tt>, [[Special:MyLanguage/SEP_sesam_Glossary#EOL|EOL]] is disabled.</translate>}}
</ol>
 
<translate><!--T:92-->
For further information, please refer to the [http://www.saphana.com/docs/DOC-1073 SAP HANA Administration Guide] and the SAP HANA SQL and System Views Reference (SQL Statements -> BACKUP DATA).
 
=={{anchor|housekeeping}}SAP HANA housekeeping==
 
With 4.4.3 ''Beefalo V2'', you can use SAP HANA housekeeping to delete (purge) SEP sesam backups that are no longer needed or can no longer be used for recovery. SEP sesam handles the housekeeping of backups by deleting the stored savesets and their corresponding entries from the list of available backups.
 
There are three different ways to perform SAP HANA housekeeping by running the relevant commands on the SAP HANA server. 
<ul><li>Purge only</li>
sbc_hana.sh -A purge -C <SEP_sesam_Server> -j <SEP_sesam_task> <db_name>
''For example'':
/opt/sesam/bin/sesam/sbc_hana.sh -A purge -U backupuser -C http://meteorologix2.sep.de:11051 -j sap-hana-systemdb  HDB/00/SYSTEMDB
<li>Purge after a ''FULL'' backup</li>
sbc_hana.sh -b -o purge  -C <SEP_sesam_Server> -j <SEP_sesam_task> <db_name>
''For example'':
/opt/sesam/bin/sesam/sbc_hana.sh -b -l FULL -U backupuser -C http://meteorologix2.sep.de:11051 -j sap-hana-hdb -o purge /HDB/00/HDB
<li>If recent <tt>hdbbackint</tt> is installed on the SAP HANA server, the backup ID of the oldest ''FULL'' backup, as listed in the SEP sesam database, is written into a file. Purge is executed immediately after a backup job, initiated by ''sbc_hana.sh'', finishes.</li>
sbc_hana.sh -b -o purge <db_name>
''For example'':
/opt/sesam/bin/sesam/sbc_hana.sh -b -l FULL -U backupuser -o purge HDB/00/HDB
</ol>
==Details of script and parameters== <!--T:93-->
 
=== {{anchor|sm_install_saphana}}Usage of <tt>sm_install_saphana</tt> script=== <!--T:94--></translate>
 
<tt><translate><!--T:95-->
sm_install_saphana</tt> is one-line installation utility that can be executed from the SEP sesam <tt>bin</tt> directory (default: {{path|/opt/sesam/bin/sesam}}. If you encounter errors during the installation process, you may have to manually install
the SAP HANA extension, as described in section [[Special:MyLanguage/4_4_3_Tigon:SAP_HANA_Backup#manual|Manual installation]]. If you are using multi-tenancy feature, double-check the ''backint'' settings in the SAP HANA Studio as shown in step [[Special:MyLanguage/4_4_3_Tigon:SAP HANA Backup#backint_settings|Verify ''Backint Settings'']].
 
<!--T:96-->
Optional arguments of <tt>sm_install_saphana script</tt>:</translate>
  -h, --<translate><!--T:97-->
help</translate>                        <translate><!--T:98-->
show this help message and exit</translate>
  -C <translate><!--T:99-->
<server_hostname></translate>              <translate><!--T:100-->
SEP sesam Server hostname</translate>
  -j <translate><!--T:101-->
<backup_task_name></translate>              <translate><!--T:102-->
Backup task name</translate>
  -m <translate><!--T:103-->
<media_pool_for_DB_backup></translate>      <translate><!--T:104-->
Target media pool for DB backup</translate>
  -l <translate><!--T:105-->
<media_pool_for_log_backup></translate>    <translate><!--T:106-->
Target media pool for log backup</translate>
  -S <translate><!--T:107-->
<RDS_hostname></translate>                  <translate><!--T:159--> SEP sesam Remote Device Server</translate>
  -d <translate><!--T:108-->
<drive_number></translate>                  <translate><!--T:109-->
SEP sesam drive number</translate>
  -M                                <translate><!--T:110-->
SAP HANA Multitenancy</translate>
  -s <translate><!--T:111-->
<SID_name></translate>                      <translate><!--T:160--> SAP HANA SID</translate>
  -i <translate><!--T:112-->
<instance_number></translate>              <translate><!--T:113-->
SAP HANA instance number</translate>
  -u <translate><!--T:114-->
<username></translate>                      <translate><!--T:115-->
SAP HANA backup user</translate>
  -p <translate><!--T:116-->
<password></translate>                      <translate><!--T:117-->
SAP HANA backup user password</translate>
  -n <translate><!--T:118-->
<hostname></translate>                      <translate><!--T:119-->
SAP HANA hostname (hdbsql connection)</translate>
  -D <translate>
<!--T:161-->
<database></translate>                      <translate>
<!--T:162-->
SAP HANA database name</translate>
  -U <translate>
<!--T:163-->
<user_key></translate>                      <translate>
<!--T:164-->
SAP HANA key of the user</translate>
<translate>==={{anchor|parameter}}SAP HANA parameter file=== <!--T:120--></translate>
{{<translate><!--T:121-->
note</translate>|
<translate><!--T:122-->
If you have used the <tt>sm_install_saphana</tt> setup utility for installing the module, the parameter file has already been generated and registered, according to the values you entered during the execution of the script. You may have to go through these steps if some of the criteria for the automatic installation could not be met.</translate>}}
 
<translate><!--T:123-->
You can use different parameter files for different purposes (e.g., to store backups in different media pools). The parameter file used is declared by the <tt>-P PARAMETERFILE</tt> option for <tt>hdbbackint</tt>. During installation, a template parameter file is copied to {{path|/var/opt/sesam/var/ini/backint_saphana.utl}}. You can edit the parameter file and adjust it to suite your environment. Note that all specified parameters are case sensitive.
 
<!--T:124-->
At least the following entries are mandatory to be configured in the parameter file:</translate>
;SESAM_SERVER=<Sesam Server>: <translate><!--T:125-->
Hostname of the SEP sesam Server you want to send the backup to</translate>
;SESAM_JOB=<Sesam SAP Client Task>: <translate><!--T:126-->
Name of the backup task created during configuration</translate>
;SESAM_DRIVE=<Sesam Drive Number>: <translate><!--T:127-->
Number of the SEP sesam drive that you want the backup to be written to</translate>
;SESAM_POOL=<Sesam Mediapool>: <translate><!--T:128-->
Exact name of the SEP sesam media pool that you want to store the backup in</translate>
;SSB_LOGFILE=<Log file name>: <translate><!--T:129-->
Full path of the SEP sesam <tt>backint</tt> log file</translate>
{{<translate><!--T:130-->
tip</translate>|<translate><!--T:131-->
Instead of having only one large log file, you can get a new log file from <tt>backint</tt> by specifying a date identifier in the log file name. The <tt>strftime</tt> function is used for expansion. The <tt>$u</tt> token is replaced by SAP DB user, set from SAP side in <tt>backint call.</translate></tt>
<nowiki>SSB_LOGFILE=/usr/sap/HDB/HDB00/saphanix1/trace/hdbbackint_sbc_backint_log_$u-%Y-%m-%d.log</nowiki>}}
<translate><!--T:132-->
Additional optional configuration parameters are:</translate>
;SBC=<SESAM_PATH>: <translate><!--T:133-->
Full path of the SEP sesam backup client executable. It only has to be set if the standard <tt>sbc</tt> cannot be used.</translate>
;PORT=<Sesam Server Communication Port>: <translate><!--T:134-->
Only necessary if the STPD port was changed during SEP sesam Server installation.</translate>
;SESAM_TAPESERVER=<Remote device server>: <translate><!--T:135-->
Hostname of the RDS that you want to send the backup to. The backup net to be used can be chosen by this entry. Note that the specified hostname here has to match the hostname of the device server which is visible in the used drive's properties.</translate>
 
<translate><!--T:136-->
'''Example of a parameter (.utl) file in {{path|/var/opt/sesam/var/ini}}:'''</translate>
 
<tt>backint_saphana_log.utl:</tt>
  SESAM_SERVER=Serverix
  SESAM_JOB=sep-hana-sesam-log
  SESAM_DRIVE=2
  SESAM_POOL=Daily
  SSB_LOGFILE=/var/opt/sesam/var/log/lgc/backint_saphana_log.log
 
<translate>=={{anchor|manual}}Troubleshooting installation: Manual installation== <!--T:137-->
 
<!--T:138-->
Note that these instructions work with the default SAP HANA directories. You may have to adjust every path in the commands to the path that you have used in a customized installation.</translate>
<ol><li><translate><!--T:139-->
Create the directories needed for the <tt>hdbbackint</tt> binary and utility file:</translate></li>
root@hanasrv:~# mkdir -p /usr/sap/<SID>/SYS/global/hdb/opt/hdbconfig
<li><translate><!--T:140-->
Copy the parameter file template from the <tt>skel/templates</tt> to the SEP sesam <tt>ini</tt> directory.</translate></li>
root@hanasrv:~# cp /opt/sesam/skel/templates/backint_saphana.utl /var/opt/sesam/var/ini/
<li><translate><!--T:141-->
Adjust the permissions of the SEP sesam logging directory.</translate></li>
root@hanasrv:~# chmod 777 /var/opt/sesam/var/log/lgc
<li><translate><!--T:142-->
Create a symbolic link from <code>/opt/sesam/bin/sesam/hdbbackint</code> to the directory where SAP HANA expects the <tt>backint</tt> executable.</translate><br /><translate><!--T:143-->
Note that usually '''root''' permissions are required. The configuration has to be adjusted accordingly. The file must be executable for the SAP HANA user.</translate></li>
root@hanasrv:~# ln -s /opt/sesam/bin/sesam/hdbbackint /usr/sap/<SID>/SYS/global/hdb/opt/hdbbackint
<li><translate><!--T:144-->
Create another symbolic link from <code>/var/opt/sesam/var/ini/backint_saphana.utl</code> to the directory where SAP HANA expects the parameter file:</translate></li>
root@hanasrv:~# ln -s /var/opt/sesam/var/ini/backint_saphana.utl /usr/sap/<SID>/SYS/global/hdb/opt/hdbconfig/
<li><translate><!--T:145-->
Check if the programs <tt>sbc</tt> and <tt>sbc_com_interface</tt> in the directory {{path|<SESAM DIR>/bin/sesam}} are executable for the SAP HANA user.</translate></li>
<li><translate><!--T:146-->
Repeat steps 1-6 on every node of a scale-out system, if given.</translate></li></ol>


<translate><div class="noprint">
<translate><noinclude><div class="noprint">
==See also== <!--T:147-->
==See also== <!--T:147-->
[[Special:MyLanguage/Troubleshooting_Guide#SAP_Hana|SAP HANA troubleshooting]] – [[Special:MyLanguage/SAP_Hana_Logbackup_and_Savepoints|SAP HANA Logbackup and Savepoints]] – [[Special:MyLanguage/4_4_3_Tigon:SAP_HANA_Restore|SAP HANA Restore]]
[[Special:MyLanguage/SAP_Hana_Logbackup_and_Savepoints|SAP HANA Logbackup and Savepoints]] – [[Special:MyLanguage/4_4_3_Tigon:SAP_HANA_Restore|SAP HANA Restore]] – [[Special:MyLanguage/4_4_3_Tigon:SAP_HANA_Configuration|SAP HANA Configuration]]


==External reference== <!--T:148-->
==External reference== <!--T:148-->
[http://www.saphana.com/docs/DOC-1073 SAP HANA Administration Guide]</div></translate>
[http://www.saphana.com/docs/DOC-1073 SAP HANA Administration Guide]</div></noinclude></translate>

Revision as of 12:21, 21 January 2021

Other languages:

Copyright © SEP AG 1999-2024. All rights reserved.

Any form of reproduction of the contents or parts of this manual is allowed only with the express written permission from SEP AG. When compiling and designing user documentation SEP AG uses great diligence and attempts to deliver accurate and correct information. However, SEP AG cannot issue a guarantee for the contents of this manual.

Docs latest icon.png Welcome to the latest SEP sesam documentation version 4.4.3 Tigon/4.4.3 Beefalo V2. For previous documentation version(s), check SAP HANA archive.


Information sign.png SEP AG has discontinued support for SEP sesam version 4.4.3 Tigon (V1 and V2). Instructions are still available for these SEP sesam products, however, SEP AG accepts no responsibility or liability for any errors or inaccuracies in the instructions or for the incorrect operation of obsolete SEP sesam software. It is strongly recommended that you update your SEP sesam software to the latest version.


Overview

SEP sesam provides efficient data protection for your SAP HANA V1 and V2 environment. Among the main technical advantages for using the SEP sesam HDBBackint integration to back up your SAP HANA database are:

  • SEP sesam HDBBackint integration is certified and supported by SAP.
  • Data consistency checks at the block level.
  • Ease of use due to integration into SAP HANA Studio.
  • Integration into your existing backup infrastructure.
  • Additional backup-efficient features, such as deduplication for eliminating redundant backup data.
  • Backups are immediately available for recovery.
  • Only allocated data size has to be backed up.
  • High automation is possible.

As of SEP sesam v. 4.4.3 Beefalo V2, you can perform SAP HANA housekeeping to delete (purge) SEP sesam backups that are no longer needed or can no longer be used for a recovery, based on a defined retention policy. For details, see section SAP HANA housekeeping.

Backing up SAP HANA

The SAP HANA backup is always performed by the database itself and is started with an HDBSQL command. However, you can start the database backup by using a single command in the command line, a shell script or from the SAP HANA Cockpit or SAP HANA Studio. The command and shell scripts can be started by any scheduler, e.g., the SEP sesam SEPuler.

The SAP HANA Logbackup is performed by the database automatically. It is not possible or required to trigger the Logbackup.

The SAP HANA database engine uses the configured *.utl files to communicate with SEP sesam via the backint interface.

Starting a database backup from the HANA Studio (SAP HANA V1 and V2)

To start a full backup from HANA studio, open the SAP HANA Studio, right-click Backup under the desired system and select Back Up... from the context menu. Then select Backint as backup target, as shown in the screenshot below.

Hanastudio-startbackup2.jpg

Starting a database backup from the command line (SAP HANA V1 and V2)

You can start a database backup manually from the command line by using HDBSQL command. For details, check SAP portal for SAP HANA SQL and System Views Reference/SAP HANA SQL Reference Guide for SAP HANA Platform documentation, relevant for your SAP HANA version.

Simple examples for starting a database backup

Replace the -u and -p parameters with the values of your backup user and the <SID> and <instance number> fitting your SAP HANA system.

  • SAP HANA V1, complete backup, single instance:
  • /usr/sap/<SID>/HDB<instance number>/exe/hdbsql -i <instance number> -n localhost -u SYSTEM -p PASSWORD "BACKUP DATA USING BACKINT ('MyBackIntBackup')" Data backups are prepended with the prefix MyBackIntBackup.
  • SAP HANA V1, complete backup, multiple instances, DB TENANT1:
  • /usr/sap/<SID>/HDB<instance number>/exe/hdbsql -i <instance number> -n localhost -d SYSTEMDB -u SYSTEM -p PASSWORD "BACKUP DATA FOR TENANT1 USING BACKINT ('MyBackIntBackup')" Data backups are prepended with the prefix MyBackIntBackup. Complete backup of the tenant DB with the name TENANT1.
  • SAP HANA V2, complete backup, DB SYSTEMDB:
  • /usr/sap/<SID>/HDB<instance number>/exe/hdbsql -i <instance number> -n localhost -d SYSTEMDB -u SYSTEM -p PASSWORD "BACKUP DATA FOR SYSTEMDB USING BACKINT ('MyBackIntBackup')" Data backups are prepended with the prefix MyBackIntBackup. Complete backup of the SYSTEMDB database.
  • SAP HANA V2, complete backup, DB TD1:
  • /usr/sap/<SID>/HDB<instance number>/exe/hdbsql -i <instance number> -n localhost -d SYSTEMDB -u SYSTEM -p PASSWORD "BACKUP DATA FOR TD1 USING BACKINT ('MyBackIntBackup')" Data backups are prepended with the prefix MyBackIntBackup. Complete backup of the tenant DB TD1.

Starting a scheduled database backup using a script, optionally SAP HANA backup catalog housekeeping (SAP HANA V2)

As of SEP sesam Client 4.4.3 Beefalo V2, SEP sesam provides useful bash script for backing up SAP HANA V2 which also enables housekeeping of the SAP HANA backup catalog.

The housekeeping function cleans up (purge) the internal SAP HANA backup catalog in relation to available backups in SEP sesam. All SAP HANA DB backups older then the oldest in SEP sesam available SAP HANA Backup ID (BID) are removed from the SAP HANA backup catalog.

The script obtains information about the oldest available backup in SEP sesam from the SEP sesam Server or from a local file on the SAP HANA host. This file is written after every FULL database backup for each database.

Information sign.png Note
  • The script removes ALL entries from the SAP HANA backup catalog, also entries from the backup to a local file, if the BID is older then the oldest in SEP sesam available BID.
  • The script does not remove physical backups from the disk.

For detailed information, see SAP HANA SQL Reference Guide for SAP HANA Platform: SQL command BACKUP CATALOG DELETE Statement. Make sure that you select relevant documentation for your SAP HANA version.

The script sbc_hana.sh is located in /opt/sesam/bin/sesam. It is an editable bash script which can be started with different parameters.

Script syntax

sbc_hana.sh <ACTION> <OPTIONS> <HANA>
Available actions:
            -b  backup (default)
            -A  purge: HANA backup catalog housekeeping

         OPTIONS:
             for backup
               -l  Level (full/diff/incr)
               -U  User or user key
               -P  Password for a user
               -o  purge: Start HANA backup catalog housekeeping after a FULL backup
               -C  SEP sesam Server: SEP sesam Server to contact for housekeeping
               -J  Task event: Related backup event for housekeeping
               -j  Task: Related backup task for housekeeping
 

     for housekeeping
               -U  User or user key
               -P  Password for user
               -s  HANA backup ID (BID)
               -C  SEP sesam Server: SEP sesam Server to contact for housekeeping
               -J  Task event: Related task event for housekeeping
               -j  Task: Related task for housekeeping

         HANA
          <SID>/<INSTANCE>/<DATABASE>

         sbc_hana.sh -b -l <full|diff|incr> -U  <user> -P  <password> <SID>/<instance>/<DB>

Backup examples

  • FULL backup of the database PRD with SID HDB and instance 99:
  • sbc_hana.sh -b -l full -U bckadm -P secret HDB/99/PRD A user with access to the SYSTEMDB is bckadm and password is secret.
  • Incremental backup of the database DEV with SID HX4 and instance 01:
  • sbc_hana.sh -b -l incr -U bckuserkey H4X/01/DEV A user key for accessing the SYSTEMDB is bckuserkey.

Backup examples with SAP HANA backup catalog housekeeping

  • FULL backup with housekeeping of the database PRD with SID HDB and instance 99:
  • sbc_hana.sh -b -l full -o purge -C backup-srv -j HANA-PRD -U bckadm -P secret HDB/99/PRD A user with access to the SYSTEMDB is bckadm, password is secret, SEP sesam Server is backup-srv and the task is HANA-PRD (get oldest FULL from SEP sesam Server).
  • FULL backup with housekeeping of the database PRD with SID HDB and instance 99:
  • sbc_hana.sh -b -l full -o purge -U bckadm -P secret HDB/99/PRD A user with access to the SYSTEMDB is bckadm, password is secret (get oldest FULL from a local file, written by last FULL backup).

Examples for SAP HANA backup catalog housekeeping (w/o backup)

  • Housekeeping for the database DEV with SID HX4 and instance 01:
  • sbc_hana.sh -A purge -C backup-srv -j HANA-DEV -U bckuserkey H4X/01/DEV A user key for accessing the SYSTEMDB is bckuserkey, SEP sesam Server is backup-srv and the task is HANA-DEV (get oldest FULL from SEP sesam Server).
  • Housekeeping for the database DEV with SID HX4 and instance 01:
  • sbc_hana.sh -A purge -U bckuserkey H4X/01/DEV A user key for accessing the SYSTEMDB is bckuserkey (get oldest FULL from a local file, written by last FULL backup).
  • Housekeeping for the database DEV with SID HX4, instance 01 and Backup ID 1567001886606:
  • sbc_hana.sh -A purge -U bckuserkey -s 1567001886606 H4X/01/DEV A user key for accessing the SYSTEMDB is bckuserkey. Script will remove all backups older then BID 1567001886606 from the HANA backup catalog.

Scheduling start of the script

You can schedule start of the script by configuring a command event in the SEP sesam GUI: Configuration -> Command -> New -> name: unique name. As shown in the screenshot below, a user must be root and the script must be in /opt/sesam/bin/sesam.

Hana-commands.jpg


A command event will execute the backup script. For general details on command event configuration, see Creating a Command Event.

Starting a scheduled database backup using a script (SAP HANA V1)

To configure a scheduled full backup, proceed as follows:

  1. Create the file hdbbackup.sh with vi or vim and then paste one of the following HANA backup scripts into in (depending on you SAP HANA installation: single- or multi-instance).
  2. SAP HANA single instance installations only: #!/bin/sh # Example script for starting a full SAP HANA database backup # Create a unique backup prefix using the current timestamp PREFIX="COMPLETE_DATA_BACKUP_`date "+%Y-%m-%d_%H-%M-%S"`_`hostname -s`" echo "Backup Prefix is: $PREFIX" # Start backup via hdbsql query echo "Starting backup via hdbsql..." /usr/sap/<SID>/HDB<InstanceNumber>/exe/hdbsql -i 0 -n localhost -u SYSTEM -p PASSWORD" BACKUP DATA USING BACKINT ('$PREFIX')" # -i <instanceNumber>, -n <node>, -u <dbuser> # Multi tenancy only: -d <database> has to be added and the SQL command is "BACKUP DATA FOR <tenant_db_name> USING BACKINT ('$PREFIX')" # Possible backup levels are DIFFERENTIAL and INCREMENTAL. --> example: "BACKUP DATA DIFFERENTIAL [FOR <tenant_db_name>] USING BACKINT ('$PREFIX'_DIFF)" # Collect exit code of hdbsql and pass it as exit code of this backup script EXIT_CODE=$? exit $EXIT_CODE
    1. In the example script above, change the text in red to match your settings
      • <SID>/HDB<InstanceNumber> – make sure that you use the correct directory
      • -u SYSTEM -p PASSWORD – specify username of the system user (which is most of the time SYSTEM) and the password
    2. Save the script file to keep your changes.
    3. Change the permission of the script with "chmod 700 hdbbackup.sh".

    SAP HANA multi instance installations:

    #!/bin/sh
    # Example script for starting a full SAP HANA database backup
    
    # Create a unique backup prefix using the current timestamp
    PREFIX="COMPLETE_DATA_BACKUP_`date "+%Y-%m-%d_%H-%M-%S"`_`hostname -s`"
    echo "Backup Prefix is: $PREFIX"
    
    # Start backup via hdbsql query
    echo "Starting backup via hdbsql..."
    
    #Backup of the first tenant over the system DB
    /usr/sap/H02/HDB10/exe/hdbsql -i 00 -n localhost -d SYSTEMDB -u SYSTEM -p PASSWORD "BACKUP DATA FOR TDW USING BACKINT ('$PREFIX')"
    #The following lines are examples to backup more tenants. In case you need it, remove the #
    #/usr/sap/H02/HDB10/exe/hdbsql -i 00 -n localhost -d SYSTEMDB -u SYSTEM -p PASSWORD #"BACKUP DATA FOR TD1 USING BACKINT ('$PREFIX')"
    #/usr/sap/H02/HDB10/exe/hdbsql -i 00 -n localhost -d SYSTEMDB -u SYSTEM -p PASSWORD #"BACKUP DATA FOR TD2 USING BACKINT ('$PREFIX')"
    #Backup of the SYSTEMDB
    /usr/sap/H02/HDB10/exe/hdbsql -i 00 -n localhost -d SYSTEMDB -u SYSTEM -p PASSWORD "BACKUP DATA FOR SYSTEMDB USING BACKINT ('$PREFIX')" 
    # Collect exit code of hdbsql and pass it as exit code of this backup script
    EXIT_CODE=$?
    exit $EXIT_CODE
    
    1. In the example script above, change the text in red to match your settings:
      • H02/HDB10 – make sure that you use the correct directory
      • -u SYSTEM -p PASSWORD – specify username of the system user (which is most of the time SYSTEM) and the password
      • TDW – the actual name of the tenant/DB
    2. Save the script file to keep your changes.
    3. Change the permission of the script with "chmod 700 hdbbackup.sh".
  3. Schedule start of the script by configuring a command event in the SEP sesam GUI, as described in the above section Scheduling start of the script.
  4. You also have to wait for the SAP HANA system - SEP sesam results table displays an information about a completed full backup (end backup time).