WLST script that
stops, starts or restarts the entire Oracle BI instance (all the system
components) is as follows-
1 .
Type the below script in notepad
import sys
import os
argLen = len (sys.argv)
if argLen -1 != 5:
print "ERROR:
got ", argLen -1, " args."
print "USAGE:
wlst StopStartRestartInstance.py WLS_HOSt WLS_PORT WLS_USER WLS_PASSWORD
componentstatus"
print " eg:
wlst StopStartRestartInstance.py localhost 7001 weblogic welcome1 restart"
exit()
WLS_HOST = sys.argv[1]
WLS_PORT = sys.argv[2]
WLS_USER = sys.argv[3]
WLS_PW = sys.argv[4]
componentstatus = sys.argv[5]
print 'Connecting to '+ WLS_HOST+ ':' + WLS_PORT + ' as
user: ' + WLS_USER + ' ...'
# Connect to WLS
connect(WLS_USER, WLS_PW, WLS_HOST= ':' + WLS_PORT);
print 'Connecting to Domain...'
domainCustom()
cd ('oracle.biee.admin')
print 'Connecting to BIDomain MBean ...'
cd ('oracle.biee.admin:type=BIDomain,group=Service')
biinstances = get('BIInstances')
biinstance = biinstances[0]
print 'Connecting to BIInstance MBean ...'
cd ('..')
cd (biinstance.toString())
if (componentstatus == "restart"):
servicestatus=get('ServiceStatus')
print 'BIInstance
Mbean; ServiceStatus: ' + servicestatus
print 'Calling
stop...'
objs =
jarray.array([], java.lang.Object)
strs = jarray.array([],
java.lang.String)
invoke('stop',
objs, strs)
servicestatus=get('ServiceStatus')
print 'BIInstance
Mbean; ServiceStatus: ' + servicestatus
print 'Calling
start...'
objs =
jarray.array([], java.lang.Object)
strs =
jarray.array([], java.lang.String)
invoke('start',
objs, strs)
servicestatus=get('ServiceStatus')
print 'BIInstance
Mbean; ServiceStatus: ' + servicestatus
elseif
componentstatus
== "start":
servicestatus=get('ServiceStatus')
print 'BIInstance
Mbean; ServiceStatus: ' + servicestatus
print 'Calling
start...'
objs =
jarray.array([], java.lang.Object)
strs =
jarray.array([], java.lang.String)
invoke('start',
objs, strs)
servicestatus=get('ServiceStatus')
print 'BIInstance
Mbean; ServiceStatus: ' + servicestatus
else :
servicestatus=get('ServiceStatus')
print 'BIInstance
Mbean; ServiceStatus: ' + servicestatus
print 'Calling
stop...'
objs =
jarray.array([], java.lang.Object)
strs =
jarray.array([], java.lang.String)
invoke('stop',
objs, strs)
servicestatus=get('ServiceStatus')
print 'BIInstance
Mbean; ServiceStatus: ' + servicestatus
exit()
2 .
Save the file as StopStartRestartInstance.py in the following location middleware_home\Oracle_BI1\common\bin. Save the file as .py extension
3 .
Call the above file
(stopstartrestartinstance.py) using command prompt as follows- middleware_home\Oracle_BI1\common\bin>wlst
StopStartRestartInstance.py localhost 7001 weblogic Welcome1 restart
No comments:
Post a Comment