# TGoi.cfg: Manages Oracle Instance Home Target Definitions # # $Id: TGoi.cfg,v 1.4 2013/10/30 07:18:47 RDA Exp $ # ARCS: $Header: /home/cvs/cvs/RDA_8/src/scripting/lib/collect/RDA/TGoi.cfg,v 1.4 2013/10/30 07:18:47 RDA Exp $ # # Copyright (c) 2002, 2016, Oracle and/or its affiliates. All rights reserved. # # Change History # 20130821 KRA Change ORACLE_HOME extraction. #------------------------------------------------------------------------------ # Module definition #------------------------------------------------------------------------------ dsc='Manages Oracle Instance Home Target Definitions' var=select_command exe=sdcl { "macro is_unique "{var ($cur,$ttl) = @arg " " loop $itm ($[COL]->get_items('OI')) " {if and(compare('eq',$ttl,$itm->get_first('T_TITLE')),\ " compare('ne',$cur,$itm->get_path)) " return false " } " return true "} } #------------------------------------------------------------------------------ # Setting definitions #------------------------------------------------------------------------------ [select_command] typ=T dft=${W_ADMIN_COMMAND} dsc='Select the administration action' nam=- var=define:do_define:\ edit: do_edit:\ select:do_select #------------------------------------------------------------------------------ # Define an Oracle instance home target #------------------------------------------------------------------------------ [do_define] typ=B dft=${T_ADMIN_VALUE} nam=- var=true:W_CLASS,B_DEDICATED,D_ORACLE_INSTANCE exe=sdcl { "var $cnt = undef } [W_CLASS] typ=T def=${T_ADMIN_VALUE} dft='OI' dsc='Target type' [B_DEDICATED] typ=B def=${T_ADMIN_VALUE} dft=${RUN.CLASS.OI.B_DEDICATED} dsc='Is it a dedicated target?' opt=true [D_ORACLE_INSTANCE] typ=D def=${T_ADMIN_VALUE} dft=(${RUN.CLASS.OI.D_ORACLE_INSTANCE/v},\ ${CTX.D_ORACLE_INSTANCE/v:${ENV.ORACLE_INSTANCE}}) dsc='Oracle instance home' err='Warning: The specified directory does not -yet- exist' inp='Enter the Oracle instance home' raw=true val=W var=exists:T_TITLE,T_OI_ABBR,set_oracle_home,set_ccr_config:\ T_TITLE,T_OI_ABBR [T_TITLE] typ=T def=${T_ADMIN_VALUE} dft=${RUN.CLASS.OI.T_TITLE:"Instance home ${D_ORACLE_INSTANCE/v}"} dsc='Oracle instance home target description' err='Duplicate description' inp='Enter the Oracle instance home target description' ref=is_unique(${CUR.K_MODULE},last) val=E [T_OI_ABBR] typ=T def=${T_ADMIN_VALUE} dft=${RUN.CLASS.OI.T_OI_ABBR:${CTX.T_OI_ABBR}} dsc='Target abbreviation to use' opt=true [set_oracle_home] typ=I cls='OH' def=${T_ADMIN_VALUE} dsc='Target of the associated Oracle home' nam=I_ORACLE_HOME vis=false exe=sdcl { "macro get_target "{if !?testDir('d',$hom = catDir($arg[0])) " return undef " return nvl(findItem('OH','D_ORACLE_HOME',$hom,true),\ " defineTarget('OH',{'D_ORACLE_HOME'=>$hom,\ " 'T_ORACLE_HOME'=>$hom,\ " 'T_TITLE'=>"Oracle home ${VAR.hom}"})) "} " "macro get_home "{if ?testFile('f',catFile(${D_ORACLE_INSTANCE},'bin',${AS.BAT:'setEnv'})) " {if match($fil = lastFile(),'\.bat$',true) " {if grepFile($fil,'^\s*set\s+EPM_ORACLE_HOME\s*=','fi') " return get_target(value(last)) " } " else " {if grepFile($fil,'^[^\043]*\bEPM_ORACLE_HOME=([\042\047])(.*?)\1','f2') " return get_target(last) " if grepFile($fil,'^[^\043]*\bEPM_ORACLE_HOME=(\S+)','f1') " return get_target(last) " } " } " if ?testFile('f',catFile(${D_ORACLE_INSTANCE},'bin',${AS.BATCH:'opmnctl'})) " {if match($fil = lastFile(),'\.bat',true) " {if grepFile($fil,'^\s*set\s+ORACLE_HOME\s*=','i',-1) " return get_target(value(last)) " } " else " {if grepFile($fil,'^\s*\$OracleHome\s*=\s*([\042\047])(.*?)\1','2',-1) " return get_target(last) " } " } " return undef "} " "var ${AUX.dft} = get_home() } [set_ccr_config] typ=T def=${T_ADMIN_VALUE} dsc='Oracle Configuration Manager configuration status' nam=S_CCR_CONFIG var=done:D_CCR_HOME,set_ccr_run exe=sdcl { "var $ccr = catDir(${D_ORACLE_INSTANCE},'ccr') "var $sta = 'skip' "if !grepDir($ccr,'^\.+$','v') "{if ?${S_CCR_SETUP/P} " var $sta = 'pending' "} "elsif grepFile(catFile($ccr,'config','emCCRenv'),\ " '^\s*ORACLE_CONFIG_HOME\s*=','f') " var ($sta,${W_CCR_CONFIG}) = ('done') "var ${AUX.dft} = $sta } [D_CCR_HOME] typ=D def=${T_ADMIN_VALUE} dft=getNativePath(catDir(${D_ORACLE_INSTANCE},'ccr')) dsc='Oracle Configuration Manager home' [set_ccr_run] typ=T def=${T_ADMIN_VALUE} dsc='Oracle Configuration Manager execution status' nam=S_CCR_RUN exe=sdcl { "if grepFile(catFile(${D_CCR_HOME},'config','emCCRenv'),\ " '^\s*ORACLE_CONFIG_HOME\s*=','f') " var (${AUX.dft},${D_CCR_CONFIG:'Oracle Configuration Manager data'}) = \ " ('done',getNativePath(value(last))) "else " var (${AUX.dft},${D_CCR_CONFIG}) = ('skip') } #------------------------------------------------------------------------------ # Edit an Oracle instance home target #------------------------------------------------------------------------------ [do_edit] typ=M add=('R|Return to the previous menu|-|-') aft='\040' bef='Edit an Oracle instance home target:' cas=false dft=(@{T_ADMIN_VALUE}) dsc='Edit an Oracle instance home target' err='Invalid entry' inp='Enter the item number or the action letter.' nam=-T_ADMIN_VALUE val=E var=-::do_define exe=sdcl { "# Get the target list "if !?$cnt "{keep $cnt,@itm,@rsp " var ($cnt,@itm,@rsp) = (0) " loop $itm ($[COL]->get_items('OI')) " {var $pth = concat('COL/',$itm->get_path) " call push(@itm,incr($cnt),$itm->get_first('T_TITLE',$pth)) " call push(@rsp,$cnt,$pth) " } "} " "# Determine the menu items and responses "var ${AUX.itm} = [@itm] "var ${AUX.rsp} = [@rsp] } #------------------------------------------------------------------------------ # Select an Oracle instance home target #------------------------------------------------------------------------------ [do_select] typ=M aft='\040' alt=add_target,do_define,do_select ask=true cas=false dft=(@{T_ADMIN_VALUE}) dsc='Select an Oracle instance home target' nam=-T_ADMIN_VALUE val=E var=+:add_target,do_define,do_select:\ -:do_edit,do_select:\ *:all_targets:\ .:no_targets exe=sdcl { "# Get the target list "if !?$cnt "{keep $cnt,@add,@all,@itm,@mnu,@rsp " " var ($cnt,@all,@itm,@mnu,@rsp) = (0) " if ${B_ADMIN_END} " {loop $itm ($[COL]->get_items('OI')) " {next $itm->get_first('B_DEDICATED') " var $pth = concat('COL/',$itm->get_path) " call push(@itm,incr($cnt),$itm->get_first('T_TITLE',$pth)) " call push(@rsp,$cnt,$pth) " call push(@all,$pth) " call push(@mnu,$cnt) " } " } " else " {loop $itm ($[COL]->get_items('OI')) " {var $pth = concat('COL/',$itm->get_path) " call push(@itm,incr($cnt),$itm->get_first('T_TITLE',$pth)) " call push(@rsp,$cnt,$pth) " next $itm->get_first('B_DEDICATED') " call push(@mnu,$cnt) " } " } "} " "# Determine the menu items and responses "var @add = ('D|Define a new Oracle instance home target|+|-') "if $cnt " call push(@add,'E|Edit an Oracle instance home target|-|-') "if ${B_ADMIN_END} "{if $cnt " call unshift(@add,'A|All Oracle instance home targets|*|-') " call push(@add,'N|No Oracle instance home targets|.|-') " var ${AUX.bef} = ${T_ADMIN_BEFORE:\ " 'Select an Oracle instance home target list:'} " var ${AUX.opt} = false " var ${AUX.pck} = true "} "else "{var ${AUX.bef} = ${T_ADMIN_BEFORE:'Select an Oracle instance home target:'} " var ${AUX.err} = 'Invalid entry' " var ${AUX.inp} = 'Enter the item number or the action letter.' " var ${AUX.opt} = cond($cnt,false,true) "} "var ${AUX.add} = [@add] "var ${AUX.itm} = [@itm] "var ${AUX.rsp} = [@rsp] } [add_target] typ=T dft="COL/${NXT.OI:${K_ADMIN_PARENT}}" dsc='Determine the identifier for a new target' nam=-T_ADMIN_VALUE [all_targets] typ=T dft=(@all) dsc='Select all targets' end='' nam=-T_ADMIN_VALUE [no_targets] typ=T dft=() dsc='Select no targets' end='' nam=-T_ADMIN_VALUE