#!/bin/bash
TABLES=(
COUNTRIES
REGIONS
LOCATIONS
DEPARTMENTS
JOBS
EMPLOYEES
JOB_HISTORY
)
ENCRYPTION_MODES=(
ALL
DATA_ONLY
ENCRYPTED_COLUMNS_ONLY
METADATA_ONLY
NONE
)
COMPRESSION_MODES=(
ALL
DATA_ONLY
METADATA_ONLY
NONE
)
ENCRYPTION_PASSWORDS=(
testpass
testerpass2
)
function lc(){
echo "${1,,}"
}
function build_command() {
table="$1"
encryption="$2"
compression="$3"
pass="$4"
name="${table}comp_${compression}"
command="$ORACLE_HOME/bin/expdp system/qwerty DIRECTORY=EXPIMP TABLES=HR.${table} COMPRESSION=${compression}"
if [ "$encryption" != "NONE" ]; then
command="${command} ENCRYPTION=${encryption} ENCRYPTION_MODE=PASSWORD ENCRYPTION_PASSWORD=${pass}"
name="${name}_encmode_${encryption}_${pass}.dmp"
else
command="${command} ENCRYPTION=${encryption}"
name="${name}_encmode_${encryption}.dmp"
fi
name=$(lc "${name}")
command="$command DUMPFILE=${name}"
echo "$command"
}
for table in "${TABLES[@]}"; do
for encryption in "${ENCRYPTION_MODES[@]}"; do
for compression in "${COMPRESSION_MODES[@]}"; do
if [ "$encryption" != "NONE" ]; then
for pass in "${ENCRYPTION_PASSWORDS[@]}"; do
bash -c "$(build_command "$table" "$encryption" "$compression" "$pass")"
done
else
bash -c "$(build_command "$table" "$encryption" "$compression" "$pass")"
fi
done
done
done