Download presentation
Presentation is loading. Please wait.
Published byMelissa MacLeod Modified over 11 years ago
1
Pennsylvania BANNER Users Group 2006 Taming the ENV Settings Robin Ying robin.ying@imperial.edurobin.ying@imperial.edu 760-355-6377 Imperial Valley College
2
2 General Announcements: Please turn off all cell phones/pagers If you must leave the session early, please do so as discreetly as possible Please avoid side conversations during the session Questions will be answered at the end of the session Thank you for your cooperation
3
3 Background Our Environment: – System was set up by consultants, lack of documentation and knowledge transfer. – Limited fiscal resources. – Users want to have their exclusive cloned databases – AR, FA, FIN, HR, STU. – Going through Version 6 to Version 7 upgrade. Why Refactoring? – Duplicated code, very difficult to maintain. – Confusing setup, hard to trace errors.
4
4 Background The Banner-Oracle Instances: – 3 parts: INB + Database + Code Tree – 2 types of cloned instances: Shared Code Tree Independent instances ProductionSTUHRTESTUPGR INB Forms banprodbantestbanpprd Code Tree Production[ HR ][ Student ]TESTUPGR Database
5
5 Refactoring Goals Allow only one place to make changes to all ENV settings – the oraenv_local. – Simplifies maintenance Making Banner-Oracle instance change a single-command effort. – Simplifies usage Easy to exam the ENV settings. – Simplifies debugging Not affecting the baseline. – Easy to carry forward
6
6 Walk through the code... 30 ############################################################# 31 # Local host settings -- modify according to installation 32 ############################################################# 33 production_host=sun2 34 oracle_production_sid=IVC 45 ORACLE_BASE=/u01/app/oracle 46 ORACLE_HOME=$ORACLE_BASE/product/9.2.0 63 [ ${ORACLE_SID:-0} = 0 ] && { 64 if [ $ask = 'y' ] 65 then 66chsid# ask for it 67 else 68ORACLE_SID=TEST;# default setting 69[ `hostname` = $production_host ] && ORACLE_SID=$oracle_production_sid; 70 fi recursion
7
7 Walk through the code... 77 ############################################################# 78 # Oracle instance settings -- this is the ONLY place defining the relationships 79 #between the Oracle instance and Banner code tree 80 ############################################################# 81 # 82 # setting the Banner code tree for the Oracle instance ( ${ORACLE_SID}_ct ) 83 # 84 instances='IVC AR320 FIN HR STU TRNG PPRD CURR TEST FA' 86 IVC_ct=banprod 87 AR320_ct=banprod 88 FIN_ct=banprod 89 HR_ct=banprod 90 STU_ct=banprod 91 TRNG_ct=banprod 93 PPRD_ct=banpprd 94 CURR_ct=bancurr 95 TEST_ct=bantest 96 FA_ct=banfa Independent code tree Shared code tree
8
8 Walk through the code... 98 $ECHO $instances | /bin/grep $ORACLE_SID > /dev/null 99 [ $? = 1 ] && { 100$ECHO "\n** Error: Invalid ORACLE_SID: $ORACLE_SID" 101$ECHO "\n** Valid values are: $instances\n" 102chsid 103 } 111 BANNER_HOME='$'${ORACLE_SID}_ct; BANNER_HOME=$BANNER_ROOT/`eval "echo $BANNER_HOME"` recursion dynamic variable dynamic rendering
9
9 Dynamic Variables Dynamic variables are constructed and rendered during execution. Basic structure: 1. There is a static variable with an assigned value. 2. A dynamic variable is constructed during the execution time whose value is to match the name of the static variable. 3. The dynamic variable is rendered during execution time with the value of the static variable.
10
10 Dynamic Variables Example: – Static variable with value: PPRD_ct=banpprd – Dynamic variable is constructed during execution time ( ${ORACLE_SID} changes according to the ENV setting): code_tree='$'${ORACLE_SID}_ct code_tree=$PPRD_ct when ORACLE_SID is set to PPRD – Dynamic variable is rendered: BANNER_HOME=/u01/sghe/`eval "echo $code_tree"` echo $code_tree produces $PPRD_ct eval $PPRD_ct produces banpprd BANNER_HOME=/u01/sghe/banpprd
11
11 Walk through the code... 174 # boenv function -- print the Banner/Oracle env settings 175 # 176 # Usage: boenv [-a] 177 # 178 function boenv { 179case "$1" in 180"") 217 typeset –fx boenv# export the boenv function
12
12 Walk through the code... 222 # Usage: chsid oracle_sid 223 # 224 function chsid { 225s= 226[ $# = 1 ] && s=$1 227 228while [ ${s:-0} = 0 ] 229do 230$ECHO "Enter ORACLE_SID=\c" 231read s 232done 233 234ORACLE_SID=$s 235export ORACLE_SID 236unset TWO_TASK 237. /usr/local/bin/oraenv_local 238_fixpath 239 } 240 typeset -fx chsid recursion
13
13 Walk through the code... 251 function _fixpath { 252p0='$'${ORACLE_SID}_ct 253p0=`eval "echo $p0"` 254 255for i in $instances 256do 257p1='$'${i}_ct; p1=`eval "echo $p1"` 258case ${PATH} in 259*${p1}*) 260PATH=`echo $PATH | sed "s%$p1%$p0%g"`;; 262*);; 264esac 265done 266 267echo $PATH | grep "$ora_path" > /dev/null 268[ $? = 1 ] && PATH=$ora_path:$PATH 269 270echo $PATH | grep "$ban_path" > /dev/null 271[ $? = 1 ] && PATH=$ban_path:$PATH 272 }
14
14 PABUG 2006
15
Pennsylvania BANNER Users Group 2006 Have a great day! Robin Ying robin.ying@imperial.edurobin.ying@imperial.edu 760-355-6377 Imperial Valley College
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.