Every now and then it is a pain to deploy mappings from the Control Center Manager, especially when you have a slow connection to your control center. Retrieving all mappings that can be deployed to a location can take some time (putting it very politely), and you can’t stop the control center from doing that. At least I have not found that possibility. Moreover sometimes you have assembled a list of mappings you want to deploy. In Excel or a plain text file. Mappings you have moved to your acceptance – or production environment and now want to deploy. You can do that using OMBPlus. And, as this is a scripting language, you can create a script to do that for all mappings you want, in one go. Unfortunately deploying is not really very straightforward in OMBPlus. So I created a tcl procedure that sort of simplifies the task. Here it is.
# File : deploy_map.tcl # Purpose: deploy MAPPING (parameter) # in each target module (parameter) # of a project (parameter) # Author : Kadenza - Eric Buddelmeijer 200908 # Prereq.: a valid repository connection is presumed here proc deploy_map {p_project p_module p_map p_cc_pwd} { OMBCC '/${p_project}' # cleanup set deplPlan [OMBLIST DEPLOYMENT_ACTION_PLANS] foreach deplAction $deplPlan { OMBDROP DEPLOYMENT_ACTION_PLAN '$deplAction' } OMBCOMMIT OMBCONNECT CONTROL_CENTER USE '${p_cc_pwd}' set moduleList [OMBLIST ORACLE_MODULES '${p_module}.*' ] foreach moduleName $moduleList { puts "--------------------- $moduleName -----------------" OMBCC '/${p_project}/$moduleName' # start of objecttype loop ------------------------------------------ # order of objecttypes is relevant!!! set typeList [list MAPPING ] set N 1 set plural "S" foreach objectType $typeList { set listType [concat $objectType$plural] set J 1 set objectList [OMBLIST $listType '${p_map}.*'] puts "... Checking ${listType}" if {[llength $objectList] > 0} { foreach objectName $objectList { set deployAction [OMBRETRIEVE $objectType \ '$objectName' GET PROPERTIES (DEPLOYABLE)] if {$deployAction == "true"} { set valid [OMBVALIDATE $objectType '$objectName'] if {$valid == "Valid." } { switch $objectType { "TABLE" {set deployAction "REPLACE"} "SEQUENCE" {set deployAction "REPLACE"} default {set deployAction "REPLACE" } } puts "...... Adding ${J}.$objectType $objectName" if {$J == 1 } { OMBCREATE TRANSIENT DEPLOYMENT_ACTION_PLAN \ 'GEN_DEPLOY_${objectType}' \ ADD ACTION 'DEPLOY_${objectName}'\ SET PROPERTIES (OPERATION) \ VALUES ('$deployAction') \ SET REFERENCE $objectType '$objectName' } else { OMBALTER DEPLOYMENT_ACTION_PLAN \ 'GEN_DEPLOY_${objectType}'\ ADD ACTION 'DEPLOY_A_${objectName}' \ SET PROPERTIES (OPERATION) \ VALUES ('$deployAction') \ SET REFERENCE $objectType '$objectName' } incr J } else { puts "###### SKIPPING $valid $objectType \ $objectName" } } else { puts "...... Skipping explicit NOT deployable \ $objectType $objectName" } } #end of objectName loop --------------------------- puts "... Deploying ${listType}" set exedeplPlan [OMBLIST DEPLOYMENT_ACTION_PLANS] foreach exedeplAction $exedeplPlan { OMBDEPLOY DEPLOYMENT_ACTION_PLAN '$exedeplAction' OMBDROP DEPLOYMENT_ACTION_PLAN '$exedeplAction' } incr N } # end of if llength objectList > 0 } # end of object type loop } # end of module loop }
And the procedure can be executed with:
deploy_map <project name> <module name> <map name> <control center password>
Which can be repeated several times of course. The procedure also tries to expand the parameters ‘module name’ and ‘map name’ using a wildcard. This means the procedure tries to expand the parameter in such a way that it is treated as ‘begins with’.
Have fun deploying.
Hi
How can we export the OMB Plus command results into a excel file.
A hint: http://articles.techrepublic.com.com/5100-10878_11-6163451.html
Format the output to xml and open it with excel, I guess this should do the trick?
You cannot export to Excel directly from OMBPlus, at least not that I know of. What you can do is use some TCL commands to open a file and write data to that file using the TCL command ‘puts’. If you separate your output into fields using an appropriate separator (e.g. ; or tab character) you can then import the file into Excel. Don’t forget to close the file after you’re done!
Here (http://www.tcl.tk/man/tcl8.0/TclCmd/contents.htm) a command-reference can be found for the version of TCL that is included in OMBPlus .
Hi!
Great script!
But I would like to modify 1 thing for personal use:
I have 8 modules but for my project we only use 4 of those modules, so I would like to have the foreach loop to go only in those 4 modules.
You do:
set moduleList [OMBLIST ORACLE_MODULES ‘${p_module}.*’ ]
This gives the module that you set as param.
I Tried:
set moduleList [OMBLIST ORACLE_MODULES ‘MODULE1 MODULE2 MODULE3’ ]
This gives:
OMB01062: Wrong number of arguments. Please see OMBHELP for instructions on command syntax. 😦
The modules each have totally different names so wildcards cannot be used..
However this seems to work for MAPPINGS…
Any idea?
Many thanks!
Thanks Wouter.
Alas it does not work for MAPPINGS either:
OMBLIST MAPPINGS ‘MAP_DIM_AIR MAP_FCT_LEG_QTY_AGM_MAN_ACT’
OMB01062: Wrong number of arguments. Please see OMBHELP for instructions on command syntax.
What you can do is ‘manually’ create a list using the tcl list command.
set modules [list MODULE1 2ELUDOM SOME_MODULE]
instead of retrieving them from the repository with OMBLIST.
Hope this helps.
You were right it didn’t work for MAPPINGS (it was using a wildcard)
The manual list does work! Very nice!
Thanks!
Hello Eric,
I don’t know exactly what you expect of OMBVALIDATE, but I was surprised it won’t trap mapping warnings if you use OMBVALIDATE the way you use it in deploy_map.tcl:
OMB+> OMBVALIDATE MAPPING ‘BLL_01_SOORT_GEVAL_I’
Valid.
But
OMB+> OMBVALIDATE MAPPING ‘BLL_01_SOORT_GEVAL_I’ OUTPUT VALIDATION_RESULT TO FIL
E ‘E:/log/BLL_01_SOORT_GEVAL_I.log’ WRITE ALL
Valid.
OMB+> head E:/log/BLL_01_SOORT_GEVAL_I.log
Status code = VALID
Name = BLL_01_SOORT_GEVAL_I
Type = MAPPING
Last validation date = 2011-11-15 11:43:49.69
Last modified date = 2011-11-15 11:43:49.69
Validation message code = Warning
Validation message text = VLD-1008: Referenced mapping column DTL_CLAIMS_TB.GEVA
LS_NR does not exist.
Validation message details = Synchronize from DTL_CLAIMS_TB.
Validation message code = Warning
Validation message text = VLD-1008: Referenced mapping column DTL_CLAIMS_TB.GEVA
LS_VOLG_NR does not exist.
OMB+>
Thank you for your script.
Regards,
Ruben van Schoonneveldt.
Hi Ruben,
I did expect it to ignore warnings. So it did what I wanted.
In many cases warnings are indeed what they are named, just warnings. Alas not all warnings can be ignored but most can be. So it was a choice between getting all warnings en loose a lot of time trying to solve them all or ignore the warnings and hope no warning is severe enough to prevent the mapping from working correctly. I chose the latter.
Regards,
Eric.
Hi Ruben,
Thanks for pointing out that OUTPUT option for OMBVALIDATE. My scripts append to a log file, and the nice thing about this OUTPUT is that it also appends, so I just send it to the same file.
Regards,
Peter Nosko