2009/06/26

TCL Script to Deploy OWB Mappings from file

This is another TCL script, which enables the developers to deploy OWB Mappings. The main function of this script is to deploy the mappings, with the list of the mappings to be deployed specified in a file.

This has been tested for OWB11g version.

puts " ******************* READ ME ********************"
puts ""
puts ""
puts " The proc owb_deploy_map_4m_file is Created"
puts " To execute the proc call the above proc name at OMB+ command prompt "
puts " DISCONNECT FROM THE DESIGN REPOSITORY BEFORE CALLING THE PROC"
puts ""
puts ""
puts " IF THIS IS THE FIRST TIME THE OBJECTS ARE BEING DEPLOYED"
puts " INTO THIS RUNTIME ENVIRONMENT"
puts " !!!!!!!!MAKE SURE THE LOCATIONS ARE REGISTERED!!!!!!!"
puts ""
puts ""
puts "**************************************************************"
puts ""
puts " This procedure reads the mappings from the file"
puts " Name & location of the file : C:/tmp/mappings_2_deploy.txt "
puts " "
puts "**************************************************************"
puts ""
puts ""
puts "Usage:"
puts "=============================================================="
puts ""
puts " owb_deploy_map_4m_file owbowner Password host port service ModuleName"
puts "=============================================================="
puts ""
puts ""
puts "**************************************************************"
#
proc owb_deploy_map_4m_file { desuser despwd host port srvc module } {
set fname [ open "c:/tmp/deploy_maps_4m_file.log" w]
puts $fname "----------------------------------------------------------"
puts $fname "Connecting to the Design Repository "
puts $fname "----------------------------------------------------------"
OMBCONNECT $desuser/$despwd@$host:$port:$srvc USE WORKSPACE 'ZZZZZ'
set projList [ OMBLIST PROJECTS '*']
foreach projName $projList {
OMBCC '$projName'
set projcon [OMBDCC]
puts $fname "current project context is $projcon"
puts $fname "CONNECTING TO RUNTIME REPOSITORY"
puts $fname "----------------------------------------------------------"
OMBCONNECT CONTROL_CENTER
#
set ModList [OMBLIST ORACLE_MODULES '$module' ]
set i 1
#
foreach ModName $ModList {
puts $fname " Working on : $ModName"
puts "$ModName"
OMBCC '$ModName'
set curcon [OMBDCC]
set mapList [OMBLIST MAPPINGS]
set j 1
#
#foreach mapName $mapList
set fhandle [open "C:/tmp/mappings_2_deploy.txt" r]
puts $fhandle
while {-1 != [gets $fhandle line]} {
set mapName $line
puts "Deploying ..........$mapName"
puts $fname " Creating Delpoyment Action Plans for :$mapName"
#
# CREATE THE DEPLOYMENT ACTIONS PLAN FOR EACH MAPPING
#

OMBCREATE TRANSIENT DEPLOYMENT_ACTION_PLAN 'DWH_DEPLOY_MAP.$mapName'
OMBALTER DEPLOYMENT_ACTION_PLAN 'DWH_DEPLOY_MAP.$mapName' ADD ACTION '$mapName.CREATE' SET PROPERTIES(OPERATION) VALUES ('REPLACE') SET REFERENCE MAPPING '$mapName'
puts $fname " Executing the Deployment Action for MAPPINGS"
#
# DEPLOY MAPPINGS
#

OMBDEPLOY DEPLOYMENT_ACTION_PLAN 'DWH_DEPLOY_MAP.$mapName'
OMBCOMMIT
#
# DROP THE DEPLOYMENT ACTIONS PLANS
#

OMBDROP DEPLOYMENT_ACTION_PLAN 'DWH_DEPLOY_MAP.$mapName'
OMBCOMMIT
incr j
}
close $fhandle
OMBCC '..'
set curcon [OMBDCC]
puts $fname "context at the end is --- $curcon"
incr i

}
OMBCOMMIT
OMBCC '/'

}
close $fname
OMBCOMMIT
OMBDISC
#
#**********************************************************************************************
# END OF PROC owb_deploy_map
#**********************************************************************************************
}

4 comments:

  1. Very useful script. Can you please provide the logic with in the store procedure owb_deploy_map_4m_file.

    Thanks!

    ReplyDelete
  2. Never mind i got it.
    Thanks!

    ReplyDelete
  3. Good to know my blog was helpful for you. Is OWB still kicking around?

    ReplyDelete

File Handling with Python

This little utility is for copying files from source to target directories.  On the way it checks whether a directory exists in the target, ...