a6150467e5be6870ab2b5b7e55d2d9d0c7a1cc24
Fixes an issue in 'monitor.sh' where the HANA backup monitoring used incorrect variable names ('HANA_USERKEY' instead of 'HANA_USER_KEY') and did not explicitly use the configured 'HDBSQL_PATH' for the 'hdbsql' command. Updates script version to 1.1.1.
SAP HANA Automation Scripts
This repository contains a collection of Bash and Batch scripts designed to automate various administrative and monitoring tasks for SAP HANA databases.
Installation
To get started, you can use the install.sh script to download and set up the tools:
bash -c "$(curl -sSL https://install.technopunk.space)"
This command will download and execute the install.sh script, which provides an interactive menu to select and install individual tools.
Tools Overview
Here's a breakdown of the scripts included in this repository:
1. install.sh (Script Downloader)
- Purpose: An interactive script to download and manage other scripts from a remote
packages.conffile. - Features:
- Presents a menu of available tools.
- Checks for updates to installed scripts.
- Shows a
difffor configuration files before overwriting. - Automatically makes downloaded shell scripts executable.
- Usage: Run the script and follow the on-screen prompts.
2. packages.conf (Configuration for install.sh)
- Purpose: Defines the list of available scripts, their versions, and their download URLs for
install.sh. - Format: An associative array
SCRIPT_PACKAGESwhere keys are package names and values areversion|URL1 URL2....
3. clean.sh (File Cleaner)
- Purpose: Deletes files older than a specified retention period in given directories.
- Usage:
./clean.sh <retention_days>:<path> [<retention_days>:<path> ...] - Example:
./clean.sh 30:/var/log 7:/tmp/downloads
4. hanatool.sh (SAP HANA Schema and Tenant Management Tool)
- Purpose: A versatile tool for exporting/importing HANA schemas and performing tenant backups.
- Features:
- Export a schema.
- Import a schema (with optional renaming).
- Perform a full tenant backup.
- Supports compression (
tar.gz). - Dry-run mode to preview commands.
- Ntfy.sh notifications for completion/failure.
- Custom
hdbsqlpath.
- Usage:
- Schema:
./hanatool.sh [USER_KEY] export|import [SCHEMA_NAME] [PATH] [OPTIONS] - Schema Rename:
./hanatool.sh [USER_KEY] import-rename [SCHEMA_NAME] [NEW_SCHEMA_NAME] [PATH] [OPTIONS] - Tenant:
./hanatool.sh [USER_KEY] backup [PATH] [OPTIONS]
- Schema:
- Options:
-t, --threads N,-c, --compress,-n, --dry-run,--ntfy <token>,--hdbsql <path>,-h, --help
5. hdb_keymanager.sh (SAP HANA Secure User Store Key Manager)
- Purpose: An interactive script to manage SAP HANA
hdbuserstorekeys. - Features:
- Create new secure keys with interactive prompts.
- Delete existing keys from a selection list.
- Test connections for existing keys.
- Includes rollback functionality if a newly created key fails to connect.
- Usage:
./hdb_keymanager.sh(runs an interactive menu)
6. update.bat (Git Update Script for Windows)
- Purpose: A simple Windows Batch script to stage all changes, commit with a user-provided message, and push to a Git repository.
- Usage:
update.bat
7. aurora/aurora.sh (HANA Aurora Refresh Script)
- Purpose: Automates the refresh of a "Aurora" schema (a copy of a production schema) for testing or development.
- Configuration: Uses
aurora/aurora.conf. - Features:
- Exports a source schema.
- Imports and renames it to an Aurora schema.
- Updates company name fields in the imported schema.
- Can drop existing Aurora schema before refresh.
- Grants privileges to a specified user.
- Runs post-import SQL scripts.
- Usage: The script runs automatically based on the settings in
aurora/aurora.conf. It is typically scheduled via cron.
8. aurora/aurora.conf (Configuration for aurora.sh)
- Purpose: Configures the
aurora.shscript, including source schema, target user, backup directory,hdbsqlpath, and post-import SQL scripts.
9. backup/backup.sh (SAP HANA Automated Backup Script)
- Purpose: Performs automated schema exports and/or tenant backups for SAP HANA databases, typically via cronjobs.
- Configuration: Uses
backup/backup.conf. - Features:
- Supports schema exports for multiple schemas.
- Performs full tenant data backups.
- Optionally backs up the SYSTEMDB.
- Supports compression for both schema exports and tenant backups.
- Configurable backup types (
schema,tenant,all).
- Usage:
./backup/backup.sh(all settings are read frombackup.conf)
10. backup/backup.conf (Configuration for backup.sh)
- Purpose: Configures the
backup.shscript, includinghdbsqlpath, user keys, base backup directory, backup type, compression settings, and schema names to export.
11. monitor/monitor.sh (SAP HANA Monitoring Script)
- Purpose: Monitors SAP HANA processes, disk usage, and log segment states, sending ntfy.sh notifications for alerts.
- Configuration: Uses
monitor/monitor.conf. - Features:
- Checks if all HANA processes are running (GREEN status).
- Monitors disk usage for specified directories against a threshold.
- Analyzes HANA log segments for 'Truncated' and 'Free' percentages against thresholds.
- Sends detailed notifications via ntfy.sh.
- Uses a lock file to prevent multiple instances from running.
- Usage:
./monitor/monitor.sh(all settings are read frommonitor.conf)
12. monitor/monitor.conf (Configuration for monitor.sh)
- Purpose: Configures the
monitor.shscript, including company name, ntfy.sh settings, HANA connection details, monitoring thresholds (disk usage, log segments), and directories to monitor.
Description
Languages
Shell
99.8%
Batchfile
0.2%