Showing posts with label database. Show all posts
Showing posts with label database. Show all posts

Friday, 6 February 2015

wsadmin script to create a datasource (and of course a JDBC provider and auth alias) on WebSphere

Just a quicky so I can remember this.
Will need to modify the provider if you want to use something other than Oracle.

#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Set up
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
import sys

cellName = AdminConfig.list('Cell')
dsName=sys.argv[0]
userName=sys.argv[1]
password=sys.argv[2]
driverPath=sys.argv[3]
dbHost=sys.argv[4]
dbPort=sys.argv[5]
dbSid=sys.argv[6]

#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Subs
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
def createProvider():
      print "Creating JDBC Provider"
      provider = AdminTask.createJDBCProvider('[-scope Cell='+cellName+' 
        -databaseType Oracle -providerType "Oracle JDBC Driver" 
        -implementationType "XA data source" -name "Oracle JDBC Driver (XA)" -description "" 
        -classpath ['+driverPath+'] -nativePath "" ]') 
 return(provider)

def createAuthAlias():
      print "Creating Auth Alias"
      security = AdminConfig.getid('/Security:/')
      alias = ['alias', dsName+'_alias']
      userid = ['userId', userName]
      pw = ['password', password]
      jaasAttrs = [alias, userid, pw]
      aliasId = AdminConfig.create('JAASAuthData', security, jaasAttrs)
      return(aliasId)

def createDataSource(provider, aliasId):
      print "Creating DataSource"
      aliasName =  AdminConfig.showAttribute(aliasId, 'alias') 
      ds = AdminTask.createDatasource(provider, '[-name '+dsName+' -jndiName jdbc/'+dsName+' 
        -dataStoreHelperClassName   com.ibm.websphere.rsadapter.Oracle11gDataStoreHelper 
        -containerManagedPersistence true -componentManagedAuthenticationAlias 
        -xaRecoveryAuthAlias '+aliasName+' 
        -configureResourceProperties [[URL java.lang.String jdbc:oracle:thin:@'+dbHost+':'+dbPort+':'+dbSid+']]]')
      AdminConfig.create('MappingModule', ds, '[[authDataAlias '+aliasName+'] [mappingConfigAlias ""]]')

#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Main program
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
provider = createProvider()
aliasId = createAuthAlias()
createDataSource(provider, aliasId)

Friday, 16 August 2013

WebSphere SQL tracing

This is probably OTT but I've found that the following trace settings capture all SQL queries

com.ibm.ws.rsadapter.jdbc.WSJdbcPreparedStatement=all:
com.ibm.ws.oracle.*=all:
com.ibm.ws.database.*=all:
com.ibm.ws.runtime.WSThreadPool=all:
com.ibm.ws.rsadapter.dbutils.impl.*=all:
com.ibm.ws.rsadapter.jdbc.WSJdbcResultSet=all:
com.ibm.ws.rsadapter.jdbc.WSJdbcStatement=all:
com.ibm.ws.rsadapter.jdbc.WSJdbcDataSource=all:
com.ibm.ws.rsadapter.jdbc.WSJdbcDatabaseMetaData=all

Slow Lombardi Process Designer



During development time the Process Designer makes many queries to LSW_ENV_VAR.
This table is not large, however, one of the queries used by PD has a sub-query against LSW_PO_VERSIONS

This article (http://www-01.ibm.com/support/docview.wss?uid=swg21610258
) describes adding a few indexes to LSW_PO_VERSIONS and it worked a treat.

This other article (http://www-01.ibm.com/support/docview.wss?uid=swg1IC82730) was a little more involved and we didn't try it.. but worth a mention.






Thursday, 14 February 2013

Nudging stuck task in BPM 7.5 Event Manager

If you have stuck tasks in the EM async queue, setting the EM instance to null and the task status to 1 followed by a pause and resume of all EM instances will cause the other EM instance/instances to pick up the tasks. It still means the EM instance in question won't pick up further jobs as at this stage it's broken. Maybe i'll be able to work out why it breaks and how to fix it at some point, but for now this workaround will get you out of trouble.

Here's the database query you need to do this

UPDATE lsw_em_task SET task_status = 1, task_owner = null WHERE task_status = 3 AND task_owner = <the id of your EM instance>


Note1: In SQL Developer the date columns in the Lombardi tables only display the date. To display the time as well you need to run something like select to_char(scheduled_time, 'hh24:mi:ss') from lsw_em_task. (or you could always change the NLS settings in SQL Developer to ensure DATE columns display timestamps Tools > preferences > database > NLS - in the Date format field specify DD-MON-RR  HH24.MI.SS
Note2: The ID of your EM instance(s) can be found in the LSW_EM_INSTANCE table

Monday, 21 January 2013

How to trick Process Designer into connecting to a Process Server that you have not registered

There might on occasion, be the need to connect your Process Designer to a Process Server that is not registered with the Process Centre that your PD's eclipse.ini is pointing at. Let's say for example that you need to give your developers access to a Process Server for debugging purposes only but you do not want them to be able to deploy to it.

The answer is fairly straight forward, you simply insert a row in the Process Centre's LSW_SERVER and LSW_SERVER_CAPABILITY tables that relates to the said Process Server making sure that you set its IS AVAILABLE column to false. Once this is done you'll notice that the Process Centre will have a new (albeit unavailable) Process Server in it's Servers list. 

Now, when and Process Designer instances are connected to the said Process Centre, they will be able to connect to the new Process Server via the drop down list in the Process Inspector screen.

Monday, 3 December 2012

BPM v75* database set-up procedure

Implementing the BPM databases is divided into sections as follows:

Steps 1 through 3 would typically be carried out by the database administrators, steps 4 and 5 are carried out by the engineer building the BPM system.
  1. Creating the database - In Oracle, this is effectively the SID (Note: I'm assuming we'll do all this on one database - or SID - and we'll seperate everything using schemas - I've seen it done this way, bit of a pain really and I wouldn't choose this approach normally - will document the multiple database / SID approach another time)
  2. Creating the tablespaces - This is the act of creating some space on the file system (or on a raw device directly)
  3. Creating the schemas - Technically, this step is actually creating the users. In Oracle, when you create a user Oracle creates the SCHEMA object as part of the CREATE USER statement and the SCHEMA has the same name as the USER. Here's the difference for reference purposes ... USER is the account name, SCHEMA is the set of objects owned by that user.
  4. Create the tables - In this step we connect as the user created above in the Create Schema step and create all of the required tables within that schema
  5. Populate the Lombardi tables - i.e. run the bootstrap 

In order to carry out steps 2 and 3, the database admins require schema names and passwords for the following schemas:

In order to carry out steps 2 and 3, the database admins require schema names and passwords for the following schemas:
  • Common
  • Process Server / Centre - The Process Centre and the Process Server DDL's are identical - the difference is what they are populated with via the bootstrap process (and of course the WAS profile tempaltes are different)
  • Performance Data Warehouse
  • Business Space
  • Process Choreographer
  • Messaging - There are six messaging schemas for BPM 75* Advanced, one for each messaging engine - SYS, APP and BPC (for WPS), PS/PC and PDW (for Lombardi) and CEI (or the Common Event Infrastructure)






Friday, 9 November 2012

BPM Version 8 Standard Edition Databases

Version 8 Standard Edition uses 4 Databases
  1. BPMDB - The Process Centre / Process Server databases
  2. PDWDB - The Performance Data Warehouse Database
  3. BSPDB - The Business Space Database (New in version 8, Business Space used to only be part of Advanced in v 7.x)
  4. MEDB - The Messaging Engine Database (In v7.x the ME tables were schema's under PDWDB and BPMDB
For some reason the documentation states that the Common Database is needed, but as far as I can tell it's not. There are no datasources configured for it during any part of the installation.

Example DB2 commands for creating the databases are as follows:

db2 create database <Database Name> automatic storage yes  using codeset UTF-8 territory GB pagesize 32768;
db2 connect to <Database Name>;
db2 grant dbadm on database to user <user name>;
db2 UPDATE DB CFG FOR <Database Name> USING LOGFILSIZ 4096 DEFERRED;
db2 UPDATE DB CFG FOR <Database Name> USING LOGSECOND 64 DEFERRED;
db2 connect reset;

Once the databases have been created, you can create the tables and stored procedures within by using the scripts generated when you imported and generated the deployment environment:
(Note - create database scripts are provided for all but MEDB, however in most cases your DBA's will want to create the databases, apply any table space settings specific their standards (as above) and set you up with a user with rights for you to create the tables etc. (Not sure why none were provided for MEDB by the way. I guess somebody just forgot ;) )

BPMDB <dmgr profile>/dbScripts/PerformanceDW/DB2/BPMDB 
 
  • db2 connect to BPMDB 
  • db2 -tvf createTable_ProcessServer.sql
  • db2 -tvf createProcedure_ProcessServer.sql
  • db2 terminate  

PDWDB <dmgr profile>/dbScripts/PerformanceDW/DB2/PDWDB

  • db2 connect to PDWDB 
  • db2 -tvf createTable_PerformanceDW.sql
  • db2 terminate  

BSPDB <dmgr profile>/dbScripts/PerformanceDW/DB2/BSPDB

A wrapper script is provided, however I've forgotten it's name...
Will follow


MEDB

The MEDB DDL needs to be generated by the SIBDDLGenerator.sh script as follows

sibDDLGenerator [ -systemDBMS name ][ -versionDBMS version ][ -platformDBMS platform ][ -schemaschema name ][ -useruser name ][{ -create -drop }][ -databasedatabase ][ -storagegroupstorage group ][ -cataloghigh level qualifier ][ -bufferpoolbuffer pool ][ -statementendstatement end ][ -nolinebreaks ][ -noblanklines ][ -firstlinefirst line ][ -lastlinelast line ][ -permanentnumber ][ -temporarynumber ]

You'll need 2 sets of DDL, one for the Process Server ME's and one for the PDW ME's. 
I usually create a directory alongside the ones generated for the other databases (e.g. <dmgr profile>/dbScripts/PerformanceDW/DB2/MEDB) and then run the above command twice substituting the schema names each time to match the ones you specified in your Deployment Environment, and redirecting to a suitably named file each time