Friday, May 27, 2016

Automate start/stop OBIEE using Oracle WebLogic Scripting Tool (WLST) on Linux

We can use command to start/stop OBIEE(Admin Server, Managed Server and OPNM-System Components) in the Doc ID 1240964.1. But by this method we must tail the log file to determine if the Admin Server/Managed Server is started completely. After that you start the next commands. So you have your eyes glued to screen and wait util you see some pattern, ex: "Server started in RUNNING mode". It's hard to write an auto start shell script.
There is another method that you can start/stop OBIEE by writing an auto start shell script. It is Oracle Weblogic Scripting Tool(WLST). This note I will write an shell script to start/stop OBIEE.

My test environment:
OBIEE 11.1.1.7.0 is install on single Oracle Linux 6 x64 host.
Linux user: bi
Environment variables:
    $HOME=/home/bi
    $MW_HOME=/obiee11
    $WL_HOME=/obiee11/wlserver_10.3
    $BI_ORACLE_HOME=/obiee11/Oracle_BI1
    $DOMAIN_HOME=/obiee11/user_projects/domains/bifoundation_domain

Start OBIEE:
Create an WLST script file wlst_start_bi.py with the content as below
startNodeManager(verbose='true', PropertiesFile='/obiee11/wlserver_10.3/common/nodemanager/nodemanager.properties');
nmConnect('weblogic','password', host='192.168.x.x',port='9556',domainName='bifoundation_domain',domainDir='/obiee11/user_projects/domains/bifoundation_domain',nmType='ssl');
nmStart(serverName='AdminServer', domainDir='/obiee11/user_projects/domains/bifoundation_domain');
nmServerStatus('AdminServer')
connect('weblogic', 'password', 't3://localhost:7001');
start('bi_server1', 'Server');
exit();
Note: value 9556 is granted to port parameter in nmConnect is the Listening port of NodeManager. It is defined by ListenPort parameter in /obiee11/wlserver_10.3/common/nodemanager/nodemanager.properties. This ListenPort parameter must be the same as the one defined by <node-manager> → <listen-port> tag in /obiee11/user_projects/domains/bifoundation_domain/config/config.xml. Shortly they are defined at 9556 in my test.

Encapsulate all tasks into a shell script
#! /bin/bash
. /obiee11/wlserver_10.3/server/bin/setWLSEnv.sh
java weblogic.WLST /home/bi/wlst_start_bi.py
opmnctl startall
opnmctl status

Now you have a script to start OBIEE. You can exectute it when you need or auto start at the boot time.
Stop OBIEE:
Create an WLST script file, wlst_stop_bi.py
nmConnect('weblogic','password',host='192.168.x.x',port='9556',domainName='bifoundation_domain',domainDir='/obiee11/user_projects/domains/bifoundation_domain',nmType='ssl');
connect('weblogic','password', 't3://localhost:7001');
shutdown('bi_server1', 'Server', ignoreSessions='true', timeOut=600, force='true');
disconnect();
nmKill('AdminServer');
stopNodeManager();
exit();

Encapsulate all tasks into a shell script
#! /bin/bash
. /obiee11/wlserver_10.3/server/bin/setWLSEnv.sh
java weblogic.WLST /home/bi/wlst_stop_bi.py
opmnctl stopall

Let's try and leave your comment!

Reference:
    http://docs.oracle.com/cd/E23943_01/web.1111/e13740/starting_nodemgr.htm#NODEM220
    http://docs.oracle.com/cd/E23943_01/web.1111/e13715/manage_servers.htm#WLSTG169
    http://docs.oracle.com/cd/E23943_01/web.1111/e13813/reference.htm#WLSTC158
    http://ram-obi.blogspot.com/2011/10/how-to-start-stop-obiee-11g-1111x-unix.html

No comments:

Post a Comment