2012/08/14

OBIEE 11g - Enabling Usage Tracking

Enabling Usage Tracking - Scripting



We all know the to enable Usage Tracking in OBIEE 11g requires, logging into the FMW Admin Console and make changes.

I have written the below scripts to enable the changes to be done straight on the server ( these scripts are written on Linux for OBIEE 11.1.1.6).

There are two scripts one for doing the all the required changes, other one is for setting the environment variables and call the WLST interface and execute the other script.

enable_usage_tracking.sh

####################################################################################
#
# Script to create to configure WL Domain for Usage Tracking
#
####################################################################################
#
# Mahesh - 15/08/2012 - Createad
# Usage - Called from the shell
#
####################################################################################

touch '/xx/oracle/data/enable_usage_tracking.log'
cd /xx/u01/MiddlewareHome/wlserver_10.3/server/bin
. ./setWLSEnv.sh

java  -Dweblogic.security.SSL.ignoreHostnameVerification=true
-Dweblogic.security.TrustKeyStore=CustomTrust
-Dweblogic.security.CustomTrustKeyStoreFileName=<trust key store file name>
-Dweblogic.security.CustomTrustKeyStoreType=jks
-Dweblogic.security.CustomTrustKeyStorePassPhrase= -Dweblogic.security.allowCryptoJDefaultPRNG=true weblogic.WLST /pta2_enable_usage_tracking.py

enable_usage_tracking.py

####################################################################################
#
# Script to enable Usage Tracking in BI Domain
#
####################################################################################
#
# Mahesh - 15/08/2012 - Createad
# Usage - Called from the script enable_usage_tracking.sh
#
####################################################################################

redirect('/xx/oracle/data/enable_usage_tracking.log','false')

import sys
import os
import datetime

sys.stdout = open('/xx/oracle/data/enable_usage_tracking.log','w+')

####################################################################################
#
# declare env variables
# Change these to suit environment
#
####################################################################################

adminUser = 'weblogic'
adminPassword =
adminURL = 't3://hostname:8002'

####################################################################################
#
# declare usage tracking variable
#
####################################################################################

PhyTabName = '"OBI Usage Tracking"'+'."dbo"'+'."S_NQ_ACCT"'
cPool = '"OBI Usage Tracking"'+'."Usage Tracking Writer Connection Pool"'

print ('Usage Tracking Physcail Table Name :', PhyTabName)
print ('Connection Pool :', cPool)

#
####################################################################################
#

now = datetime.datetime.now()
print 'Current date and time is :'
print str(now)

####################################################################################

print 'Admin User:',adminUser
print 'Admin Password:',adminPassword
print 'Admin URL:',adminURL

####################################################################################
#
# connect to weblogic admin server
#
####################################################################################

connect(adminUser, adminPassword, adminURL)

serverConfig()

print 'connecting to domaini........'

domainCustom()
cd ('oracle.biee.admin')

print 'Connecting to BI Domain MBean.......'

cd ('oracle.biee.admin:type=BIDomain,group=Service')

####################################################################################

print 'Calling Lock .....'

objs = jarray.array([], java.lang.Object)
strs = jarray.array([], java.lang.String)
invoke('lock',objs,strs)

####################################################################################

biinstances = get('BIInstances')
biinstance = biinstances[0]

print 'Connecting to BI Instance MBean......'

cd ('..')
cd (biinstance.toString())

biserverconfigbean = get('ServerConfiguration')

print ('Connecting to BIInstance Server Configuration MBean.....')

cd('..')
cd(biserverconfigbean.toString())

#
#UsageTrackingCentrallyManaged - attribute
#

print ('Retriving existing value for - UsageTrackingCentrallyManaged')
oldDisplayValue=get('UsageTrackingCentrallyManaged')
print ('Existing Value for - UsageTrackingCentrallyManaged: ' , Boolean(oldDisplayValue))
print ('Changing UsageTrackingCentrallyManaged to: ' , Boolean(true))
set('UsageTrackingCentrallyManaged', Boolean(true))

 
#
#UsageTrackingEnabled - attribute
#

print ('Retriving existing value for - UsageTrackingEnabled')
oldDisplayValue=get('UsageTrackingEnabled')
print ('Existing Value for - UsageTrackingEnabled: ' , oldDisplayValue)
print ('Changing UsageTrackingEnabled to: ' , Boolean(true))
set('UsageTrackingEnabled', Boolean(true))

#
#UsageTrackingDirectInsert - attribute
#

print ('Retriving existing value for - UsageTrackingDirectInsert')
oldDisplayValue=get('UsageTrackingDirectInsert')
print ('Existing Value for - UsageTrackingDirectInsert: ' , oldDisplayValue)
print ('Changing UsageTrackingDirectInsert to: ' ,Boolean(true))
set('UsageTrackingDirectInsert', Boolean(true))

#
#UsageTrackingPhyscialTableName - attribute
#

print ('Retriving existing value for - UsageTrackingPhysicalTableName')
oldDisplayValue=get('UsageTrackingPhysicalTableName')
print ('Existing Value for - UsageTrackingPhysicalTableName: ' , oldDisplayValue)
print ('Changing UsageTrackingPhysicalTableName to: ' , PhyTabName)
set('UsageTrackingPhysicalTableName', PhyTabName)

#
#UsageTrackingConnectionPool - attribute
#

print ('Retriving existing value for - UsageTrackingConnectionPool')
oldDisplayValue=get('UsageTrackingConnectionPool')
print ('Existing Value for - UsageTrackingConnectionPool: ' , oldDisplayValue)
print ('Changing UsageTrackingConnectionPool to: ' , cPool)
set('UsageTrackingConnectionPool', cPool)

####################################################################################

print ('Calling Commit.....')

cd ('..')

cd ('oracle.biee.admin:type=BIDomain,group=Service')

objs = jarray.array([], java.lang.Object)
strs = jarray.array([], java.lang.String)

invoke('commit', objs, strs)

print 'Committed OK'

####################################################################################

disconnect()

print 'End of Script'

exit()

No comments:

Post a Comment

File Handling with Python

This little utility is for copying files from source to target directories.  On the way it checks whether a directory exists in the target, ...