Add README and PDB support

This commit is contained in:
2025-10-06 08:43:54 -04:00
parent bc30f7b788
commit 78de12e3f7
2 changed files with 58 additions and 7 deletions

View File

@@ -11,6 +11,7 @@
# -n <newsid> New database SID for the clone
# -p <pfilepath> Custom pfile for the clone
# -a <key,value> Advanced Cloning Options (can be used multiple times)
# -b <pdb1,pdb2> Comma-separated list of PDBs to clone (include only these PDBs. PDB$SEED is always included)
# -d Dry run mode - show API payload without executing
#
# Time is passed to 'date' on THIS machine, will use local timezone
@@ -26,33 +27,38 @@ usage() { echo "Usage: $0 [options] <srcSID> <tgtHOSTNAME>" 1>&2
echo " -n <newsid> New database SID for clone" 1>&2
echo " -p <pfilepath> Custom pfile for the clone" 1>&2
echo " -a <key,value> Advanced Cloning Options (can be used multiple times)" 1>&2
echo " -b <pdb1,pdb2> Comma-separated list of PDBs to clone (include only these PDBs)" 1>&2
echo " -d Dry run mode" 1>&2
exit 1; }
declare -a config_pairs
declare -a pdb_list
dryrun=false
while getopts "h:dt:n:p:a:" o; do
while getopts "h:dt:n:p:a:b:" o; do
case "${o}" in
h)
RBK_HOST=${OPTARG}
;;
t)
datestring=${OPTARG}
;;
;;
n)
newsid=${OPTARG}
;;
;;
p)
custompfile=${OPTARG}
;;
;;
a)
config_pairs+=("${OPTARG}")
;;
;;
b)
IFS=',' read -ra pdb_list <<< "${OPTARG}"
;;
d)
dryrun=true
;;
*)
;;
*)
usage
;;
esac
@@ -123,6 +129,16 @@ if [ -n "$custompfile" ]; then
PAYLOAD="$PAYLOAD,\"customPfilePath\":\"$custompfile\""
fi
# Add pdbsToClone array if -b specified
if [ ${#pdb_list[@]} -gt 0 ]; then
pdbs_json="\"PDB\$SEED\""
for pdb in "${pdb_list[@]}"; do
pdbs_json="$pdbs_json,\"$pdb\""
done
echo "PDB: Including PDBs in clone: PDB\$SEED ${pdb_list[*]}"
PAYLOAD="$PAYLOAD,\"pdbsToClone\":[${pdbs_json}]"
fi
PAYLOAD="$PAYLOAD,\"advancedRecoveryConfigMap\":{$configmap}}"
ENDPOINT="https://$RUBRIK_IP/api/internal/oracle/db/$db_id/export"