Posts

Golden gate stop v1

#!/bin/bash read -p "Enter the log directory: " log_dir if [ -z "$log_dir" ]; then     echo "Log directory not provided. Exiting."     exit 1 fi mkdir -p "$log_dir" for value in $(locate setup_ogg | grep -E '/setup_ogg$'); do     source $value     cp $value $value_prepatch_bkp'$(date +"%Y%m%d%H%M%S")'     GG_HOME=$(dirname "$value")     GG_HOME_FILE=$(echo "$GG_HOME" | tr '/' '_')     log_file="$log_dir/gg_info_$GG_HOME_FILE.log"     cd "$GG_HOME"     echo "==cccccces === ============" > "$log_file"     echo "Executing 'info all' in $GG_HOME" >> "$log_file"     ./ggsci <<EOF >> "$log_file"     STOP ER * detail EOF done # Capture the log without the header export ORACLE_SID=$(ps -ef | grep '[a]sm_smon.*+ASM' | awk '{print $NF}' | cut -d '_' -f3) source oraenv <...

Oratab Entries validate and add

#!/bin/bash # Ask user for log directory read -p "Enter the log directory: " log_directory log_directory=$(realpath "$log_directory") # Ask user for file2 (sop.conf) name read -p "Enter the name of sop.conf file: " file2_name file2_path="$log_directory/$file2_name" # Phase 1: Generate db_unique_name_version.log for SID in $(ps -ef | grep '[o]ra_smon' | awk '{print $NF}' | cut -d '_' -f3); do     export ORACLE_SID=$SID     source oraenv <<< "$SID"     # Get DB unique name and version using the first query     DB_UNIQUE_NAME_INFO=$(sqlplus -s / as sysdba <<EOF set feedback off set heading off SELECT d.DB_UNIQUE_NAME || ':' || SUBSTR(i.VERSION, 1, 2) FROM v\$database d, v\$instance i; EOF     )     # Get instance name and version using the second query     INSTANCE_NAME_INFO=$(sqlplus -s / as sysdba <<EOF set feedback off set heading off SELECT i.INSTANCE_NAME || ':' || SUBSTR(i....

Data guard sync status

#!/bin/bash LOG_DIR="/path/to/log/files" # Loop through all Oracle SIDs for SID in $(ps -ef | grep '[o]ra_smon' | awk '{print $NF}' | cut -d '_' -f3); do     export ORACLE_SID=$SID     dgmgrl / <<EOF > $LOG_DIR/DR_log_config_$SID.txt     show configuration EOF     # Check if Data Guard configuration is not available     if grep -qE "ORA-16525" $LOG_DIR/DR_log_config_$SID.txt; then         echo "Data Guard not available for $SID" > $LOG_DIR/DR_log_all_databases.txt         continue     fi     DB_NAME=$(grep -E "Standby|Physical" $LOG_DIR/DR_log_config_$SID.txt | awk '{print $1}')     dgmgrl / <<EOF > $LOG_DIR/DR_log_status_$DB_NAME.txt     show database "$DB_NAME" EOF     TRANSPORT_LAG=$(cat $LOG_DIR/DR_log_status_$DB_NAME.txt | grep -E "Transport Lag" | awk '{print $4}')     APPLY_LAG=$(cat $LOG_DIR/DR_log_status_$DB_N...

Golden gate stop

 #!/bin/bash # Ask the user for the log directory read -p "Enter the log directory: " log_dir # Check if the log directory is provided if [ -z "$log_dir" ]; then   echo "Log directory not provided. Exiting."   exit 1 fi # Create log directory if it doesn't exist mkdir -p "$log_dir" # Get the list of running Goldengate instances instances=$(agctl status goldengate | grep "is running") # Loop through each line of the output while read -r line; do   # Extract information from each line   manager_name=$(echo "$line" | awk '{print $3}')   node=$(echo "$line" | awk '{print $NF}')   # Create a unique log file for each Oracle home   log_file="$log_dir/gg_stop_$manager_name.log"   # SSH to the respective node and stop Oracle GoldenGate Manager   ssh $node "agctl stop goldengate $manager_name" >> "$log_file" 2>&1 done <<< "$instances"

Acfs status and stop

#!/bin/bash # Prompt for log directory read -p "Enter the log directory path: " log_directory # Create the log directory if it doesn't exist mkdir -p "$log_directory" # Log file path log_file="$log_directory/acfs_script_log_$(date '+%Y%m%d_%H%M%S').log" # Redirect all output to the log file exec > "$log_file" 2>&1 echo "Script started at $(date)" # To stop ACFS replication for value in $(df -kh | grep gg | awk '{print $NF}' | sed -n '2p'); do     acfsutil repl info -c "$value"     acfsutil repl bg stop "$value"     if [ $? -eq 0 ]; then         echo "ACFS replication stopped for $value"     fi done # To stop the filesystem for value in $(df -kh | grep gg | awk '{print $1}' | sed -n '2p'); do     srvctl status filesystem -d "$value"     srvctl stop filesystem -d "$value"     if [ $? -ne 0 ]; then         echo "Issues stopping file...

Golden gate capture details

#1/bin/bash #Ask the user for the log directory read -p "Enter the log directory: " log_dir #Check if the log directory is provided if [ -z "$log_dir" ]; then echo "Log directory not provided. Exiting." exit 1 fi #Create log directory if it doesn't exist mkdir -p "$log_dir" #Loop through files named exactly setup_ogg and execute ggsci commands for value in $(locate setup_ogg | grep -E '/setup_ogg$'); do source $value # Extract Oracle GoldenGate home GG_HOME=$(dirname "$value") # Replace "/" with "" in GG_HOME to create a valid filename GG_HOME_FILE=$(echo "$GG_HOME" | tr '/' '_') #Create a unique log file for each Oracle home log_file="$log_dir/gg_info_$GG_HOME_FILE.log" #Change to Oracle GoldenGate home cd "$GG_HOME" # Print a separator in the log file for better readability echo "======________________==================" > "$log_file" ...

Golden gate v1

 # Loop through setup_ogg files and execute ggsci commands for value in $(locate setup_ogg); do   source $value   # Extract Oracle GoldenGate home   GG_HOME=$(dirname "$value")   # Change to Oracle GoldenGate home   cd $GG_HOME   # Get information about all processes (including ABENDED)   all_processes=$(./ggsci -S <<EOF   INFO ALL   EOF   )   # Check for ABENDED processes   abended_processes=$(echo "$all_processes" | grep ABENDED)   # Display information about all processes   echo "All Processes in $GG_HOME:"   echo "$all_processes"   # Check for and report ABENDED processes   if [ -z "$abended_processes" ]; then     echo "No ABENDED processes found for $GG_HOME."   else     echo "The following processes are ABENDED for $GG_HOME:"     echo "$abended_processes"     echo "Manual Intervention is needed for the process"   fi   # Stopping run...