Monday 27 August 2012

How to Deploy the RPD using Shell Script

After couples of busy moths I got time and I decided to add some post in my long time stopped interaction zone. So I am starting this session with the deployment of RPD using Shell Script.

In OBIEE 11g the deployment procedure of RPD is handling by the Enterprise manager, but while doing the deployment of RPD using Enterprise Manager( to see how to deploy RPD using EM click here) I feel it is more time consuming as some time enterprise manager takes time to load the graphics.

To over come from such situation the OBIEE provides WLST(Weblogic Scripting tool), so I thought I can  pulled the hand completed, by launching the WLST and then running the RPD deployment script.then question arises can we call the WLST and the command related to WLST in shell script and I crested the following script

echo "Enter user : "
read user
echo "Enter password : "
read password
echo "Enter host(ex. adminAddress:adminPort) : "
read host
echo "Enter RPD Path and Name (ex. /~/rpd_name.rpd) : "
read rpd_path
echo "Enter RPD Password : "
read rpd_password
/export/home/oracle/
Middlewarehome/OracleBI/wlserver_10.3/common/bin/wlst.sh
connect(user,password,host)
domainCustom()
cd('oracle.biee.admin')
# Lock
print 'Obtaining lock...'
cd('oracle.biee.admin:type=BIDomain,group=Service')
objs = jarray.array([], java.lang.Object)
strs = jarray.array([], java.lang.String)
try:
invoke('lock', objs, strs)
except:
print 'Already locked'
# Lock Complete
cd('..')
# Upload
print 'Uploading repository...'
cd('oracle.biee.admin:type=BIDomain.BIInstance.ServerConfiguration,biInstance=coreapplication,group=Service')
params = jarray.array([rpd_path,rpd_password],java.lang.Object)
sign = jarray.array(['java.lang.String', 'java.lang.String'],java.lang.String)
invoke( 'uploadRepository', params, sign)
# Upload Complete
cd('..')
# Commit
print 'Applying changes...'
cd('oracle.biee.admin:type=BIDomain,group=Service')
objs = jarray.array([], java.lang.Object)
strs = jarray.array([], java.lang.String)
try:
invoke('commit', objs, strs)
except:
print 'Not Locked'
#Commit Complete
exit()

/export/home/oracle/Middlewarehome/OracleBI/instances/instance1/bin/opmnctl stopall

echo OPMNCTL Starting.......

/export/home/oracle/Middlewarehome/OracleBI/instances/instance1/bin/opmnctl startall

/export/home/oracle/Middlewarehome/OracleBI/instances/instance1/bin/opmnctl status
 I ran this script in Unix shell but rather than completing the deployment the control stopped at the "WLST:offline>" it means that user needs to provide the parameter and there is no use of opmnctl command.
 But I want to pull out hands so it is necessary to deploy the RPD and restart the services from shell script only, so I created two file once shell script and another is .PY as WLST accept only the  jython.

Deploy.sh

echo "Enter the path (from current directory) of .py file: "
read pp
[weblogic_Home]/common/bin/wlst.sh $pp
[oracle_Home]/instances/instance1/bin/opmnctl stopall

echo OPMNCTL Starting.......
[Oracle_Home]/instances/instance1/bin/opmnctl startall
[Oracle_Home]/instances/instance1/bin/opmnctl status
RPD_Deployment.py
user = raw_input("Enter user : ")
password = raw_input("Enter password : ")
host = raw_input("Enter host(ex. adminAddress:adminPort) : ")
rpd_path = raw_input("Enter RPD Path and Name (ex. C:/~/rpd_name.rpd) ")
rpd_password = raw_input("Enter RPD Password : ")
connect(user,password,host)
domainCustom()
cd('oracle.biee.admin')
# Lock
print 'Obtaining lock...'
cd('oracle.biee.admin:type=
BIDomain,group=Service')
objs = jarray.array([], java.lang.Object)
strs = jarray.array([], java.lang.String)
try:
invoke('lock', objs, strs)
except:
print 'Already locked'
# Lock Complete
cd('..')
# Upload
print 'Uploading repository...'
cd('oracle.biee.admin:type=BIDomain.BIInstance.ServerConfiguration,biInstance=coreapplication,group=Service')
params = jarray.array([rpd_path,rpd_password],java.lang.Object)
sign = jarray.array(['java.lang.String', 'java.lang.String'],java.lang.String)
invoke( 'uploadRepository', params, sign)
# Upload Complete
cd('..')
# Commit
print 'Applying changes...'
cd('oracle.biee.admin:type=BIDomain,group=Service')
objs = jarray.array([], java.lang.Object)
strs = jarray.array([], java.lang.String)
try:
invoke('commit', objs, strs)
except:
print 'Not Locked'
#Commit Complete
exit()

Now...I call the WLST launch command and all the function required to deploy the RPD through the shell script itself in Deploy.sh and provide the path of RPD_Deployment.py.
Note:To avoid the parameter pass on the shell we can also create parameter and there values in to the separate the script and use the values of them in RPD_Deployment.py



6 comments:

  1. very good..thanks

    ReplyDelete
  2. Thanks for a very useful post. Do you know if its possible to update the RPD using scripts instead of using the admin tool (i.e. in batch mode)?

    ReplyDelete
    Replies
    1. yes, not supported by oracle though.

      here is a link with a list of all the commands that are available to you:

      http://rnm1978.wordpress.com/2009/09/09/syntax-for-admintool-exe-command-line-script/

      Delete
  3. You can update an RPD using UDML, which is very useful to quickly change connection pools DSN, User, or Password. UDML can be used to change variables or anything else in an RPD.

    I have a post on this on my blog http://adventuresinobiee.blogspot.com/

    ReplyDelete
  4. can i get script file for windows to deply RPD???

    ReplyDelete

  5. I just see the post i am so happy the post of information's.So I have really enjoyed and reading your blogs for these posts.Any way I’ll be subscribing to your feed and I hope you post again soon.
    best selenium training institute in hyderabad
    best selenium online training institute in hyderabad
    best institute for selenium training in hyderabad
    best selenium training institute in hyderabad

    ReplyDelete