19 August, 2016

Monitoring a URL script

export PATH=$PATH:/usr/local/bin
rm /tmp/discourl_chk.out

curl -sSf http://oracle-1.google.com:8090/discoverer/viewer > /tmp/discourl_chk.out

if [ $? -ne 0 ]; then
            ERROR_SUBJECT="CRITICAL: DISCO URL NOT REACHABLE - http://oracle-1.google.com:8090/discoverer/viewer "
                /usr/bin/mailx -s "$ERROR_SUBJECT" remote_dba@gmail.com,dba@gmail.com < /tmp/discourl_chk.out
else
        echo "NO ERROR, URL is accessible! Relax"
fi

05 August, 2016

How to Start / Stop services in Oracle Applications R12 ( Application / Database Tier)

This post covers step by step instructions of How to Start/Stop services in Oracle Applications R12. These steps are from Online Oracle Apps DBA (11i /R12) traininghere (This is interactive online course over weekend with hands on exercises on installation, patching, cloning during weekdays)
Assumptions
Application Tier O.S. User : avisr12 (usually applmgr)
Database Tier O.S. User : ovisr12 (usually oracle)
R12 install base : /oracle/apps/r12/visr12
Database SID : visr12
Database Version : 11.1.0
Hostname : focusthreadr12
Operating System : Unix/Linux
Apps Schema Password : apps (apps is default password)
.
Start-Up/Shutdown order
If you are starting services then first start Database Tier services and then ApplicationTier Services.
If you are shutting down services then first stop Application Tier services andthen Database Tier Services.
  
1. Startup
1.1 Start Database Tier
1.1.1 
Login as database tier user (ovisr12)
1.1.2 Set environment variable by running $SID_hostname.envfrom $INSTALL_BASE/db/tech_st/11.1.0
—- cd /oracle/apps/r12/visr12/db/tech_st/11.1.0
—- . visr12_focusthreadr12.com (note: dot in front)
1.1.3 Start database
—- sqlplus “/as sysdba”
—- SQL> startup
1.1.4 
Start Database Listener (lsnrctl start $SID)
—- lsnrctl start visr12
.
.
1.2 Start Application Tier
1.2.1 
Login as application tier user (avisr12)
1.2.2 Set environment variable by running $SID_hostname.envfrom $INSTALL_BASE/apps/apps_st/appl
—- cd /oracle/apps/r12/visr12/apps/apps_st/appl
—- . visr12_focusthreadr12.com (note: dot in front)
1.2.3 Start Application Tier (adstrtal.sh apps/$apps_password)
—- cd $ADMIN_SCRIPTS_HOME
—- ./adstrtal.sh apps/apps
.
.
2. Shutdown Services
2.1 Shutdown Application Tier
2.1.1 
Login as application tier user (avisr12)
2.1.2 Set environment variable by running $SID_hostname.env from $INSTALL_BASE/apps/apps_st/appl
—- cd /oracle/apps/r12/visr12/apps/apps_st/appl
—- . visr12_focusthreadr12.com (note: dot in front)
2.1.3 Stop Application Tier (adstpall.sh apps/$apps_password)
—- cd $ADMIN_SCRIPTS_HOME
—- ./adstpall.sh apps/apps
.
2.2 Shutdown Database Tier
2.2.1 
Login as database tier user (ovisr12)
2.2.2 Set environment variable by running $SID_hostname.env from $INSTALL_BASE/db/tech_st/11.1.0
—- cd /oracle/apps/r12/visr12/db/tech_st/11.1.0
—- . visr12_focusthreadr12.com (note: dot in front)
2.2.3 Stop database
—- sqlplus “/as sysdba”—- SQL> shutdown immediate
2.2.4 
Stop Database Listener (lsnrctl start $SID)
—- lsnrctl stop visr12

Useful Scripts

To Find session details using SID. set verify off col sid format 99999 col machine format a10 col program format a25 trunc col username form...