Thursday, February 4, 2021

Maximo DBC - Database Configuration Scripts

What is DBC ?   
Database Configuration Scripts (DBCs) are xml-formatted instructions for making changes to Maximo Database using updatedb command. 

What can we do using DBC ?
We can perform Maximo changes related to Database configuration application, security options, application or UI, domains, menus, system properties, MAXVARS and loading .sql files using DBC. It is one way of deploying our changes to a Maximo Environment.

How to create DBCs for your project ? 
i) Create a new product xml file in <MaximoInstalledFolder>/applications/maximo/properties/product/ to store information about your enhancement
ii) Create a scripts directory in <MaximoInstalledFolder>/tools/maximo/en to place dbc files
iii) Each dbc script should be numbered sequentially. DBC file extensions - .mxs (application screen changes), .msg (maxmessages), .sql (file with sql scripts) & .dbc
iv) DBCs can be created manually by referring to existing dbcs in folders (tools/maximo/en), or, by ScriptBuilder.bat (tools/maximo/internal) or mxdiff.bat for .mxs file or geninsertdbc.bat
v) During the development phase, update product xml with information about your script
vi) This information is used by the “updatedb” command to determine from which dbc to run

Where to add DBCs ? 

  • Scripts are sequential. They start with name V followed by values in major,minor. modlevel & patch fields in product XML followed by underscore ( _ ), a sequential number and ending with extension (dbc/sql/mxs/msg)
  • First script in every new version is numbered as 01. for example, V7611_01.dbc
  • After the DBCs are added in scripts folder and product.xml is updated with latest script number in <dbmaxvarname> tag, run updatedb command
  • The dbcs for our customization should be placed in the folder   <MaximoInstalledFolder>/tools/maximo/en/<folder in dbscripts tag>/ , for example, C:/IBM/SMP/maximo/tools/maximo/en/myproject


Product XML
  • Uniquely named XML file in "applications/maximo/properties/product" directory
  • <dbmaxvarname> is MAXVAR id that will be created to store last script number for our development
  • <dbscripts> is the folder name located in tools\maximo\en
  • <dbversion> - specifies the most recent script in the scripts folder
  • <lastdbversion> - specifies the last committed dbc
  • Script version in product.xml file has dash (-), but file system has  ( _ ) underscore (V7611_00.dbc) with an extension  



updatedb process
  • Updatedb tool is present in tools\maximo folder
  • Maximo servers should be stopped when you run updatedb
  • updatedb command will fail, if there is a gap in sequential numbering of scripts. To fix it, we can add empty script files to fill the gap
  • Addition of new scripts to product directory need to be followed by update of dbversion element in product XML file to match the most recent script number
  • After running updatedb, last processed script will be shown in Maximo System Information. We need to build ear to include custom product.xml to view them in Maximo System Information.


Testing DBCs
runscriptfile command is present in "tools\maximo\internal" folder
runscriptfile.bat –c<foldername> –f<filename>
runscriptfile.bat –cmyproject –fV7611_01
   <foldername> is where the scripts are stored in. It is optional parameter. if -c is not specified, Maximo will look for dbc file in this default folder tools\maximo\en\script
   <filename> – dbc file name without any extension



Pros and Cons
  • Database independent way of making changes to Maximo irrespective of type of database (Oracle, DB2 & Microsoft SQL Server)
  • Lesser Development time
  • Need system downtime for deployment
Best Practices
  • Group structural changes together in the same script
  • Update the version and build date with each release
  • Don’t modify a script after it is released to a customer

References: