refactor(readme): Improve README.md structure, update tool descriptions, and remove non-HANA related scripts.

This commit is contained in:
2025-09-26 15:05:41 +02:00
parent 6b2132a7ab
commit a8fc2c07e8

159
README.md
View File

@@ -1,119 +1,94 @@
# SAP HANA Automation Scripts # 🚀 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. This repository offers a comprehensive collection of Bash and Batch scripts designed to streamline various administrative and monitoring tasks for SAP HANA databases. Automate your routine operations and enhance your database management efficiency!
## Installation ## ⚙️ Installation
To get started, you can use the `install.sh` script to download and set up the tools: To quickly set up these powerful tools on your server, simply execute the following command:
```sh ```sh
bash -c "$(curl -sSL https://install.technopunk.space)" 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. This command will download and run our interactive `install.sh` script, guiding you through the selection and installation of individual tools. No manual downloads required!
## Tools Overview ## 🛠️ Tools Overview
Here's a breakdown of the scripts included in this repository: Here's a detailed look at the automation scripts available in this repository:
### 1. `install.sh` (Script Downloader) ### 1. `cleaner.sh` (File Cleaner) 🧹
* **Purpose**: An interactive script to download and manage other scripts from a remote `packages.conf` file. * **Purpose**: This script efficiently deletes files older than a specified retention period from given directories. It's designed to help manage disk space by automatically removing aged files.
* **Usage**: `./cleaner.sh <retention_days>:<path> [<retention_days>:<path> ...]`
* **Example**: `./cleaner.sh 30:/var/log 7:/tmp/downloads`
### 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. It supports various options for flexible database management.
* **Features**: * **Features**:
* Presents a menu of available tools. * Export/Import schemas (with optional renaming).
* Checks for updates to installed scripts. * Perform full tenant backups.
* Shows a `diff` for configuration files before overwriting. * Supports `tar.gz` compression for efficient storage.
* Automatically makes downloaded shell scripts executable. * Dry-run mode for command preview without execution.
* **Usage**: Run the script and follow the on-screen prompts. * Ntfy.sh notifications for task completion/failure alerts.
* Custom `hdbsql` path support for flexible environments.
### 2. `packages.conf` (Configuration for `install.sh`) * Option to replace existing objects during import.
* **Purpose**: Defines the list of available scripts, their versions, and their download URLs for `install.sh`.
* **Format**: An associative array `SCRIPT_PACKAGES` where keys are package names and values are `version|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 `hdbsql` path.
* **Usage**: * **Usage**:
* Schema: `./hanatool.sh [USER_KEY] export|import [SCHEMA_NAME] [PATH] [OPTIONS]` * Schema Export/Import: `./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]` * Schema Rename Import: `./hanatool.sh [USER_KEY] import-rename [SCHEMA_NAME] [NEW_SCHEMA_NAME] [PATH] [OPTIONS]`
* Tenant: `./hanatool.sh [USER_KEY] backup [PATH] [OPTIONS]` * Tenant Backup: `./hanatool.sh [USER_KEY] backup [PATH] [OPTIONS]`
* **Options**: `-t, --threads N`, `-c, --compress`, `-n, --dry-run`, `--ntfy <token>`, `--hdbsql <path>`, `-h, --help` * **Options**: `-t, --threads N`, `-c, --compress`, `-n, --dry-run`, `--ntfy <token>`, `--replace`, `--hdbsql <path>`, `-h, --help`
### 5. `hdb_keymanager.sh` (SAP HANA Secure User Store Key Manager) ### 3. `keymanager.sh` (SAP HANA Secure User Store Key Manager) 🔑
* **Purpose**: An interactive script to manage SAP HANA `hdbuserstore` keys. * **Purpose**: An interactive script designed to simplify the creation, deletion, and testing of SAP HANA `hdbuserstore` keys. It includes a rollback mechanism for failed key creations to ensure system integrity.
* **Features**: * **Features**:
* Create new secure keys with interactive prompts. * Interactive menu for key management.
* Delete existing keys from a selection list. * Create new secure keys with guided prompts for host, instance, tenant, and user.
* Test connections for existing keys. * Delete existing keys from a dynamic selection list.
* Includes rollback functionality if a newly created key fails to connect. * Test connections for existing keys to verify functionality.
* **Usage**: `./hdb_keymanager.sh` (runs an interactive menu) * Automatic rollback (deletion) of newly created keys if connection test fails.
* **Usage**: `./keymanager.sh` (runs an interactive menu)
### 6. `update.bat` (Git Update Script for Windows) ### 4. `aurora/` (HANA Aurora Refresh Suite) 🌅
* **Purpose**: A simple Windows Batch script to stage all changes, commit with a user-provided message, and push to a Git repository. * **Purpose**: This suite automates the refresh of "Aurora" schemas, which are copies of production schemas used for testing or development. It ensures these environments are up-to-date with production data.
* **Usage**: `update.bat` * **Components**:
* `aurora.sh`: The main script that orchestrates the refresh process.
### 7. `aurora/aurora.sh` (HANA Aurora Refresh Script) * `aurora.conf`: Configuration file for `aurora.sh`, defining source schema, target user, paths, and post-import actions.
* **Purpose**: Automates the refresh of a "Aurora" schema (a copy of a production schema) for testing or development.
* **Configuration**: Uses `aurora/aurora.conf`.
* **Features**: * **Features**:
* Exports a source schema. * Drops existing Aurora schema before refresh (optional).
* Imports and renames it to an Aurora schema. * Exports a specified source schema from production.
* Updates company name fields in the imported schema. * Imports the exported data and renames it to the Aurora schema.
* Can drop existing Aurora schema before refresh. * Updates company name fields within the newly imported schema.
* Grants privileges to a specified user. * Grants necessary privileges to a designated user on the Aurora schema.
* Runs post-import SQL scripts. * Executes custom post-import SQL scripts for further data manipulation or setup.
* **Usage**: The script runs automatically based on the settings in `aurora/aurora.conf`. It is typically scheduled via cron. * **Usage**: Designed for automated execution, typically scheduled via cron, with all settings managed in `aurora/aurora.conf`.
### 8. `aurora/aurora.conf` (Configuration for `aurora.sh`) ### 6. `backup/` (SAP HANA Automated Backup Suite) 💾
* **Purpose**: Configures the `aurora.sh` script, including source schema, target user, backup directory, `hdbsql` path, and post-import SQL scripts. * **Purpose**: This suite provides automated solutions for performing schema exports and/or full tenant backups for SAP HANA databases. It's ideal for setting up reliable, scheduled backup routines via cronjobs.
* **Components**:
### 9. `backup/backup.sh` (SAP HANA Automated Backup Script) * `backup.sh`: The core script that executes the backup operations.
* `backup.conf`: Configuration file for `backup.sh`, specifying `hdbsql` path, user keys, backup directories, types, compression settings, and schemas to export.
* **Purpose**: Performs automated schema exports and/or tenant backups for SAP HANA databases, typically via cronjobs.
* **Configuration**: Uses `backup/backup.conf`.
* **Features**: * **Features**:
* Supports schema exports for multiple schemas. * Supports various backup types: schema export, tenant data backup, or both.
* Performs full tenant data backups.
* Optionally backs up the SYSTEMDB. * Optionally backs up the SYSTEMDB.
* Supports compression for both schema exports and tenant backups. * Configurable compression for both schema exports and tenant backups to save disk space.
* Configurable backup types (`schema`, `tenant`, `all`). * Uses `hdbuserstore` keys for secure database connections.
* **Usage**: `./backup/backup.sh` (all settings are read from `backup.conf`) * **Usage**: `./backup/backup.sh` (all operational parameters are read from `backup/backup.conf`).
### 10. `backup/backup.conf` (Configuration for `backup.sh`) ### 7. `monitor/` (SAP HANA Monitoring Suite) 📊
* **Purpose**: Configures the `backup.sh` script, including `hdbsql` path, user keys, base backup directory, backup type, compression settings, and schema names to export. * **Purpose**: This suite continuously monitors critical aspects of SAP HANA databases, including process status, disk usage, and log segment states. It sends proactive alerts via ntfy.sh when predefined thresholds are exceeded.
* **Components**:
### 11. `monitor/monitor.sh` (SAP HANA Monitoring Script) * `monitor.sh`: The main script that performs the monitoring checks.
* `monitor.conf`: Configuration file for `monitor.sh`, defining company name, ntfy.sh settings, HANA connection details, monitoring thresholds (disk usage, log segments, backup age), and directories to monitor.
* **Purpose**: Monitors SAP HANA processes, disk usage, and log segment states, sending ntfy.sh notifications for alerts.
* **Configuration**: Uses `monitor/monitor.conf`.
* **Features**: * **Features**:
* Checks if all HANA processes are running (GREEN status). * Checks if all SAP HANA processes are running with a 'GREEN' status.
* Monitors disk usage for specified directories against a threshold. * Monitors disk usage for specified directories against a configurable percentage threshold.
* Analyzes HANA log segments for 'Truncated' and 'Free' percentages against thresholds. * Analyzes HANA log segments for 'Truncated' and 'Free' percentages, alerting if they fall outside acceptable ranges.
* Sends detailed notifications via ntfy.sh. * Monitors the age of the last successful complete data backup, alerting if it exceeds a defined time threshold.
* Uses a lock file to prevent multiple instances from running. * Sends detailed notifications via ntfy.sh for critical alerts and resolutions.
* **Usage**: `./monitor/monitor.sh` (all settings are read from `monitor.conf`) * Utilizes a lock file to prevent multiple instances from running concurrently.
* **Usage**: `./monitor/monitor.sh` (all monitoring parameters and thresholds are read from `monitor/monitor.conf`).
### 12. `monitor/monitor.conf` (Configuration for `monitor.sh`)
* **Purpose**: Configures the `monitor.sh` script, including company name, ntfy.sh settings, HANA connection details, monitoring thresholds (disk usage, log segments), and directories to monitor.