Showing posts with label Unix. Show all posts
Showing posts with label Unix. Show all posts

Wednesday, April 28, 2010

Kill signal to dump core file

To kill a process and make it dump a core file, use the "6" signal
kill -6 PID

How to enable full core on AIX

1- To obtain full core files on AIX, set the following ulimit options:
ulimit -c unlimited turn on corefiles with unlimited size
ulimit -n unlimited allows an unlimited number of open file
descriptors
ulimit -d unlimited sets the user data limit to unlimited
ulimit -f unlimited sets the file limit to unlimited

You can display the current ulimit settings with:
ulimit -a

2- Set the following in smitty:
1. Start smitty as root
2. Go to
System Environments -> Change/Show Characteristics of Operating System
3. Set the
Enable full CORE dump option to TRUE

Alternatively, you can run
chdev -l sys0 -a fullcore='true' as root.

You can check the setting with
lsattr -D -c sys -a fullcore -H, which should produce output similar to this:
attribute deflt description user_settable
fullcore false Enable full CORE dump True

Reference: IBM Web Site, AIX Help

Friday, August 7, 2009

Monitoring Oracle DB in a HACMP Active/Passive Cluster

The following script is one that I developed to be executed by HACMP every 10 seconds to make sure that the database is up and running:

#!/usr/bin/bash

DATE=`date +%d%m%y` # Record the time to add a time stamp to the log
LOG=/home/hacmp/logs/sblmon_${DATE}.log # Write the time stamp

if [ -f /home/hacmp/lock ]; then # If a file named "lock" exists, then disable the scripts
echo `date` >> $LOG
echo "==================================================" >> $LOG
echo "Oracle Monitoring Script Disabled" >> $LOG
exit 0
fi

export smon=`ps -ef | grep -v grep | grep -c ora_smon_db`
export lsnr=`ps -ef | grep -v grep | grep -c LISTENER`
export pmon=`ps -ef | grep -v grep | grep -c ora_pmon_db`
export lgwr=`ps -ef | grep -v grep | grep -c ora_lgwr_db`
export dbw0=`ps -ef | grep -v grep | grep -c ora_dbw0_db`

# The below statement is to execute the sql_check_rw file (inside /oracle which is the home directory of user oracle) which contains the SQL statement needed to check the DB OPEN_MODE

export dbstatus=`su - oracle <. .profile
./sql_check_rw
EOF`

dbstatus=$(echo ${dbstatus:1}) # To remove the first character (as the string is preceded by an extra special character)

echo `date` >> $LOG
echo "==================================================" >> $LOG


if [ $dbw0 -eq 0 ]; then
echo "dbw0 failed" >> $LOG
exit 1 # Process doesn't exist
elif [ $lsnr -eq 0 ]; then
echo "lsnr failed" >> $LOG
exit 1
elif [ $pmon -eq 0 ]; then
echo "pmon failed" >> $LOG
exit 1
elif [ $lgwr -eq 0 ]; then
echo "lgwr failed" >> $LOG
exit 1
elif [ $smon -eq 0 ]; then
echo "smon failed" >> $LOG
exit 1
elif [ "$dbstatus" != "READ WRITE" ]; then
echo "DB OPEN_MODE is not READ WRITE" >> $LOG
exit 1
else
echo "Success" >> $LOG
exit 0 # All monitored processes are running and database is in "READ WRITE" OPEN_MODE
fi