Adding original DM files
This commit is contained in:
63
fromDmOct2025/v930p2/oracle_set_config.sh
Normal file
63
fromDmOct2025/v930p2/oracle_set_config.sh
Normal file
@@ -0,0 +1,63 @@
|
||||
#!/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> <log freq (mins)> <log retn (hours)> <host retn (hours)> <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
|
||||
|
||||
# log_freq=$2
|
||||
#log_retn=$2
|
||||
#host_retn=$3
|
||||
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={\"logBackupFrequencyInMinutes\":$log_freq,\"logRetentionHours\":$log_retn,\"hostLogRetentionHours\":$host_retn,\"numChannels\":$channels}
|
||||
PAYLOAD={\"numChannels\":$channels}
|
||||
|
||||
rest_api_patch
|
||||
|
||||
echo New configuration for $RBK_SID on $RBK_HOST is set
|
||||
|
||||
cleanup
|
||||
Reference in New Issue
Block a user