update hanatool
This commit is contained in:
18
hanatool.sh
18
hanatool.sh
@@ -3,7 +3,7 @@
|
|||||||
# ==============================================================================
|
# ==============================================================================
|
||||||
# SAP HANA Schema Management Tool (hanatool.sh)
|
# SAP HANA Schema Management Tool (hanatool.sh)
|
||||||
#
|
#
|
||||||
# A command-line utility to quickly export, restore, or import-and-rename
|
# A command-line utility to quickly export, restore, or restore-and-rename
|
||||||
# a SAP HANA schema.
|
# a SAP HANA schema.
|
||||||
# ==============================================================================
|
# ==============================================================================
|
||||||
|
|
||||||
@@ -17,17 +17,17 @@ usage() {
|
|||||||
echo "SAP HANA Schema Management Tool"
|
echo "SAP HANA Schema Management Tool"
|
||||||
echo ""
|
echo ""
|
||||||
echo "Usage: $0 [USER_KEY] [ACTION] [SCHEMA_NAME] [PATH] [OPTIONS]"
|
echo "Usage: $0 [USER_KEY] [ACTION] [SCHEMA_NAME] [PATH] [OPTIONS]"
|
||||||
echo " $0 [USER_KEY] import-rename [SCHEMA_NAME] [NEW_SCHEMA_NAME] [PATH] [OPTIONS]"
|
echo " $0 [USER_KEY] restore-rename [SCHEMA_NAME] [NEW_SCHEMA_NAME] [PATH] [OPTIONS]"
|
||||||
echo ""
|
echo ""
|
||||||
echo "Actions:"
|
echo "Actions:"
|
||||||
echo " export Export a schema to a specified path."
|
echo " export Export a schema to a specified path."
|
||||||
echo " restore Restore a schema from a specified path."
|
echo " restore Restore a schema from a specified path."
|
||||||
echo " import-rename Restore a schema from a path to a new schema name."
|
echo " restore-rename Restore a schema from a path to a new schema name."
|
||||||
echo ""
|
echo ""
|
||||||
echo "Arguments:"
|
echo "Arguments:"
|
||||||
echo " USER_KEY The user key from hdbuserstore for DB connection."
|
echo " USER_KEY The user key from hdbuserstore for DB connection."
|
||||||
echo " SCHEMA_NAME The name of the source schema."
|
echo " SCHEMA_NAME The name of the source schema."
|
||||||
echo " NEW_SCHEMA_NAME (Required for import-rename only) The target schema name."
|
echo " NEW_SCHEMA_NAME (Required for restore-rename only) The target schema name."
|
||||||
echo " PATH The file system path for the export/import data."
|
echo " PATH The file system path for the export/import data."
|
||||||
echo ""
|
echo ""
|
||||||
echo "Options:"
|
echo "Options:"
|
||||||
@@ -44,7 +44,7 @@ usage() {
|
|||||||
echo " $0 MYKEY restore MYSCHEMA /hana/backups/MYSCHEMA_20240101.tar.gz -c"
|
echo " $0 MYKEY restore MYSCHEMA /hana/backups/MYSCHEMA_20240101.tar.gz -c"
|
||||||
echo ""
|
echo ""
|
||||||
echo " # Import MYSCHEMA as MYSCHEMA_TEST using a custom hdbsql path"
|
echo " # Import MYSCHEMA as MYSCHEMA_TEST using a custom hdbsql path"
|
||||||
echo " $0 MYKEY import-rename MYSCHEMA MYSCHEMA_TEST /hana/backups/temp_export --hdbsql /sap/custom/hdbsql"
|
echo " $0 MYKEY restore-rename MYSCHEMA MYSCHEMA_TEST /hana/backups/temp_export --hdbsql /sap/custom/hdbsql"
|
||||||
}
|
}
|
||||||
|
|
||||||
# --- Argument Parsing ---
|
# --- Argument Parsing ---
|
||||||
@@ -153,7 +153,7 @@ case "$ACTION" in
|
|||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
|
|
||||||
restore|import-rename)
|
restore|restore-rename)
|
||||||
if [[ "$ACTION" == "restore" ]]; then
|
if [[ "$ACTION" == "restore" ]]; then
|
||||||
SOURCE_PATH="$4"
|
SOURCE_PATH="$4"
|
||||||
NEW_SCHEMA_NAME=""
|
NEW_SCHEMA_NAME=""
|
||||||
@@ -162,11 +162,11 @@ case "$ACTION" in
|
|||||||
usage
|
usage
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
else # import-rename
|
else # restore-rename
|
||||||
NEW_SCHEMA_NAME="$4"
|
NEW_SCHEMA_NAME="$4"
|
||||||
SOURCE_PATH="$5"
|
SOURCE_PATH="$5"
|
||||||
if [[ -z "$USER_KEY" || -z "$SCHEMA_NAME" || -z "$NEW_SCHEMA_NAME" || -z "$SOURCE_PATH" ]]; then
|
if [[ -z "$USER_KEY" || -z "$SCHEMA_NAME" || -z "$NEW_SCHEMA_NAME" || -z "$SOURCE_PATH" ]]; then
|
||||||
echo "❌ Error: Missing arguments for 'import-rename' action."
|
echo "❌ Error: Missing arguments for 'restore-rename' action."
|
||||||
usage
|
usage
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
@@ -205,7 +205,7 @@ case "$ACTION" in
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
QUERY_RENAME_PART=""
|
QUERY_RENAME_PART=""
|
||||||
if [[ "$ACTION" == "import-rename" ]]; then
|
if [[ "$ACTION" == "restore-rename" ]]; then
|
||||||
QUERY_RENAME_PART="WITH RENAME SCHEMA \"${SCHEMA_NAME}\" TO \"${NEW_SCHEMA_NAME}\""
|
QUERY_RENAME_PART="WITH RENAME SCHEMA \"${SCHEMA_NAME}\" TO \"${NEW_SCHEMA_NAME}\""
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|||||||
@@ -11,6 +11,6 @@ SCRIPT_PACKAGES["Aurora Suite"]="1.1.0|https://git.technopunk.space/tomi/Scripts
|
|||||||
SCRIPT_PACKAGES["Backup Suite"]="1.0.0|https://git.technopunk.space/tomi/Scripts/raw/branch/main/backup/backup.sh https://git.technopunk.space/tomi/Scripts/raw/branch/main/backup/backup.conf"
|
SCRIPT_PACKAGES["Backup Suite"]="1.0.0|https://git.technopunk.space/tomi/Scripts/raw/branch/main/backup/backup.sh https://git.technopunk.space/tomi/Scripts/raw/branch/main/backup/backup.conf"
|
||||||
SCRIPT_PACKAGES["Key Manager"]="1.2.1|https://git.technopunk.space/tomi/Scripts/raw/branch/main/hdb_keymanager.sh"
|
SCRIPT_PACKAGES["Key Manager"]="1.2.1|https://git.technopunk.space/tomi/Scripts/raw/branch/main/hdb_keymanager.sh"
|
||||||
SCRIPT_PACKAGES["File Cleaner"]="1.1.0|https://git.technopunk.space/tomi/Scripts/raw/branch/main/clean.sh"
|
SCRIPT_PACKAGES["File Cleaner"]="1.1.0|https://git.technopunk.space/tomi/Scripts/raw/branch/main/clean.sh"
|
||||||
SCRIPT_PACKAGES["HANA Tool"]="1.0.0|https://git.technopunk.space/tomi/Scripts/raw/branch/main/hanatool.sh"
|
SCRIPT_PACKAGES["HANA Tool"]="1.0.4|https://git.technopunk.space/tomi/Scripts/raw/branch/main/hanatool.sh"
|
||||||
# Example: Add a new script with its version.
|
# Example: Add a new script with its version.
|
||||||
# SCRIPT_PACKAGES["My Other Script"]="1.0.0|https://path/to/my-other-script.sh"
|
# SCRIPT_PACKAGES["My Other Script"]="1.0.0|https://path/to/my-other-script.sh"
|
||||||
|
|||||||
Reference in New Issue
Block a user