Adding original DM files
This commit is contained in:
81
fromDmOct2025/v930p2/oracle_get_config.sh
Normal file
81
fromDmOct2025/v930p2/oracle_get_config.sh
Normal file
@@ -0,0 +1,81 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# Example API call script for Die Mobiliar
|
||||
# v0.2 - James Pattinson - August 2021
|
||||
# v0.3 - U701053 - mars 2024
|
||||
#
|
||||
# Shows the current settings for an Oracle DB
|
||||
#
|
||||
# usage: oracle_get_config.sh <HOSTNAME> <CDBNAME>
|
||||
|
||||
MYDIR="$(dirname "$(realpath "$0")")"
|
||||
# source $MYDIR/rbk_api.conf
|
||||
source $MYDIR/oracle_funcs.sh
|
||||
|
||||
usage() { echo "Usage: $0 [-h <dbhost>] [-g] <SID>" 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
|
||||
|
||||
if [ $dg -eq 1 ] && [ ! -z ${RBK_HOST+x} ]; then
|
||||
echo "FATAL: Can't specify a host when targing a DG Group"
|
||||
exit_with_error
|
||||
fi
|
||||
|
||||
echo Connecting to Rubrik with IP $RUBRIK_IP
|
||||
|
||||
find_database
|
||||
|
||||
# API call to list Oracle DB detail
|
||||
ENDPOINT="https://$RUBRIK_IP/api/v1/oracle/db/$db_id"
|
||||
rest_api_get
|
||||
|
||||
#echo "file db detail: /tmp/rbkresponse.$$"
|
||||
# Reads the parts we need
|
||||
|
||||
sla_name=$(cat /tmp/rbkresponse.$$ | jq -r '.effectiveSlaDomainName')
|
||||
read channels sectionSize log_freq log_retn host_retn rbk_lcluster < <(echo $(cat /tmp/rbkresponse.$$ | jq -r '.numChannels, .sectionSizeInGb, .logBackupFrequencyInMinutes, .logRetentionHours, .hostLogRetentionHours, .isDbLocalToTheCluster'))
|
||||
|
||||
# exit # only db detail
|
||||
|
||||
ENDPOINT=https://$RUBRIK_IP/api/v2/sla_domain/$sla_id
|
||||
rest_api_get
|
||||
|
||||
read dailyretn monthlyretn starthr startmin < <(echo $(cat /tmp/rbkresponse.$$ | jq -r '.frequencies.daily.retention, .frequencies.monthly.retention, .allowedBackupWindows[].startTimeAttributes.hour, .allowedBackupWindows[].startTimeAttributes.minutes'))
|
||||
|
||||
#echo "file sla: /tmp/rbkresponse.$$"
|
||||
|
||||
echo Protection Details for $RBK_SID on $RBK_HOST
|
||||
echo DB Local of the $RUBRIK_IP: $rbk_lcluster
|
||||
echo SLA Name: $sla_name
|
||||
|
||||
|
||||
echo SLA Daily Retention: $dailyretn days
|
||||
echo SLA Monthly Retention: $monthlyretn months
|
||||
printf "SLA Backup Window: %02d:%02d\n" $starthr $startmin
|
||||
|
||||
|
||||
echo Log Backup Frequency: $log_freq minutes
|
||||
echo Log Backup Retention: $log_retn hours
|
||||
echo Keep logs on host: $host_retn hours
|
||||
echo Channels: $channels
|
||||
echo Section size: $sectionSize
|
||||
|
||||
cleanup
|
||||
Reference in New Issue
Block a user