Already a member?
Sign in
Welcome! This is a website that everyone can build together. It's easy!
Location: Oracle Warehouse Builder
Discussion: Export all OWB projects with a batch job
Keyword tags:
ksh
OMB+
Oracle Warehouse Builder
OWB export
tcl
Watch
|
htu htu |
Export all OWB projects with a batch job
Nov 21 2007, 11:41 AM EST I have developed a ksh script to run an OMB+ script to export all the projects in a OWB repository. The scripts will be posted in the end. Know limitations: - it requires single user mode to connect to the repository - it stops the export if users are still in a project 6 out of 8 found this valuable. Do you? |
|
htu htu |
RE: Export all OWB projects with a batch job
Nov 21 2007, 11:46 AM EST I do not know a way to upload a file yet. Here are the codes in chunks: run_ombplus part 1 of 4 ---------------------------------- #!/bin/ksh # Purpose: run OWB OMB+ seamlessly # History: # 06/27/2007 (htu) - initial coding # # The following environmental variables are set trap 'exit' 1 2 3 # for script tracing case $ORACLE_TRACE in T) set -x ;; esac # Set path if path not set (if called from /etc/rc) case $PATH in "") PATH=/bin:/usr/bin:/etc export PATH ;; esac # Save LD_LIBRARY_PATH SAVE_LLP=$LD_LIBRARY_PATH USAGE() { echo " USAGE $0 [-c <cmd>] [-v] <action> action: run - to run OMB TCL programs start - to start OMB+ stop - status - e.g. $0 -c \"\`which OMBPlus.sh\` -v\" $0 -c \"`which OMBPlus.sh` -v\" " } Do you find this valuable? |
|
htu htu |
RE: Export all OWB projects with a batch job
Nov 21 2007, 11:50 AM EST run_ombplus part 2 of 5 ---------------------------------- # this is the part that you need to change to your Oracle home # and OMB+ folders initVars() { hn=`/usr/bin/hostname` # database paramters PRGNAME=`basename $0` ORATAB=/var/opt/oracle/oratab; export ORATAB if [ $hn = "ors2ws" ]; then ORACLE_BASE=/opt/ora IMP_TCL=/opt/www/sqls/omb/exp_prjs_owbprod.tcl else ORACLE_BASE=/opt/app/oracle IMP_TCL=/opt/www/sqls/omb/owb1_exp_prjs.tcl fi IMP_TCL=/opt/www/sqls/omb/exp_prjs.tcl if [ ! -d $ORACLE_BASE ]; then echo "ERR: Could not find $ORACLE_BASE" exit 1 fi export ORACLE_BASE ORACLE_HOME_LISTNER=$ORACLE_BASE/product/10.2.0/db_1; export ORACLE_HOME_LISTNER # log parameters # LOGMSG="logger -puser.alert -s " LOGMSG="logger -puser.alert " ORADIR=/export/home/oracle ORALOG=$ORADIR/logs LOGDIR=/opt/www/logs LogBrief=$LOGDIR/run_ombplus_brief.log LogDetail=$LOGDIR/$hn/${hn}_run_omb`date +%Y%m%d`.log # oracle programs ORAPRG=$ORADIR/scripts EM=$ORACLE_HOME_LISTNER/bin/emctl OPMN=$ORACLE_HOME_LISTNER/opmn/bin/opmnctl ISQL=$ORACLE_HOME_LISTNER/bin/isqlplusctl # OMB+ OMBDIR=$ORACLE_BASE/product/10.2.0/wb_1/owb/bin/unix OMB=$ORACLE_BASE/product/10.2.0/wb_1/owb/bin/unix/OMBPlus.sh TGTDIR=/opt/ora/ufd/owb1/mdls # misc parameters VBM=N StartTime=`date +"%Y%m%d.%H%M%S"` USER=`/usr/ucb/whoami` HN=`hostname` } Do you find this valuable? |
|
htu htu |
RE: Export all OWB projects with a batch job
Nov 21 2007, 11:51 AM EST run_ombplus part 3 of 5 ---------------------------------- pre_check() { # check oracle scripts msg="\n\n+++++ Start: $USER on $HN at $StartTime +++++" echo_msg; if [ $sid = "oratab" -a ! -f $ORATAB ]; then msg="ERR: could not find $ORATAB"; echo_msg msg="exit $act"; echo_msg; exit 1 fi fn="$OMB $EM $OPMN $ORATAB $ISQL" for f in $fn; do if [ ! -f $f ]; then msg="WARN: could not find $f"; echo_msg fi done } run_all() { msg=" --- run all for $sid"; echo_msg dt1=`date +"%Y%m%d_%H%M%S"` log=$TGTDIR/omb_$dt1.log cmd="$OMB $IMP_TCL $log" msg="CMD: $cmd"; echo_msg cd $OMBDIR ./OMBPlus.sh $IMP_TCL $log } start_all() { msg=" --- start OMBPlus ... for $sid"; echo_msg cd $OMBDIR ./OMBPlus.sh } stop_all() { msg=" - stop all for $sid"; echo_msg msg="\nCMD: $ISQL stop"; echo_msg } status_all() { msg=" - check status for $sid"; echo_msg lsnr_act status } post_check() { # write status doExitLogs() msg="+++++ End: $USER on $HN at $EndTime +++++" } Do you find this valuable? |
|
htu htu |
RE: Export all OWB projects with a batch job
Nov 21 2007, 11:53 AM EST run_ombplus part 4 of 5 ---------------------------------- echo_msg() { # notes: # msg|msg1 for echoing to screen # msg|msg2 for echoing to detail log # msg3 for echoing to brief log if test "$VBM" = "Y"; then if test "$msg1"; then echo "$msg1" else if test "$msg"; then echo "$msg"; fi fi fi # echo to detail log if test "$msg2"; then echo "$msg2" >> $LogDetail else if test "$msg"; then echo "$msg" >> $LogDetail fi fi # echo to brief log if test -n "$LogBrief" -a ! -f "$LogBrief"; then tmp="# File name: $LogBrief\n# Generated by $0" tmp="$tmp\n# Fields: (elapsed times are in seconds)" tmp="$tmp\n# StartTime|EndTime|TotalTime" tmp="$tmp|FtpTime|Bytes|User|Arguments|Result\n#" echo "$tmp" > $LogBrief fi if test "$msg3"; then echo "$msg3" >> $LogBrief fi # reset variables msg1=""; msg2=""; msg3=""; msg=""; tmp="" } Do you find this valuable? |
|
htu htu |
RE: Export all OWB projects with a batch job
Nov 21 2007, 11:54 AM EST run_ombplus part 5 of 5 ---------------------------------- doExitLogs() { msg=" - Doing exit logs ..."; echoMSG # if test -d $LOCKDIR; then # rm -r $LOCKDIR || { echo "\nUnable to unlock $LOCKDIR!\n"; } # fi EndTime=`date +"%Y%m%d.%H%M%S"` # td=`$DFgtd $dt1 $dt2` # ftp time # ElapsedTime=`$DFgtd $StartTime $EndTime` # total time td='-' ElapsedTime='-' dt=`date +"%m/%d/%y %H:%M:%S"` end_msg="Interrupted" msg1="\n$end_msg by user\n" msg2="#END $StartTime $end_msg" msg3="$StartTime|$EndTime|$ElapsedTime|$td|$m|$USER|$AllArgs" msg3="$msg3|$end_msg" msg1="$msg1\n$msg3" echo_msg # exit 1 } # # Main program # if [ $# -eq 0 ]; then USAGE; exit; fi AllArgs="$*" # reserve the inputs initVars; StartTime=`/bin/date +"%Y%m%d.%H%M%S"` while getopts c:v c; do case $c in c) CMD=$OPTARG;; v) VBM=Y;; ?) USAGE; exit 2;; esac done shift `expr $OPTIND - 1` act=$1 # action: status, start, stop sid=$2 # sid: oracle database alias if [ "$sid" = "" ]; then sid=oratab; fi # default to 'oratab' pre_check case $act in setenv) set_env $sid;; status) status_all ;; stop) stop_all ;; start) start_all ;; run) run_all ;; *) echo "Nothing to do for $act!"; exit;; esac post_check 1 out of 1 found this valuable. Do you? |
|
htu htu |
RE: Export all OWB projects with a batch job
Nov 21 2007, 12:09 PM EST The two scripts were uploaded as attachments: ksh - run_ombplus tcl - owb_exp_prjs.tcl 2 out of 2 found this valuable. Do you? |

