Friday, April 13, 2007

#Script to monitor the status of Oracle Application Server 10g Components.

#------------------------------------------------------------------
#---------------For Infra declaration------------------------------
#------------------------------------------------------------------
export STAGE_PATH=/software/stage
export INFRA_INSTANCE=orainfra.linuxhost.domain.com
export BIF_INSTANCE=orabif.linuxhost.domain.com
export ORACLE_BASE=/software/oracle
export ORACLE_HOME=/software/oracle/orainfra
export ORACLE_SID=iasdb
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib:/usr/local/lib
export DISPLAY=linuxhost.domain.com:3.0
xhost +
PATH=$PATH:$ORACLE_HOME/bin:$ORACLE_HOME/Apache/Apache/bin
PATH=$PATH:$ORACLE_HOME/dcm/bin:$ORACLE_HOME/opmn/bin
export PATH
clear
echo "========================"
echo "LINUXHOST.DOMAIN.COM"
echo "========================"
echo ""
echo ""
echo ""
echo ""
read
echo "========================="
echo "LISTENER STATUS"
echo "========================="
cd $ORACLE_HOME/bin
lsnrctl status
echo ""
echo ""
read
echo ""
echo ""
echo ""
echo "==============="
echo "DATABASE STATUS"
echo "==============="
var1=`sqlplus -silent "/as sysdba"<<"EOF1"
column "DATABASE NAME" format a15
column "DATABASE STATE" format a15
select name "DATABASE NAME", open_mode "DATABASE STATE",to_char(startup_time,'DD-MON-YYYY HH24:MI:SS') "STARTUP_TIME" from v\$database , v\$instance;
exit;
"EOF1"`
IFS="/n"
echo $var1
echo ""
echo ""
read
echo ""
echo ""
echo "=========================================================="
echo "Enterprise Manager ----" $INFRA_INSTANCE
echo "=========================================================="
emctl status iasconsole
echo ""
echo ""
read
cd $ORACLE_HOME/opmn/bin
echo ""
echo ""
echo "=========================================================="
echo "Infra Components ----" $INFRA_INSTANCE
echo "=========================================================="
opmnctl status
echo ""
echo ""
read
#------------------------------------------------------------------
#---------------For BIF declaration------------------------------
#------------------------------------------------------------------

export ORACLE_BASE=/software/oracle
export ORACLE_HOME=/software/oracle/orabif
export ORACLE_SID=iasdb
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib:/usr/local/lib
export DISPLAY=linuxhost.domain.com:3.0

PATH=$PATH:$ORACLE_HOME/bin:$ORACLE_HOME/Apache/Apache/bin
PATH=$PATH:$ORACLE_HOME/dcm/bin:$ORACLE_HOME/opmn/bin
export PATH
cd $ORACLE_HOME/bin
echo ""
echo ""
echo "=========================================================="
echo "Enterprise Manager ----" $BIF_INSTANCE
echo "=========================================================="
emctl status iasconsole
echo ""
echo ""
read
cd $ORACLE_HOME/opmn/bin
echo ""
echo ""
echo "=========================================================="
echo "BIF Components ----" $BIF_INSTANCE
echo "=========================================================="
opmnctl status
echo ""
echo ""
read
echo ""
echo ""
echo "=========================================================="
echo "DISK SPACE INFORMATION"
echo "=========================================================="
df -kh
echo ""
echo ""
read
echo "*******************************************************************"
echo " END OF MONITORING "
echo "*******************************************************************"

Labels:

Monday, June 26, 2006

Hi,

In this part i am going to discuss the issues i faced in UNIX.

These issues will be helpful only for a beginner.

Issue One

1. I want to count the number of files in a direcotry.
2. I had given ls -l wc -l
3. Then the issue starts ie. ls -l will show an extra record total.
4. I want to avoid the total.


Solution One

ls -l grep -v "total" wc -l

Solution Two

ls -l grep ^- wc -l

Solution Three

ls -l wc -l awk {'print $1-1'}



Issue Two


While issuing the ps -ef command it is also showing the ps -ef command which i issued to list the process


Solution

ps -ef grep smon grep -v "grep"


I will be posting new issues faced in future.1

Regards
Salih KM

Thursday, June 22, 2006

Hi All,

In this i will show how to invoke fetch values from database inside a shell script.

Example:

var1=`sqlplus -silent "/as sysdba"<<"EOF1"
clear screen
column "DATABASE NAME" format a15
column "MODE OF OPERATION" format a20
column "ARCHIVE\NOARCHIVE" format a20
select name "DATABASE NAME", open_mode "MODE OF OPERATION",log_mode "ARCHIVE\NOARCHIVE" from v\$database;
exit;
"EOF1"`
IFS="/n"
echo $var1


The above shell script will shows the name, open mode and log mode of a database.

Regards
SALIH KM





Wednesday, June 21, 2006

Hi All,

I will be posting unix commands useful for Oracle DBAs.

Regards
SALIH KM