Add numChannels support
This commit is contained in:
23
rsc_clone.sh
23
rsc_clone.sh
@@ -5,7 +5,7 @@
|
||||
#
|
||||
# Perfoms a database clone operation
|
||||
#
|
||||
# usage: rsc_clone.sh -n <newname> -o <optionsfile> -h <targethost> [-s sourcehost] [-t "YYYY-MM-DD HH:MM:SS"] [-d] <srcdb>
|
||||
# usage: rsc_clone.sh -n <newname> -o <optionsfile> -h <targethost> [-s sourcehost] [-t "YYYY-MM-DD HH:MM:SS"] [-d] [-c numChannels] <srcdb>
|
||||
#
|
||||
# Options:
|
||||
# -n <newname> : db_name / SID of the new cloned database
|
||||
@@ -14,6 +14,7 @@
|
||||
# -s <sourcehost> : Source host where the original database is located (optional, use when there is ambiguity)
|
||||
# -t "YYYY-MM-DD HH:MM:SS" : Optional timestamp for the recovery point, defaults to latest PIT
|
||||
# -d : Dry-run mode - show mutation variables without executing the clone
|
||||
# -c <numChannels> : Optional - number of RMAN channels to configure for the clone
|
||||
# <srcdb> : Source database name or RSC dbid (if known, can be used directly)
|
||||
#
|
||||
# Example options file content:
|
||||
@@ -23,7 +24,7 @@
|
||||
# DB_CREATE_FILE_DEST=/u01/app/oracle/oradata/NEWNAME/
|
||||
# AUDIT_FILE_DEST='/u01/app/oracle/admin/NEWNAME/adump'
|
||||
|
||||
usage() { log_error "Usage: $0 -n <newname> -o <optionsfile> -h <targethost> [-s sourcehost] [-t \"YYYY-MM-DD HH:MM:SS\"] [-d] <srcdb>"; exit 1; }
|
||||
usage() { log_error "Usage: $0 -n <newname> -o <optionsfile> -h <targethost> [-s sourcehost] [-t \"YYYY-MM-DD HH:MM:SS\"] [-d] [-c numChannels] <srcdb>"; exit 1; }
|
||||
|
||||
MYDIR="$(dirname "$(realpath "$0")")"
|
||||
|
||||
@@ -39,7 +40,7 @@ done
|
||||
|
||||
source $MYDIR/rsc_ops.sh
|
||||
|
||||
while getopts "n:o:t:h:s:d:v" o; do
|
||||
while getopts "n:o:t:h:s:d:v:c:" o; do
|
||||
case "${o}" in
|
||||
n)
|
||||
newName=${OPTARG}
|
||||
@@ -62,6 +63,14 @@ while getopts "n:o:t:h:s:d:v" o; do
|
||||
v)
|
||||
VERBOSE=1
|
||||
;;
|
||||
c)
|
||||
numChannels=${OPTARG}
|
||||
# Validate numChannels is a positive integer
|
||||
if ! [[ "$numChannels" =~ ^[0-9]+$ && "$numChannels" -gt 0 ]]; then
|
||||
log_error "-c requires a positive integer value"
|
||||
exit_with_error
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
usage
|
||||
;;
|
||||
@@ -331,12 +340,20 @@ log_info "Target Host ID is $targetHostId"
|
||||
|
||||
cloningOptions=$(template_to_json $optionsFile)
|
||||
|
||||
# Optionally include numChannels in the config
|
||||
if [[ -n "${numChannels:-}" ]]; then
|
||||
numChannelsPart="\"numChannels\": $numChannels,"
|
||||
else
|
||||
numChannelsPart=""
|
||||
fi
|
||||
|
||||
variables="
|
||||
{
|
||||
\"input\": {
|
||||
\"request\": {
|
||||
\"id\": \"$dbid\",
|
||||
\"config\": {
|
||||
$numChannelsPart
|
||||
\"targetOracleHostOrRacId\": \"$targetHostId\",
|
||||
\"shouldRestoreFilesOnly\": false,
|
||||
\"recoveryPoint\": {
|
||||
|
||||
Reference in New Issue
Block a user