Skip to content

SAP HANA CLI Command Structure Reference

This document provides visual diagrams and quick reference guides for commonly used hana-cli commands. Each command diagram shows the command structure, key parameters, and typical usage patterns.

NOTE

This page is a high-level reference. For authoritative command syntax and full option details, use hana-cli [command] --help and the command pages under /02-commands/.

Table of Contents


Connection Commands

connect

Purpose: Establish and save connection to SAP HANA database

Connection Quick Examples:

bash
# Interactive connection (prompts for details)
hana-cli connect

# Direct connection with credentials
hana-cli connect -n localhost:30013 -u DBUSER -p mypassword -s

# Using HDB Userstore key
hana-cli connect --uk MYHDBKEY -s

Aliases: c, login


copy2DefaultEnv

Purpose: Convert .env file to default-env.json format


Aliases: copyDefaultEnv, copyDefault-Env, copy2defaultenv, copydefaultenv, copydefault-env


Data Operations

export

Purpose: Export data from tables/views to file

Export Quick Examples:

bash
# Export table to CSV (default)
hana-cli export -t CUSTOMERS -s SALES

# Export to JSON with limit
hana-cli export -t PRODUCTS -f json -l 500 -o products.json

# Dry-run preview without saving
hana-cli export -t ORDERS -f csv --preview

# Export from specific profile
hana-cli export -t TABLE -p production

Aliases: exp, downloadData, downloaddata


import

Purpose: Import data from file into table

Import Quick Examples:

bash
# Import CSV into a target table
hana-cli import -n users.csv -t USERS

# Import Excel file from worksheet 1
hana-cli import -n orders.xlsx -t ORDERS --worksheet 1

# Import with dry-run preview
hana-cli import -n data.csv -t MYTABLE --preview

# Import with explicit match mode
hana-cli import -n large.csv -t TABLE -m name

Aliases: imp, uploadData, uploaddata


tableCopy

Purpose: Copy table structure or data between tables/schemas

Table Copy Quick Examples:

bash
# Copy structure only (no data)
hana-cli tableCopy --sourceTable ORDERS --targetTable ORDERS_ARCHIVE -so

# Copy data only to existing table
hana-cli tableCopy --sourceTable TABLE1 --targetTable TABLE2 -do

# Copy between schemas
hana-cli tableCopy -st PROD.CUSTOMERS -tt DEV.CUSTOMERS

# Copy with preview
hana-cli tableCopy --sourceTable ORDERS --targetTable ORDERS_BKP --preview

Aliases: tablecopy, copyTable, copytable


dataSync

Purpose: Synchronize data between source and target


Database Inspection

tables

Purpose: List tables in current or specified schema

Quick Examples:

bash
# List all tables in current schema
hana-cli tables

# List tables in specific schema
hana-cli tables -s PRODUCTION

# List with limit and JSON output
hana-cli tables -l 50 -o json

# Search for specific pattern
hana-cli tables CUST*

Aliases: t, tbl, listTables


inspectTable

Purpose: Detailed inspection of table structure and metadata

Quick Examples:

bash
# Inspect table (default output)
hana-cli inspectTable -s MYSCHEMA -t CUSTOMERS

# Get as CDS entity
hana-cli inspectTable MYSCHEMA CUSTOMERS -o cds

# Get as OData/EDMX
hana-cli inspectTable MYSCHEMA CUSTOMERS -o edmx

# Get as JSON schema
hana-cli inspectTable -t ORDERS -o json

Aliases: it, inspectTable, table


views

Purpose: List views in schema

Aliases: v, listViews


procedures

Purpose: List stored procedures in schema

Aliases: p, listProcs, ListProc, listprocs, Listproc, listProcedures, listprocedures, sp


HDI Container Management

containers

Purpose: List HDI containers

Quick Examples:

bash
# List all containers
hana-cli containers

# List specific container group
hana-cli containers -g MYGROUP

# Search with pattern
hana-cli containers -c "DEV*"

Aliases: cont, listContainers


createContainer

Purpose: Create new HDI container

Quick Examples:

bash
# Create container in default group
hana-cli createContainer MYCONTAINER

# Create with specific group
hana-cli createContainer MYCONTAINER -g MYGROUP

# Create with encryption enabled
hana-cli createContainer HC01 -g APPS -e

Aliases: cc, cCont


Backup & Recovery

backup

Purpose: Create backups of tables, schemas, or databases

Quick Examples:

bash
# Backup a table
hana-cli backup --target CUSTOMERS -s SALES

# Backup entire schema
hana-cli backup PRODUCTION --type schema

# Backup with compression
hana-cli backup --target TABLE -f csv -c true --dest ./backups

# Backup without data
hana-cli backup MYSCHEMA --type schema --withData false

Aliases: bkp, createBackup


restore

Purpose: Restore from backup

Quick Examples:

bash
# Restore from backup file
hana-cli restore --backupFile customers.csv --target CUSTOMERS

# Restore with overwrite
hana-cli restore --backupFile ./backups/data.csv --target TABLE -ow

# Restore to different schema
hana-cli restore --backupFile backup.csv --target TABLE -s ALTERNATIVE_SCHEMA

# Dry-run restore
hana-cli restore --backupFile data.csv -t TABLE --preview

Aliases: rst, restoreBackup


Performance Analysis

queryPlan

Purpose: Visualize SQL query execution plan

Quick Examples:

bash
# Analyze query execution plan
hana-cli queryPlan -q "SELECT * FROM CUSTOMERS WHERE ID = 1"

# Get JSON output
hana-cli queryPlan --sql "SELECT * FROM ORDERS"

Aliases: None


alerts

Purpose: View database alerts and warnings

Quick Examples:

bash
# List all alerts
hana-cli alerts

# Show only high severity
hana-cli alerts -s CRITICAL

# Limit to 20 results
hana-cli alerts -l 20

Aliases: a, alert


tableHotspots

Purpose: Identify frequently accessed tables


Mass Operations

massConvert

Purpose: Bulk convert tables to different formats

Quick Examples:

bash
# Convert tables to CDS format (preview)
hana-cli massConvert -s MYSCHEMA -f cds --preview

# Convert to HDBTable format
hana-cli massConvert -s PRODUCTION -f hdbTable -d ./artifacts

# Convert specific tables by pattern
hana-cli massConvert -o "CUST*" -f cds

Aliases: mc, massconvert, massConv, massconv


massGrant

Purpose: Grant permissions on multiple objects

Quick Examples:

bash
# Grant SELECT to user (preview)
hana-cli massGrant -s MYSCHEMA -o CUST* -g DEVELOPER -p SELECT --preview

# Grant with grant option enabled
hana-cli massGrant -s SCHEMA -g ADMIN -p "SELECT,INSERT" --withGrantOption

# Apply grants with logging
hana-cli massGrant -o "TABLE*" -g USERS -p SELECT --log

Aliases: mg, massgrant, massGrn, massgrn


massDelete

Purpose: Bulk-delete database objects that match filters and patterns

Quick Examples:

bash
# Preview delete for matching objects
hana-cli massDelete -o "ARCHIVE_*" --preview

# Force delete including system objects
hana-cli massDelete -s STAGING -o TEMP* -f -i

Aliases: md, massdelete, massDel, massdel


Cloud Integration

btp

Purpose: Set BTP target for commands

Quick Examples:

bash
# Set subaccount target
hana-cli btp --sa myaccount

# Set directory + subaccount using positional args
hana-cli btp mydirectory myaccount

# Show current BTP context
hana-cli btpInfo

Aliases: btpTarget, btptarget, btp


activateHDI

Purpose: Activate HDI service in tenant

Aliases: ahdi, ah


Command Pattern Reference

List Commands Pattern

Many list commands follow this general pattern:

Examples include: tables, views, procedures, functions, indexes, schemas, users, roles, sequences, synonyms, partitions, columnStats, spatialData, ftIndexes, graphWorkspaces, tableHotspots, tableGroups, calcViewAnalyzer


Data Operation Pattern

Many data operations follow this general pattern:

Examples include: export, import, dataSync, compareData, compareSchema, tableCopy, dataProfile, dataDiff, duplicateDetection


Parameter Inheritance Hierarchy


Quick Command Selection Guide


Parameter Quick Reference

Common Parameters Used Across Commands

ParameterAliasTypeDefaultDescription
--admin-abooleanfalseUse admin credentials
--connstringConnection file override
--schema-sstring**CURRENT_SCHEMA**Target schema
--profile-pstringDatabase profile
--limit-lnumber200 (lists) / 1000 (data)Limit results
--output-ostringtblOutput format
--dryRun-dr, --previewbooleanfalsePreview without executing
--format-fstringcsvOutput/input format
--batchSize-b (sometimes --batch)number1000Records per batch
--timeout-tonumber3600Operation timeout (sec)
--debug-dbooleanfalseDebug output
--quiet--disableVerbosebooleanfalseMinimal output (command-dependent)

Getting More Information

For detailed documentation on any command, use:

bash
# Show help for specific command
hana-cli [command] --help
hana-cli [command] -h

# Show overall help
hana-cli --help
hana-cli help

# See all available commands
hana-cli

See Also