61 lines
1.2 KiB
Bash
61 lines
1.2 KiB
Bash
#!/bin/bash
|
|
#
|
|
# Example API call script for Die Mobiliar
|
|
# v0.2 - James Pattinson - August 2021
|
|
#
|
|
# Set the backup settings for a given Oracle DB
|
|
#
|
|
# usage: oracle_set_config.sh <HOSTNAME> <CDBNAME> <log freq (mins)> <log retn (hours)> <host retn (hours)> <channels>
|
|
#
|
|
# Log backup of 0 disables log backup
|
|
# host retention of -1 disables host log retention
|
|
|
|
MYDIR="$(dirname "$(realpath "$0")")"
|
|
# source $MYDIR/rbk_api.conf
|
|
source $MYDIR/oracle_funcs.sh
|
|
|
|
usage() { echo "Usage: $0 [-h <dbhost>] <SID> <channels>" 1>&2; exit 1; }
|
|
|
|
dg=0
|
|
|
|
while getopts "h:" o; do
|
|
case "${o}" in
|
|
h)
|
|
RBK_HOST=${OPTARG}
|
|
;;
|
|
*)
|
|
usage
|
|
;;
|
|
esac
|
|
done
|
|
shift $((OPTIND-1))
|
|
|
|
RBK_SID=$1
|
|
|
|
if [ -z "${RBK_SID}" ]; then
|
|
usage
|
|
fi
|
|
|
|
channels=$2
|
|
|
|
echo Connecting to Rubrik with IP $RUBRIK_IP
|
|
|
|
# API call to get DB details
|
|
find_database
|
|
|
|
# API call to set configuration
|
|
|
|
if [ "$dg_type" == "DataGuardMember" ]; then
|
|
ENDPOINT="https://$RUBRIK_IP/api/v1/oracle/data_guard_group/$db_id"
|
|
else
|
|
ENDPOINT="https://$RUBRIK_IP/api/v1/oracle/db/$db_id"
|
|
fi
|
|
PAYLOAD={\"numChannels\":$channels}
|
|
|
|
rest_api_patch
|
|
|
|
echo New configuration for $RBK_SID on $RBK_HOST is set
|
|
|
|
cleanup
|
|
|