By Buddel
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.
Via:: Klein Oracle Denkraam