Allow numChannels to be set

This commit is contained in:
2025-10-07 05:20:19 -04:00
parent 78de12e3f7
commit 3b7641ea2c

View File

@@ -1,7 +1,7 @@
#!/bin/bash
#
# Perform a Clone of an Oracle DB
# v1.0 - James Pattinson - October 2025
# v1.2 - James Pattinson - October 2025
#
# usage: oracle_clone.sh [options] <srcSID> <tgtHOSTNAME>
#
@@ -12,6 +12,7 @@
# -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)
# -c <channels> Number of RMAN channels to use
# -d Dry run mode - show API payload without executing
#
# Time is passed to 'date' on THIS machine, will use local timezone
@@ -28,6 +29,7 @@ usage() { echo "Usage: $0 [options] <srcSID> <tgtHOSTNAME>" 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 " -c <channels> Number of RMAN channels to use" 1>&2
echo " -d Dry run mode" 1>&2
exit 1; }
@@ -35,7 +37,8 @@ declare -a config_pairs
declare -a pdb_list
dryrun=false
while getopts "h:dt:n:p:a:b:" o; do
num_channels=""
while getopts "h:dt:n:p:a:b:c:" o; do
case "${o}" in
h)
RBK_HOST=${OPTARG}
@@ -55,6 +58,9 @@ while getopts "h:dt:n:p:a:b:" o; do
b)
IFS=',' read -ra pdb_list <<< "${OPTARG}"
;;
c)
num_channels=${OPTARG}
;;
d)
dryrun=true
;;
@@ -129,6 +135,10 @@ if [ -n "$custompfile" ]; then
PAYLOAD="$PAYLOAD,\"customPfilePath\":\"$custompfile\""
fi
if [ -n "$num_channels" ]; then
PAYLOAD="$PAYLOAD,\"numChannels\":$num_channels"
fi
# Add pdbsToClone array if -b specified
if [ ${#pdb_list[@]} -gt 0 ]; then
pdbs_json="\"PDB\$SEED\""