Pages

Wednesday, January 22, 2020

Oracle Golden Gate Error: OGG-01221 Connect failed to 111.222.333.444:7819 error 111:Connection refused.

===================
General
===================
After starting Golden Gate processes, Extract processes having this error:
Error in Golden gate after starting up golden gate extract processes

===================
Solution A
===================
application user is running the GG processes and lacks the permission to update ggserr.log file.

On both server A and server B:
ls -l ggserr.log
-rw-r-----.  1 root   root  8305860 Aug 31 20:30 ggserr.log

as root
chmod 666 ggserr.log

restart the GG processes

===================
Solution B
===================
Remove the line in red, and restart GG processes.
This should be done on site A and on site B.

# Do not remove the following line, or various programs
# that require network functionality will fail.
::1               localhost6.localdomain6 localhost6
127.0.0.1         localhost.localdomain   localhost
111.222.333.445   XXXDB00001              XXX7DB00001.mydomain.com
111.222.333.445   XXXDB00002              XXXDB00002.mydomain.com
111.222.333.447   xxx-2-ora-01            xxx-2-ora-01.mydomain.com

===================
Appendix
===================
Rollover the ggserr.log keeping existing permissions:
cp -pnv ggserr.log ggserr.log_20200831

-p : preserve permissions
-v : verbose, print informative messages
-n : no file overwrite

cat /dev/null > ggserr.log

===================
Reference
===================


::1 localhost6.localdomain6 localhost6
It is IPV6 address for localhost
(IPV4 would be simple 127.0.0.1 localhost)


Thursday, January 9, 2020

Code Example: Simple bash with sql inside

#!/bin/bash

#---------------------------------
#functions
#---------------------------------
report_error(){
  db_user=$1
  echo ==========================================
  echo Error!!!
  echo User $db_user Connection Check........Failed  
  echo Connection Error for User $db_user
  echo ERROR: ORA-01017: invalid username/password. logon denied
  echo Exiting script!
  echo ==========================================
  exit 1
}

report_success(){
  db_user=$1
  echo User $db_user Connection Check........Passed 
}


#---------------------------------
#main
#---------------------------------

echo ==========================================
echo Mark End of Upgrade Start
echo ==========================================


export OUTPUT_FILE=./chk_connections.log

VIPUSER=`grep vipuser ../set_vipuser.sql |awk -F= '{print $2}'`
VIPPASS=`grep vippass ../set_vipuser.sql |awk -F= '{print $2}'`
CONNECTSTR=`grep "connectstr=" ../set_vipuser.sql |awk -F= '{print $2}'`

rm -f $OUTPUT_FILE
touch $OUTPUT_FILE

echo Check Connection for:  ${VIPUSER}/${VIPPASS}@${CONNECTSTR} >> $OUTPUT_FILE
sqlplus -s ${VIPUSER}/${VIPPASS}@${CONNECTSTR} >> $OUTPUT_FILE << EOD
set serveroutput on
set heading off linesize 130 pagesize 1000  feedback off
SELECT 'Connection is OK for '||USER FROM DUAL;
EOD


#----------------------------
# Analyze Connection Results
#----------------------------
connection_ok=`grep "Connection is OK for" $OUTPUT_FILE | grep -iw ${VIPUSER} | wc -l`
if [[ $connection_ok != 2 ]];then
  report_error ${VIPUSER}
else
  report_success ${VIPUSER}
fi

echo "Mark GG_REF_TABLES_LIST for Update Completion"
sqlplus -s ${VIPUSER}/${VIPPASS}@${CONNECTSTR} >> $OUTPUT_FILE << EOD
set serveroutput on
set heading off linesize 130 pagesize 1000  feedback off
UPDATE GG_REF_TABLES_LIST SET replicated_data_ind='Y' WHERE replicated_data_ind IS NULL OR replicated_data_ind='N';
commit;
EOD


echo ==========================================
echo Mark End of Upgrade Finish
echo ==========================================

exit 0