Scan listener relocate

#!/bin/bash


# ... (other code)


# Function to run post_patch_relocate.sh script

run_post_patch_relocate() {

    local OUTPUT_DIRECTORY="$1"


    # Run post_patch_relocate.sh with default 'n' option

    log_output "Post Patch Relocate" "sh post_patch_relocate.sh \"$OUTPUT_DIRECTORY\" <<EOF

n

EOF"

}


# ... (other code)


# Call the function with the OUTPUT_DIRECTORY variable

run_post_patch_relocate "$OUTPUT_DIRECTORY"


# ... (other code)

*************

#!/bin/bash


# Use the first argument as OUTPUT_DIRECTORY

OUTPUT_DIRECTORY="$1"


# Specify the file containing captured listener information

listener_info_file="$OUTPUT_DIRECTORY/listener_info.log"


# Specify the log file for relocation activities

relocate_log_file="$OUTPUT_DIRECTORY/relocation_output.log"  # Change to desired name


# Check if the listener info file exists

if [ ! -f "$listener_info_file" ]; then

    echo "Error: Missing listener info file. Please run pre_patch_listener_capture.sh first." > "$relocate_log_file"

    exit 1

fi


# Choose whether to execute relocations or perform a dry run

read -p "Do you want to execute relocations now (y/n)? " execute_relocations


# Loop through captured listener information and generate relocation commands

while read -r listener_name node_name; do

    # Replace with your actual logic for target node selection

    target_node="$node_name"


    # Example using current node (consider replacing)


    # Execute relocation command with logging or dry run based on the choice

    if [ "$execute_relocations" == "y" ]; then

        srvctl relocate scan listener scannumber "$listener_name" -node "$target_node" >> "$relocate_log_file" 2>&1

    else

        # Dry run message

        echo "Dry run relocation: srvctl relocate scan listener -scannumber \"$listener_name\" -node \"$target_node\"" >> "$relocate_log_file"

        # Display completion message and log

        echo "Processed $listener_name (target node: $target_node)." >> "$relocate_log_file"

    fi

done < "$listener_info_file"


# Display final message and log

echo "Relocation process completed (dry run: $execute_relocations)." >> "$relocate_log_file"


# Display contents of the relocate_log_file

cat "$relocate_log_file"

Comments

Popular posts from this blog

SQL Loader V3

Db Unix

Standby redo log add