Simple WLST script to add WebLogic Cluster timer scheduler

Michel Schildmeijer
0 0
Read Time:1 Minute, 27 Second

It seems like an easy task to do within WebLogic Admin Console, but sometimes an administrator requires automation. WebLogic Server can schedule future tasks similar to a scheduled job. It works by using the class that will execute the task and metadata to a database.  One cluster member will be responsible for JobScheduler which invokes the Timertask.  The server responsible for this service will check the database every xx secs to see if there are new tasks .

To setup the Timer you will need a datasource and table name for the timer ( default name WebLogic uses is weblogic_timers) That section is not covered inhere, but just a simple script to set up the timer

## Created by M. Schildmeijer
## WLST Script to configure the WebLogic Scheduler Table name and DataSource
## Replace anything between <> with your own WebLogic Server values
## Properties Section
user='weblogic'
pw='<password weblogic admin>'
adminServer='<AdminServer Host>'
adminPort='<Admin Port>'
clusterName='<cluster name>'
jsschedtblnm='<job scheduler table name>'
dsname='<DataSource Name>'
## Standard Connection creation
try:
  connect(user,pw,'t3://'+adminServer+':'+adminPort)
except:
  print 'Error connecting to Admin Server'
## Get the list of managed servers in the cluster
try:
  domainConfig()
  cd('Clusters/'+clusterName)
  managedServers=cmo.getServers()
  print 'Found ' + ' managed servers' + managedServers
except:
  print 'Error navigating DomainConfig MBean tree for the list of managed servers'
  ## Start an edit session and navigate
domainConfig()
edit()
startEdit()
cd('/Clusters/' +clusterName)
cmo.setJobSchedulerTableName(jsschedtblnm)
save()
cd('/Clusters/' +clusterName +'/' +'setDataSourceForJobScheduler' )
cmo.setDataSourceForJobScheduler(dsname)
save()
activate() 

About Post Author

Michel Schildmeijer

Started in pharmacy, I made the change to IT in 1996. I am an Oracle Fusion Middleware Architect at AMIS, with focus on technical infrastructure, Serverside solutions, installing, administering, configuring the Oracle Fusion Middleware stack. My experience is from integrations at telco´s using Oracle AIA, Oracle Portal, OID, Forms&Reports, Discoverer upto the latest Oracle WebLogic 11g releases with practically all Oracle products running on top of it
Happy
Happy
0 %
Sad
Sad
0 %
Excited
Excited
0 %
Sleepy
Sleepy
0 %
Angry
Angry
0 %
Surprise
Surprise
0 %
Next Post

Masterclass Advanced SQL - entertaining and intensive

Yesterday I presented the Masterclass Advanced SQL to an audience of very experienced Oracle Database developers – one veteran had started his career on Oracle 5 in the late 1980’s. In a long, intensive day – 9 – 5 and beyond – we discussed many real life experiences, many practical […]
%d bloggers like this: