HANA 1.0 SPS12下能否定时备份Delivery Unit或Calculation Views(CVs)
Hey there! Let's break down how to set up scheduled backups for your Delivery Units (DUs) and Calculation Views (CVs) in HANA 1.0 SPS12. While HANA doesn't have a built-in one-click scheduler specifically for these objects, you can absolutely automate the process using a mix of HANA's export commands and operating system-level task tools. Here's the step-by-step:
Scheduled Backup for Delivery Units
Write an HDBSQL export script
Start by creating a script that uses HDBSQL to export your target Delivery Unit. The core command looks like this:EXPORT DELIVERY UNIT "MY_TARGET_DU" TO '/hana/backup/du_backups' WITH OVERWRITE;Swap out
MY_TARGET_DUwith your actual DU name, and/hana/backup/du_backupswith a directory the HANA database user has write access to.Automate with OS scheduling
- On Linux: Use
cronto schedule the script to run at your desired time. For example, to run daily at 2 AM, add this line to the crontab of a user with HDBSQL access:
(Pro tip: Avoid plaintext passwords by using HANA's secure user store (0 2 * * * /usr/sap/<SID>/HDB<INSTANCE>/exe/hdbsql -i <INSTANCE> -U <SECURE_USER_STORE_KEY> -f /path/to/du_export_script.sqlhdbuserstore) instead of hardcoding credentials.) - On Windows: Use Task Scheduler to create a task that runs a batch file executing the HDBSQL command at your chosen interval.
- On Linux: Use
Scheduled Backup for Calculation Views
Calculation Views are tied to design-time packages, so the most reliable way to back them up is to export their parent package (this captures dependencies like underlying tables or functions too):
Export the package via HDBSQL
Use this command in your script:EXPORT PACKAGE "MY_CV_PARENT_PACKAGE" TO '/hana/backup/cv_backups' WITH OVERWRITE;Replace
MY_CV_PARENT_PACKAGEwith the package containing your Calculation Views.Schedule the script
Follow the same OS scheduling steps as above (cron for Linux, Task Scheduler for Windows) to run this script on your preferred timeline.
Important Notes
- Permissions: Make sure the user running the script has the
EXPORTsystem privilege in HANA, plus write access to the export directory. - Validation: Add a quick check in your script (like verifying the exported file size) to alert you if a backup fails—this helps catch issues early.
- Version Context: HANA 1.0 SPS12 is end-of-life, so while these methods work perfectly for your current setup, upgrading to a newer HANA version would give you access to more integrated backup tools and ongoing support.
内容的提问来源于stack exchange,提问作者Anirudh D

