mercoledì 27 giugno 2012

Automating Business Intelligence Startup and Shutdown on Linux

It's pretty common to install Oracle Middleware on an "unmanned" server, which means that there's no dedicated server admin or in general a person who could  manually start the services in event of server failure. So I usually create boot scripts that prevent services downtime in case of server restart or server crash.

This script is intended for automate starting of Oracle Business Intelligence on a Linux Server. I run this script on Oracle Linux 6 but this should work on other distributions too.

[root@orcl ~]# nano /etc/init.d/bi


#! /bin/bash
#
# OBIEE Start/Stop Script
#
# chkconfig: 345 20 80
# description: Starts and stops the Oracle BI and listeners
#
# Set BI_HOME to be equal to the $ORACLE_HOME
#
# Set ORA_OWNER to the user id of the owner of the OBIEE.

BI_HOME=/home/oracle/obiee
ORA_OWNER=oracle

export ORACLE_INSTANCE=$BI_HOME/instances/instance1

start()
    {
        echo "Starting BI service "
        su $ORA_OWNER -c "$BI_HOME/Oracle_BI1/opmn/bin/opmnctl startall"
        su $ORA_OWNER $BI_HOME/user_projects/domains/bifoundation_domain/startWebLogic.sh > /dev/null 2>&1 &
    }

stop()
    {
        echo "Stopping BI service "

        su $ORA_OWNER -c "$BI_HOME/Oracle_BI1/opmn/bin/opmnctl stopall"
        su $ORA_OWNER $BI_HOME/user_projects/domains/bifoundation_domain/bin/stopWebLogic.sh > /dev/null 2>&1 &
    }

# See how we were called.
case "$1" in
    start)
        start
    ;;
    stop)
        stop
    ;;
    status)
        status -p $pidfile $processname
        RETVAL=$?
    ;;
    restart)
        stop
        start
    ;;
    condrestart)
        if [ -f /var/lock/subsys/$servicename ]; then
            stop
            start
        fi
    ;;
    *)
        echo $"Usage: $0 {start|stop|status|restart|condrestart}"
    ;;
esac

exit $RETVAL

Chmod this script and make it executable on boot

[root@orcl ~]# chmod 750 /etc/init.d/bi

[root@orcl ~]# chkconfig --add bi

We need to allow Weblogic autostart forcing username and password, I know it's a security risk display username and password in plaintext, since by default Oracle stores passowrd information in boot.properties by encryprint using AES.

[root@orcl ~]# nano /home/oracle/obiee/user_projects/domains/bifoundation_domain/servers/AdminServer/security/boot.properties

password=YOUR_WEBLOGIC_PASSWORD_HERE
username=YOUR_WEBLOGIC_USERNAME_HERE

[root@orcl ~]# chown oracle /home/oracle/obiee/user_projects/domains/bifoundation_domain/servers/AdminServer/security/boot.properties

Now everything should work as expected!!

Try if everything works fine:

[root@orcl ~]# /etc/init.d/bi start

If you would like to have Weblogic output you can modify script, though I suggest to leave output redirection enabled, maybe change it from /dev/null to an appropriate log file.

su $ORA_OWNER $BI_HOME/user_projects/domains/bifoundation_domain/startWebLogic.sh &

On start Weblogic returned this error:

PKI-02002: Unable to open the wallet. Check password.

which was solved chmodding /tmp directory

chmod -R 777 /tmp

That's all!!

Nessun commento:

Posta un commento