Archive for the 'Oracle' Category

OBIEE powered with WebLogic

10 August, 2009

Majority of OBIEE deployments are implemented with OC4J – this is the default type of OBIEE setup. It is easy.  Well, substitute OC4J with WebLogic is easy as well ( of course, this alternative may be interesting only for shops already running WebLogic, otherwise it might be too expensive).

First, the WebLogic software should be installed – this is not a big deal, interesting to mention only – it is perfectly capable for silent mode installation.  To do that, a pretty simple configuration file should be created – the example from the documentation is a good start point, in my setup i written such config ( silent.xml) with following content:


<?xml version="1.0" encoding="UTF-8"?>
<bea-installer>
 <input-fields>
 <data-value name="BEAHOME" value="/opt/biee/Middleware" />
 <data-value name="WLS_INSTALL_DIR" value="/opt/biee/Middleware/wlserver_10.3" />
 <data-value name="COMPONENT_PATHS"
 value="WebLogic Server" />
 <data-value name="INSTALL_NODE_MANAGER_SERVICE" value="yes"  />
 <data-value name="NODEMGR_PORT" value="5555" />
 <data-value name="BEA_BUNDLED_JVMS" value="/opt/biee/Middleware/jrockit_160_05" />
 </input-fields>
</bea-installer>

There is not too much freedom by the installation – you can vary installation location, individual components, which jdk should be installed/used. The installation itself can be performed then with


./server103_linux32.bin -silent_xml=/opt/biee/stage/silent.xml -mode=silent -log=silent.log

After installer completes, the domain should be created. The concept of domain is again very good explained in the documentation, basically it is a logical entity which contains grouped by some attribute (it may be all development server – building a development domain, or , alternatively,  all server located in Munich – building a geographical domain) WebLogic servers or clusters. To perform administrative tasks on domain, one server, dedicated for this job should be created (typically called AdminServer) – where no custom applications should be deployed. Additionally, any number of managed server or cluster may be created in the same domain.  Another component worth to mention is NodeManager – it adds a lot of flexibility to control your server infrastructure, it can start server, kill server,check server status and alike – again, the documentation is very detailed.  So, to achieve the goal – deployment of OBIEE – the plan could look

  1. Create a bi domain
  2. Create administrative  server
  3. Create managed server
  4. optionally – enroll NodeManager
  5. Deploy OBIEE into managed server

The funny point about this is – all the tasks above can be scripted. No mouse. Ever.

Moreover, it can be done in a lot of ways, my personal favorite is WebLogic Scripting Tool (WLST – a jython based api). There are a lot of functionality already included in WLST, it is highly extensible, for example Oracle Fusion is delivered with additional modules to get better control over individual components.  But if that’s not enough, one can write own scripts using either existing java or python classes. To create a simple domain a supplied script can be used (with some adujstments) – the location of sample wlst scripts is $WLS_INSTALL_DIR/common/templates/scripts/wlst. Google search can provide a lot of nice examples as well, in particular, i used slightly customized version of script found at Bala Kothandaraman’s blog :

### Script to create WebLogic Domain(s) from csv file02.### Reusable Definitions
def buildDomain():
    ### Read Basic Template
    readTemplate(WL_HOME+"/common/templates/domains/wls.jar")
    cd('Servers/AdminServer')
    set('ListenAddress', adminServerAddress)
    set('ListenPort', int(adminServerPort))
    ### Create Admin User
    cd('/Security/base_domain/User')
    delete('weblogic','User')
    create(adminUser,'User')
    cd(adminUser)
    set('Password',adminPassword)
    set('IsDefaultAdmin',1)
    ### Write Domain
    setOption('OverwriteDomain', 'true')
    writeDomain(domainLocation+'/'+domainName)
    closeTemplate()
def printConfirmation():
    ### Print Confirmation
    print ""
    print "Created Domain With Following Values"
    print "Domain Name   = %s " % domainName
    print "Domain Location  = %s " % domainLocation
    print "Admin User   = %s " % adminUser
    print "Admin Password   = %s " % adminPassword
    print "Admin Server Address  = %s " % adminServerAddress
    print "Admin Server port  = %s " % adminServerPort
### Executable Script
### CreateDomain.py
import sys
### Define constants
WL_HOME = "/opt/bea/Middleware/wlserver_10.3"
### Read the command-line arguments
argslength = len(sys.argv)
if argslength < 2 :
    print '==>Insufficient arguments'
    print '==>Syntax: java weblogic.WLST CreateDomain.py csv.file'
    exit()
else:
    ### Read the csv file
    fileName = sys.argv[1]
    print('Reading File \"' + fileName + '\"' )
    f = open(fileName)
    try:
        for line in f.readlines():
        ### Strip the comment lines
          if line.strip().startswith('#'):
              continue
          else:
              ### Split the comma seperated values
              items = line.split(',')
              items = [item.strip() for item in items]
              if len(items) != 6:
                  print "==>Bad line: %s" % line
                  print "==>Syntax: domainName, domainLocation, adminUser, adminPassword, adminServerAddress, adminServerPort"
              else:
                  (domainName, domainLocation, adminUser, adminPassword, adminServerAddress, adminServerPort) = items

                  ### Call the definition buildDomain
                  buildDomain()
                  ### Call the definition printConfirmation
                  printConfirmation()
    except Exception, e:
        print "==>Error Occured"
        print e
exit()

This script reads a csv file with 6 fields filled for domain name,domain location,admin user,admin password,server address,server port. I used a file biee.csv with the contents:

biee,/opt/bea/Middleware/user_projects/domains,admin,weblogic,,7001

Leaving the server address empty means, server will be listening on all available interfaces, otherwise, it would be listen only on the interface with the given ip address.
Script can be executed then by the WLST wrapper ( of course, the csv file can contain definitions for multiple domains, which all are created then in bulk)

wlst.sh CreateDomain.py biee.csv

The next steps – create managed server, enroll NodeManager, deploy application are performed by following wlst script:

## Variable Definitions
DomainName   = 'biee'
DomainLocation  = '/opt/bea/Middleware/user_projects/domains'
DomainDir = DomainLocation + '/' + DomainName
AdminUser   = 'admin'
AdminPassword   = 'weblogic'
AdminServerport  = '7001'
AdminServer='AdminServer'
ManagedServer='biee01'
Machine='unixMachine01'
nmPort=5555
nmType='SSL'
nmHost='localhost'
nmHome='/opt/bea/Middleware/wlserver_10.3/common/nodemanager'

# StartServer - starts AdminServer
startServer(adminServerName=AdminServer,domainName=DomainName,username=AdminUser,password=AdminPassword,domainDir=DomainDir)
# connect to server
connect(AdminUser,AdminPassword)
edit()
startEdit()

# create Machine
cmo.createUnixMachine(Machine)
# create managed server
cmo.createServer(ManagedServer)

cd('/Machines/' + Machine + '/NodeManager/' + Machine)
cmo.setNMType(nmType)
cmo.setListenPort(nmPort)
cmo.setListenAddress(nmHost)

cd('/Servers/' + ManagedServer)
cmo.setListenAddress('')
cmo.setListenPort(7003)
cmo.setListenPortEnabled(true)
cmo.setJavaCompiler('javac')
cmo.setMachine(getMBean('/Machines/' + Machine))

cd('/Servers/' + ManagedServer + '/SSL/' + ManagedServer)
cmo.setEnabled(true)
cmo.setListenPort(7004)

cd('/Servers/' + ManagedServer + '/ServerStart/' + ManagedServer)
cmo.setUsername(AdminUser)
cmo.setPassword(AdminPassword)
cmo.setClassPath('/opt/bea/Middleware/patch_wls1030/profiles/default/sys_manifest_classpath/weblogic_patch.jar:/opt/bea/Middleware/patch_cie660/profiles/default/sys_manifest_classpath/weblogic_patch.jar:/opt/bea/Middleware/jrockit_160_05/lib/tools.jar:/opt/bea/Middleware/wlserver_10.3/server/lib/weblogic_sp.jar:/opt/bea/Middleware/wlserver_10.3/server/lib/weblogic.jar:/opt/bea/Middleware/modules/features/weblogic.server.modules_10.3.0.0.jar:/opt/bea/Middleware/wlserver_10.3/server/lib/webservices.jar:/opt/bea/Middleware/modules/org.apache.ant_1.6.5/lib/ant-all.jar:/opt/bea/Middleware/modules/net.sf.antcontrib_1.0.0.0_1-0b2/lib/ant-contrib.jar:')
save()
activate()
# enroll NodeManager
nmEnroll(DomainDir,nmHome )
# start Node Manager
startNodeManager(verbose='true',NodeManagerHome=nmHome,ListenPort='5555',ListenAddress=nmHost)
# connect to node manager
nmConnect(AdminUser,AdminPassword, nmHost, 5555, DomainName, DomainDir,'ssl')
# start managed server
start(ManagedServer,'Server')
# deploy application ( oracle bi )
deploy("analytics","/opt/bea/OracleBI/web/analytics.war","biee01,",securityModel="DDOnly",block="true")

The script is pretty self explanatory – it is in general the strength of jython or python scripts – the code is easy readable, but it might be my personal opinion as i use a lot of python in daily work. Another point worth to mention – in the AdminConsole recording can be enabled, so all configuration changes in the Web gui can be saved to a script, that can be a starting point for latter configuration/deployment scripts.
By the last step – deployment – is assumed, Oracle BI EE is already installed. By the way, Oracle BI EE can as well be installed in silent mode – the response file will be created if installer options are like:

$BI_STAGE/setup.sh -console -options -record custom_response.ini

which might be reused then

$BI_STAGE/setup.sh -options custom_response.ini -silent

If BI Server and Presentation Server are started, then you can immediately login to Answers/Dashboards served from WebLogic server. XMLPublisher can be deployed on the same or another managed server, depending on requirements.

### Script to create WebLogic Domain(s) from csv file02.### Reusable Definitions
def buildDomain():
### Read Basic Template
readTemplate(WL_HOME+”/common/templates/domains/wls.jar”)
cd(‘Servers/AdminServer’)
set(‘ListenAddress’, adminServerAddress)
set(‘ListenPort’, int(adminServerPort))
### Create Admin User
cd(‘/Security/base_domain/User’)
delete(‘weblogic’,'User’)
create(adminUser,’User’)
cd(adminUser)
set(‘Password’,adminPassword)
set(‘IsDefaultAdmin’,1)
### Write Domain
setOption(‘OverwriteDomain’, ‘true’)
writeDomain(domainLocation+’/'+domainName)
closeTemplate()
def printConfirmation():
### Print Confirmation
print “”
print “Created Domain With Following Values”
print “Domain Name   = %s ” % domainName
print “Domain Location  = %s ” % domainLocation
print “Admin User   = %s ” % adminUser
print “Admin Password   = %s ” % adminPassword
print “Admin Server Address  = %s ” % adminServerAddress
print “Admin Server port  = %s ” % adminServerPort
### Executable Script
### CreateDomain.py
import sys
### Define constants
WL_HOME = “/opt/bea/Middleware/wlserver_10.3″
### Read the command-line arguments
argslength = len(sys.argv)
if argslength < 2 :
print ‘==>Insufficient arguments’
print ‘==>Syntax: java weblogic.WLST CreateDomain.py csv.file’
exit()
else:
### Read the csv file
fileName = sys.argv[1]
print(‘Reading File \”‘ + fileName + ‘\”‘ )
f = open(fileName)
try:
for line in f.readlines():
### Strip the comment lines
if line.strip().startswith(‘#’):
continue
else:
### Split the comma seperated values
items = line.split(‘,’)
items = [item.strip() for item in items]
if len(items) != 6:
print “==>Bad line: %s” % line
print “==>Syntax: domainName, domainLocation, adminUser, adminPassword, adminServerAddress, adminServerPort”
else:
(domainName, domainLocation, adminUser, adminPassword, adminServerAddress, adminServerPort) = items

### Call the definition buildDomain
buildDomain()
### Call the definition printConfirmation
printConfirmation()
except Exception, e:
print “==>Error Occured”
print e
exit()

Some notes about Oracle installation in silent mode

22 July, 2009

Awhile ago Grégory Guillou from Pythian Group published a nice serie of posts about using some Oracle utilities (like oui,dbca,dbua,netca) in silent mode. For dba’s who perform a lot maintenance tasks – install,configure,patch – this technique is a huge timesaver ( at least it is in my experience ). As he stated himself, there is a ton of things more, one can do with these tools, which can’t be covered in a blog post ( or even in a couple of them).

I was looking how to add individual components to an existing oracle home in silent mode – maybe, this requirement come not so often, because the enterprise or custom install types include the majority of the options. But connection manager and oracle label security (to name only two, i was interested in) are not installed per default. So, the first approach was – install interactively and record the response file. Unfortunately, it doesn’t work – installer doesn’t record selected options doing the custom install. There is a Metalink Note 314025.1 , which suggests, the issue to be fixed in later versions of oui, but in my test with the version bundled with database 11gR1 it was still not working.

As opposite to examples provided by Grégory, this type of installation requires custom response file (at least, in my test the relevant parameters – DEPENDENCY_LIST – were not accepted as command line switches). Finally, this worked for me to install the mentioned two options on an enterprise 10.2.0.1 installation (assumed, the database software is unzipped into /opt/oracle/stage/database) :

cat << eof >options.rsp
RESPONSEFILE_VERSION=2.2.1.0.0
oracle.options:DEPENDENCY_LIST={"oracle.rdbms.lbac:10.2.0.1.0"}
oracle.network:DEPENDENCY_LIST={"oracle.network.cman:10.2.0.1.0"}
eof

WORK=/opt/oracle/stage
DIST=$WORK/database
RESP=$WORK/options.rsp
$DIST/runInstaller -silent                        \
-responseFile $RESP                               \
FROM_LOCATION=$DIST/stage/products.xml            \
ORACLE_HOME="/opt/oracle/product/10.2.0.4"        \
ORACLE_HOME_NAME="OraDb10g_home4"                 \
TOPLEVEL_COMPONENT={"oracle.server","10.2.0.1.0"} \
DEINSTALL_LIST={"oracle.server","10.2.0.1.0"}     \
COMPONENT_LANGUAGES={"en","de","ru"}              \
INSTALL_TYPE="Custom"

To verify

opatch lsinventory -detail|grep -i "connection\|label"
Oracle Connection Manager                                            10.2.0.1.0
Oracle Label Security                                                10.2.0.1.0

Of course, if the components should be installed on the oracle home already patched, after the installation the patchset should be applied again.