Files
dm-oracle-clone/fromDmOct2025/v930p2/oracle_list_mounts.sh

38 lines
1008 B
Bash

#!/bin/bash
#
# Example API call script for Die Mobiliar
# v0.2 - James Pattinson - August 2021
#
# Lists any Oracle Live Mounts present
#
# usage: oracle_list_db.sh [dbname]
# if no hostname specified, will list them all
MYDIR="$(dirname "$(realpath "$0")")"
# source $MYDIR/rbk_api.conf
source $MYDIR/oracle_funcs.sh
if [ $# -gt 1 ]; then
echo "Usage: $0 [dbname]"
exit 1
fi
dbname=$1
echo Connecting to Rubrik with IP $RUBRIK_IP
# API call to list Mounted Oracle DBs
ENDPOINT="https://$RUBRIK_IP/api/internal/oracle/db/mount?source_database_name=$dbname"
rest_api_get
echo Live Mounts
echo
echo -e "Source DB\t\tTarget\t\t\t\tFiles Only\tStatus\t\tMount ID\t\t\t\tCreation Date\t\t\tOwner"
echo -e "---------\t\t------\t\t\t\t----------\t------\t\t--------\t\t\t\t-------------\t\t\t-------------------"
cat /tmp/rbkresponse.$$ | jq -r '.data[]' | jq -r ' "\(.sourceDatabaseName)\t\t\(.targetHostname)\t\(.isFilesOnlyMount)\t\t\(.status)\t\(.id)\t\(.creationDate)\t\(.ownerName)"'
cleanup