#!/bin/bash
#currently used on tecent test
EXPORT_LIST=({{schema_list}})
#hdbsql -i 00 -u SYSTEM -p Wang_2017 -n localhost:30015
for schema in ${EXPORT_LIST[@]}
do
        echo "exporting $schema"
        hdbsql -i {{hana_instid}} -u $schema -p EPM_user_2017 "EXPORT $schema.\"*\" AS BINARY INTO '{{backup_dir}}/$schema' WITH REPLACE"
        if [ $? != "0" ]; then
      echo "exporting fails"
    else
      echo "exporting success"
    fi
done

# echo "exporting PINGAN"
# hdbsql -i 00 -u PINGAN -p EPM_user_2022 "EXPORT PINGAN.\"*\" AS BINARY INTO '/hana/mounts/SCHEMA_BACKUP/PINGAN' WITH REPLACE"

echo "export end"