initscripts for Oracle Business Intelligence 11gR1 on SUSE Linux Enterprise Server 11

What are the initscripts for?  They automate startup and shutdown of Oracle Business Intelligence services when the server is powered on/off or rebooted.  Why didn’t Oracle write them?  Can’t imagine.

First, install Oracle Business Intelligence

For those who don’t know, SUSE has a package that creates the proper environment for Oracle software.  It’s called “orarun”.  This sets kernel parameters, environment variables and so on, making it very easy to deploy Oracle stuff.  Its configuration file is /etc/sysconfig/oracle, but you don’t need to modify it to run Business Intelligence.  When you install SLES11 (or later in Software Management) you have to select these patterns:

  • Oracle Server Base
  • C/C++ Compiler and Tools

Then, give a shell to user “oracle” (must be root for that) and set its password:

su -
usermod -s /bin/bash oracle
passwd oracle

Edit the first section of /etc/profile.d/oracle.sh, put the paths where you intend to install OBI.  Example:

ORACLE_BASE=/opt/oracle
MW_HOME=$ORACLE_BASE/product/11gR1/bi
ORACLE_HOME=$MW_HOME/Oracle_BI1
ORACLE_INSTANCE=$MW_HOME/instances/instance1
DOM_HOME=$MW_HOME/user_projects/domains/bifoundation_domain
ORACLE_SID=orcl
export ORACLE_BASE MW_HOME ORACLE_HOME ORACLE_INSTANCE DOM_HOME ORACLE_SID

Now, become user oracle and perform the actual installation taking care to set the same paths that you put in the oracle profile.  If you decide to use different paths during installation, you can adjust the profile later, but remember that you need to re-login as oracle for the changes to become effective.

At the end of the installation, all the processes are left running. Use the console (http://oraclebi-host.yourdomain.com:7001/console) to stop them.

The initscripts

There are four of them:

  1. /etc/init.d/oraclefm_adminsrv – this is the Administration Server
  2. /etc/init.d/oraclefm_nodemgr – the Node Manager
  3. /etc/init.d/oraclefm_managedsrv – the Managed Server, that is the actual BI application
  4. /etc/init.d/oraclefm_instance – the instance

The initscripts start services in that order and shut them down in reverse.  They have logs in /var/log/oracle.  Get the scripts from the end of this post, put them in /etc/init.d, make them executable with

chmod u+x /etc/init.d/oraclefm*

Important: the Administration Server and Managed Server can only start non-interactively, without a password prompt, if you create a file called boot.properties in these directories:

  • $DOM_HOME/servers/AdminServer/security
  • $DOM_HOME/servers/bi_server1/security

The boot.properties file has a very simple syntax:

username=weblogic
password=yourpassword

Do not worry that the password will be stored in cleartext, the first time these services start, they will encrypt both parameters.

If there is a problem with this file, OBI start-up will fail, you should check the logs in /var/log/oracle.

Enabling the services

This actually makes them start automatically at boot and stop at shutdown.

chkconfig --add oraclefm_adminisrv
chkconfig --add oraclefm_nodemgr
chkconfig --add oraclefm_managedsrv
chkconfig --add oraclefm_instance

Log rotation

Create the directory for logs:

mkdir /var/log/oracle
chown oracle:oinstall /var/log/oracle

Then make a new file /etc/logrotate.d/oraclefm and put these lines in it, in order to rotate the logs:

/var/log/oracle/*.log {
    compress
    dateext
    maxage 365
    rotate 99
    size=+4m
    notifempty
    missingok
    copytruncate
}

Finally, here are the four actual scripts

As root, put them in /etc/init.d and make them executable with

chmod u+x /etc/init.d/oraclefm*

/etc/init.d/oraclefm_adminsrv

#!/bin/sh
### BEGIN INIT INFO
# Provides:          oraclefm_adminsrv
# Required-Start:    $syslog $remote_fs
# Should-Start:      $time smtp
# Required-Stop:     $syslog $remote_fs
# Should-Stop:       smtp
# Default-Start:     3 5
# Default-Stop:      0 1 2 6
# Short-Description: Oracle Fusion Middleware Administration Server
# Description:       Start Oracle Fusion Middleware Administration Server
### END INIT INFO

. /etc/rc.status

# Reset status of this service
rc_reset

ORACLE_BASE=/opt/oracle
MW_HOME=$ORACLE_BASE/product/11gR1/bi
ORACLE_HOME=$MW_HOME/Oracle_BI1
ORACLE_INSTANCE=$MW_HOME/instances/instance1
DOM_HOME=$MW_HOME/user_projects/domains/bifoundation_domain
LOG=/var/log/oracle/oraclefm_adminsrv.log
export ORACLE_BASE MW_HOME ORACLE_HOME ORACLE_INSTANCE DOM_HOME LOG

case "$1" in
    start)
        echo -n "Starting Oracle Fusion Middleware Administration Server (wait 3 min) "
        su - oracle --command="cd $MW_HOME/user_projects/domains/bifoundation_domain/bin; ./startWebLogic.sh >> $LOG 2>> $LOG &"

        # it needs time to start properly
        sleep 3m

        # Remember status and be verbose
        rc_status -v
        ;;
    stop)
        echo -n "Shutting down Oracle Fusion Middleware Administration Server "
        su - oracle --command="cd $MW_HOME/user_projects/domains/bifoundation_domain/bin; ./stopWebLogic.sh >> $LOG 2>> $LOG"

        # Remember status and be verbose
        rc_status -v
        ;;
    restart)
        ## Stop the service and regardless of whether it was
        ## running or not, start it again.
        $0 stop
        $0 start

        # Remember status and be quiet
        rc_status
        ;;
    status)
        echo "Checking for service Oracle Fusion Middleware Administration Server "
        ps w -u oracle
        ;;
    *)
        echo "Usage: $0 {start|stop|status|restart}"
        exit 1
        ;;
esac
rc_exit

/etc/init.d/oraclefm_nodemgr

#!/bin/sh
### BEGIN INIT INFO
# Provides:          oraclefm_nodemgr
# Required-Start:    $syslog $remote_fs oraclefm_adminsrv
# Should-Start:      $time smtp
# Required-Stop:     $syslog $remote_fs oraclefm_adminsrv
# Should-Stop:       smtp
# Default-Start:     3 5
# Default-Stop:      0 1 2 6
# Short-Description: Oracle Fusion Middleware Node Manager
# Description:       Start Oracle Fusion Middleware Node Manager
### END INIT INFO

. /etc/rc.status

# Reset status of this service
rc_reset

ORACLE_BASE=/opt/oracle
MW_HOME=$ORACLE_BASE/product/11gR1/bi
ORACLE_HOME=$MW_HOME/Oracle_BI1
ORACLE_INSTANCE=$MW_HOME/instances/instance1
DOM_HOME=$MW_HOME/user_projects/domains/bifoundation_domain
LOG=/var/log/oracle/oraclefm_nodemgr.log
export ORACLE_BASE MW_HOME ORACLE_HOME ORACLE_INSTANCE DOM_HOME LOG

case "$1" in
    start)
        echo -n "Starting Oracle Fusion Middleware Node Manager "
        su - oracle --command="cd $MW_HOME/wlserver_10.3/server/bin; ./startNodeManager.sh >> $LOG 2>> $LOG &"

        # Remember status and be verbose
        rc_status -v
        ;;
    stop)
        echo -n "Shutting down Oracle Fusion Middleware Node Manager "
        kill $(ps ww --user oracle | grep weblogic.NodeManager | awk '{print $1}')

        # Remember status and be verbose
        rc_status -v
        ;;
    restart)
        ## Stop the service and regardless of whether it was
        ## running or not, start it again.
        $0 stop
        $0 start

        # Remember status and be quiet
        rc_status
        ;;
    status)
        echo "Checking for service Oracle Fusion Middleware Node Manager "
        ps w -u oracle
        ;;
    *)
        echo "Usage: $0 {start|stop|status|restart}"
        exit 1
        ;;
esac
rc_exit

/etc/init.d/oraclefm_managedsrv

#!/bin/sh
### BEGIN INIT INFO
# Provides:          oraclefm_managedsrv
# Required-Start:    $syslog $remote_fs oraclefm_nodemgr
# Should-Start:      $time smtp
# Required-Stop:     $syslog $remote_fs oraclefm_nodemgr
# Should-Stop:       smtp
# Default-Start:     3 5
# Default-Stop:      0 1 2 6
# Short-Description: Oracle Fusion Middleware Managed Server
# Description:       Start Oracle Fusion Middleware Managed Server
### END INIT INFO

. /etc/rc.status

# Reset status of this service
rc_reset

ORACLE_BASE=/opt/oracle
MW_HOME=$ORACLE_BASE/product/11gR1/bi
ORACLE_HOME=$MW_HOME/Oracle_BI1
ORACLE_INSTANCE=$MW_HOME/instances/instance1
DOM_HOME=$MW_HOME/user_projects/domains/bifoundation_domain
LOG_BI=/var/log/oracle/oraclefm_managedsrv_bi.log
export ORACLE_BASE MW_HOME ORACLE_HOME ORACLE_INSTANCE DOM_HOME LOG_BI

case "$1" in
    start)
        echo -n "Starting Oracle Fusion Middleware Managed Server "
        echo -n "Business Intelligence "
        su - oracle --command="cd $MW_HOME/user_projects/domains/bifoundation_domain/bin; ./startManagedWebLogic.sh bi_server1 >> $LOG_BI 2>> $LOG_BI &"

        # Remember status and be verbose
        rc_status -v
        ;;
    stop)
        echo -n "Shutting down Oracle Fusion Middleware Managed Server "
        echo -n "Business Intelligence "
        su - oracle --command="cd $MW_HOME/user_projects/domains/bifoundation_domain/bin; ./stopManagedWebLogic.sh bi_server1 >> $LOG_BI 2>> $LOG_BI"

        # Remember status and be quiet
        rc_status -v
        ;;
    restart)
        ## Stop the service and regardless of whether it was
        ## running or not, start it again.
        $0 stop
        $0 start

        # Remember status and be quiet
        rc_status
        ;;
    status)
        echo "Checking for service Oracle Fusion Middleware Managed Server "
        ps ww --user oracle | grep weblogic.Name=bi_server1
        ;;
    *)
        echo "Usage: $0 {start|stop|status|restart} [forms|reports]"
        exit 1
        ;;
esac
rc_exit

/etc/init.d/oraclefm_instance

#!/bin/sh
### BEGIN INIT INFO
# Provides:          oraclefm_instance
# Required-Start:    $syslog $remote_fs oraclefm_managedsrv
# Should-Start:      $time smtp
# Required-Stop:     $syslog $remote_fs oraclefm_managedsrv
# Should-Stop:       smtp
# Default-Start:     3 5
# Default-Stop:      0 1 2 6
# Short-Description: Oracle BI Instance
# Description:       Start Oracle BI Instance
### END INIT INFO

. /etc/rc.status

# Reset status of this service
rc_reset

ORACLE_BASE=/opt/oracle
MW_HOME=$ORACLE_BASE/product/11gR1/bi
ORACLE_HOME=$MW_HOME/Oracle_BI1
ORACLE_INSTANCE=$MW_HOME/instances/instance1
DOM_HOME=$MW_HOME/user_projects/domains/bifoundation_domain
LOG=/var/log/oracle/oraclefm_instance.log
export ORACLE_BASE MW_HOME ORACLE_HOME ORACLE_INSTANCE DOM_HOME LOG

case "$1" in
    start)
        echo -n "Starting Oracle Fusion Middleware Instance "
        su - oracle --command="echo - - - $(date +%F\ %T) - - - >> $LOG"
        su - oracle --command="$ORACLE_INSTANCE/bin/opmnctl startall >> $LOG 2>> $LOG &"

        # Remember status and be verbose
        rc_status -v
        ;;
    stop)
        echo -n "Shutting down Oracle Fusion Middleware Instance "
        su - oracle --command="echo - - - $(date +%F\ %T) - - - >> $LOG"
        su - oracle --command="$ORACLE_INSTANCE/bin/opmnctl stopall >> $LOG 2>> $LOG"

        # Remember status and be verbose
        rc_status -v
        ;;
    restart)
        ## Stop the service and regardless of whether it was
        ## running or not, start it again.
        $0 stop
        $0 start

        # Remember status and be quiet
        rc_status
        ;;
    status)
        echo "Checking for service Oracle Fusion Middleware Instance "
        su - oracle --command="$ORACLE_INSTANCE/bin/opmnctl status"
        ;;
    *)
        echo "Usage: $0 {start|stop|status|restart}"
        exit 1
        ;;
esac
rc_exit
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s