Thursday, January 15, 2015

EBS 12.2 -- Automatic Start / Stop Scripts

In this post; you will find start and stop scripts for EBS 12.2 .
This scripts are capable for starting and stopping Weblogic services as well.
Shutdown script kills the remaining application processes after it finish stopping apps services.
Scripts must be run using application owner OS user (for ex : applmgr).
Note that : This scripts are tested and verified in a Development envrionment. The risk is yours if you want to use them..
Also these scripts can be modified and make better ..
I will make some enhancements in a couple of days.. Enhancements like adding some lines for unlocking the domain , adding some exceptions and adding some echso for having a better output..

START SCRIPT:
### ERMAN ARSLAN EBS 12.2 APPS START automated
### 12/30/2013
## supply appspassword and weblogicpassword in sequence as command line arguments
### reviewed and tested 1/15/2015
if [ `whoami` == "root" ]
then
echo you can not run this script with root!
exiting
else
. /u01/apps/EBSapps.env run
{ echo apps; echo $1; echo $2; } | sh $ADMIN_SCRIPTS_HOME/adstrtal.sh -nopromptmsg
fi


SHUTDOWN SCRIPT:
### ERMAN ARSLAN EBS 12.2 APPS SHUTDOWN automated
### 12/30/2013
## supply appspassword and weblogicpassword in sequence as command line arguments
### reviewed and tested 1/15/2015
if [ `whoami` == "root" ]
then
echo you can not run this script with root!
exiting
else
. /u01/apps/EBSapps.env run
{ echo apps; echo $1; echo $2; } | sh $ADMIN_SCRIPTS_HOME/adstpall.sh -nopromptmsg
sleep 10
export APPLICATION_USER=`whoami`
kill -9 `ps -ef|grep appldev|grep -v grep |grep -v bash|grep -v sshd |grep -v "ps -ef"| grep -v shutdownapps | awk '{print $2}'`
fi

Example Run:

FOR START using application owner user -> sh startupapps.sh apps welcome123
FOR STOP using application owner user -> sh shutdownapps.sh apps welcome123

Note: Dont use the shutdown script on a single node environment which has a shared user as the owner of both database and application files. If you have such an environment (by the way; you shouldnt have such a confiuration ) and still if you want to use the shutdown script, comment the line with kill command in the shutdown script

20 comments :

  1. Hi Erman,
    The script run excelently.
    Thanks man.

    ReplyDelete
  2. Thanks for your feedback Ricardo.

    ReplyDelete
  3. Hi Erman!
    in 12.1 shutdown takes 5 min.. In 12.2.6 shutdown takes 30 min... What a pain.. Any tricks to make it faster ? it the weblogic what makes it so slow i guess.
    Thanks,Julian

    ReplyDelete
  4. Hi Julian,

    30 mins is not normal. Even 10 mins is not normal.
    Did you do an analysis on that?
    You need to check to log file and see where it is hanging...
    Here is a similar approach for you ;

    http://ermanarslan.blogspot.com.tr/2015/01/ebs-122-adstrtalsh-hangs-can-not-start.html

    ReplyDelete
  5. Hi Erman!
    Thanks for answering.. So how long your instance to take to shutdown and startup using adstrtal.sh and adstpall.sh scripts for reference on appstier ?
    Br,Julian

    ReplyDelete
  6. Hi Julian,

    adstpall.sh should complete in 1 min or 2 min. (unless you have lots of managed servers --i.e several oacore servers).
    adstrtall.sh should complete max in 7-10 mins. (unless you have lots of managed servers --i.e several oacore servers).

    This durations, ofcourse; may change according to your OS resources and machine.

    ReplyDelete
  7. Thanks Erman Arslan for your help. -Raju

    ReplyDelete
  8. Is the any -nopromptmsg for adpreclone.pl.
    I am tying to automate the script. Could you please advise.

    ReplyDelete
  9. Hi Kishor ,

    You can do it . The same logic applies.

    Here is an example. (I tested it)
    apps_321 is the apps passwd and welcome1 is the weblogic admin passwd.(you can replace them with yours)

    Wıth APPLMGR OS user ->

    cd $ADMIN_SCRIPTS_HOME
    { echo apps_321; echo welcome1; } | perl adpreclone.pl appsTier

    ReplyDelete
  10. Hi Erman,

    Thanks for sharing the knowledge with us.

    question: Do you also have anything that can help us to automate db bounce as well?


    Thanks,
    Mady

    ReplyDelete
  11. db bounce can be done with a simple bash script, Mady.
    You only need to write a simple bash script that executes the sqlplus.

    For example this one:
    export ORACLE_SID=
    export ORACLE_HOME=
    export PATH=$PATH:$ORACLE_HOME/bin
    sqlplus "/as sysdba" 2>&1 >> somelogfilepath <<EOF
    shutdown immediate;
    EOF

    ReplyDelete
  12. #Likewise, for startup;

    sqlplus "/as sysdba" 2>&1 >> somelogfilepath <<EOF
    startup;
    EOF

    ReplyDelete
  13. Thanks Erman for your quick response and knowledge sharing...


    Thanks,
    Mady

    ReplyDelete
  14. Thanks for Erman, have you able to use your script to setup autobounce using Crontab? I am having some issues with it in Solaris OS.

    ReplyDelete
  15. I didn't use it with crontab, but it can be used without any problems, as long as you configure the correct env on your crontab.
    What issues do you have?

    ReplyDelete
  16. Hi,

    How to schedule adpreclone command in script

    e.g:-

    perl adpreclone.pl appsTier apps/apps
    { sleep 1s; echo welcome1; } |

    ReplyDelete
  17. Put it as a one-liner as follows;

    { echo ; echo ; } | perl $ADMIN_SCRIPTS_HOME/adpreclone.pl appsTier

    Or you may write it to a file(script file), and schedule that script in crontab.

    ReplyDelete
  18. Hi Erman

    I've used the shutdown script as follows, sh shutdownapps.sh but it's exiting with status 1. PFB

    adstpall.sh: too few arguments specified.

    USAGE: adstpall.sh [-skipNM] [-skipAdmin] [-nothreading]
    adstpall.sh -secureapps [-skipNM] [-skipAdmin]
    adstpall.sh -nodbchk [-skipNM] [-skipAdmin]
    adstpall.sh -mode=allnodes


    adstpall.sh: exiting with status 1

    ReplyDelete
  19. Hi Erman

    I've used your script to stop application in EBS 12.2.5, but it existing with status 1.

    adstpall.sh: too few arguments specified.

    USAGE: adstpall.sh [-skipNM] [-skipAdmin] [-nothreading]
    adstpall.sh -secureapps [-skipNM] [-skipAdmin]
    adstpall.sh -nodbchk [-skipNM] [-skipAdmin]
    adstpall.sh -mode=allnodes


    adstpall.sh: exiting with status 1

    ReplyDelete

If you will ask a question, please don't comment here..

For your questions, please create an issue into my forum.

Forum Link: http://ermanarslan.blogspot.com.tr/p/forum.html

Register and create an issue in the related category.
I will support you from there.