# ๐Ÿš€ SAP HANA Automation Scripts A collection of powerful Bash scripts designed to automate and simplify SAP HANA administration, monitoring, and management tasks. ## โœจ Key Features * **Automate Everything**: Schedule routine backups, file cleanups, and schema refreshes. * **Monitor Proactively**: Keep an eye on system health, disk space, and backup status with automated alerts. * **Simplify Management**: Use powerful command-line tools and interactive menus for common tasks. * **Secure**: Integrates with SAP's secure user store (`hdbuserstore`) for credential management. * **Get Notified**: Receive completion and failure alerts via `ntfy.sh`. ## โš™๏ธ Quick Install Get started in seconds. The interactive installer will guide you through selecting the tools you need. ```sh bash -c "$(curl -sSL https://install.technopunk.space)" ``` ## ๐Ÿ› ๏ธ Tools Overview The following scripts and suites are included. Suites are configured via a `.conf` file in their respective directories. | Tool | Purpose & Core Function | | :------------- | :------------------------------------------------------------------------------------------------------------------------------------------- | | **`cleaner`** ๐Ÿงน | **File Cleaner**: Deletes files older than a specified retention period. Ideal for managing logs and temporary files. | | **`hanatool`** ๐Ÿ—„๏ธ | **HANA Management**: A powerful CLI tool to export/import schemas, perform full tenant backups, and compress artifacts. | | **`keymanager`** ๐Ÿ”‘ | **Key Manager**: An interactive menu to easily create, delete, and test `hdbuserstore` keys with an automatic rollback safety feature. | | **`aurora`** ๐ŸŒ… | **Schema Refresh Suite**: Automates refreshing a non-production schema from a production source. | | **`backup`** ๐Ÿ’พ | **Backup Suite**: A complete, cron-friendly solution for scheduling schema exports and/or full tenant backups with configurable compression. | | **`monitor`** ๐Ÿ“Š | **Monitoring Suite**: Continuously checks HANA process status, disk usage, log segments, and backup age, sending alerts when thresholds are breached. | ## ๐Ÿ“– Tool Details ### 1\. `cleaner.sh` (File Cleaner) ๐Ÿงน * **Purpose**: Deletes files older than a specified retention period from given directories to help manage disk space. ### 2\. `hanatool.sh` (SAP HANA Schema & Tenant Management) ๐Ÿ—„๏ธ * **Purpose**: A versatile command-line utility for SAP HANA, enabling quick exports and imports of schemas, as well as full tenant backups. * **Features**: * Export/Import schemas (with optional renaming). * Perform full tenant backups. * Dry-run mode to preview commands. * `ntfy.sh` notifications for task completion/failure. * **Options**: `-t, --threads N`, `-c, --compress`, `-n, --dry-run`, `--ntfy `, `--replace`, `--hdbsql `, `-h, --help` ### 3\. `keymanager.sh` (Secure User Store Key Manager) ๐Ÿ”‘ * **Purpose**: An interactive script to simplify the creation, deletion, and testing of SAP HANA `hdbuserstore` keys. * **Features**: * Interactive menu for easy key management. * Connection testing for existing keys. * Automatic rollback of a newly created key if its connection test fails. ### 4\. `aurora.sh` (HANA Aurora Refresh Suite) ๐ŸŒ… * **Purpose**: Automates the refresh of a "copy" schema from a production source, ensuring non-production environments stay up-to-date. * **Process**: 1. Drops the existing target schema (optional). 2. Exports the source schema from production. 3. Imports and renames the data to the target schema. 4. Runs post-import configurations and grants privileges. ### 5\. `backup.sh` (SAP HANA Automated Backup Suite) ๐Ÿ’พ * **Purpose**: Provides automated, scheduled backups for SAP HANA databases. * **Features**: * Supports schema exports, full tenant data backups, or both. * Configurable compression to save disk space. * Uses secure `hdbuserstore` keys for connections. ### 6\. `monitor.sh` (SAP HANA Monitoring Suite) ๐Ÿ“Š * **Purpose**: Continuously monitors critical aspects of SAP HANA and sends proactive alerts via `ntfy.sh` when predefined thresholds are exceeded. * **Checks Performed**: * Verifies all HANA processes have a 'GREEN' status. * Monitors disk usage against a set threshold. * Analyzes log segment state. * Checks the age of the last successful data backup.