<!-- $Id: A300AS0904_aix.xml,v 1.13 2007/11/21 16:24:37 mschenke Exp $ -->
<!-- ARCS: $Header: /home/cvs/repository/RDA_4/src/scripting/lib/hcve/A300AS0904_aix.xml,v 1.13 2007/11/21 16:24:37 mschenke Exp $ -->
<!--  Change History: 20071114  KRA  Modify documentation -->
<hcve name="Oracle Application Server 10g (9.0.4) PreInstall (AIX)" type="A" product="AS0904" platform="aix">
<rule condition="==" id="1" maximum="N" minimum="Certified" mode="VERIFY" name="Processor Type" repeat="1" command_type="RDA">
<command><![CDATA[call setHcveResult(cond(\
  not(testFile('x','/usr/bin/getconf')),\
    'Cannot access /usr/bin/getconf',\
  grepCommand('/usr/bin/getconf HARDWARE_BITMODE','^64$','f'),\
    'Certified',\
    'Need 64-bit'))
]]></command>
<description><![CDATA[This rule checks for the processor type. The processor must be AIX Common Hardware Reference Platform processors (64-bit).]]></description>
<action type="negative" syntax="wiki"><![CDATA[The processor must be AIX Common Hardware Reference Platform processor (64-bit).
|*Return Value*|*Action*|
|Need 64-bit|Use a certified processor type.|
|Cannot access /usr/bin/getconf|Grant execute permission on /usr/bin/getconf to the current user.|]]></action>
<action type="positive"><![CDATA[The processor is certified.]]></action>
</rule>
<rule condition="==" id="2" maximum="N" mode="RECORD" name="Memory" repeat="1" command_type="RDA">
<command><![CDATA[var $MEM = undef
call setHcveVariable('$MEM')
if !testFile('x','/usr/sbin/lsattr')
 return setHcveResult('Cannot access /usr/sbin/lsattr')
var $MEM = expr('/',field('\s+',1,\
 grepCommand('/usr/sbin/lsattr -E -l sys0 -a realmem','.','f')),1024)
call setHcveResult(concat($MEM,' MB'))
]]></command>
<description><![CDATA[This rule retrieves the available physical memory in MB.]]></description>
<action type="negative" syntax="wiki"><![CDATA[|*Return Value*|*Action*|
|Cannot access /usr/sbin/lsattr|Grant execute permission on /usr/sbin/lsattr /usr/sbin/lsattr to the current user.|]]></action>
<action type="positive"><![CDATA[NA]]></action>
</rule>
<rule condition="==" id="3" maximum="N" minimum="Available" mode="VERIFY" name="Memory for MDR and OIM" repeat="1" command_type="RDA">
<command><![CDATA[import $MEM
call setHcveResult(cond(\
  not(defined($MEM)),   'Cannot access /usr/sbin/lsattr',\
  expr('>=',$MEM,1000), 'Available',\
                        'Need at least 1 GB'))
]]></command>
<description><![CDATA[This rule checks that the machine has enough memory to install the Metadata Repository and Oracle Identity Management install type. The minimum requirement is 1 GB.]]></description>
<action type="negative" syntax="wiki"><![CDATA[|*Return Value*|*Action*|
|Need at least 1 GB|Increase the memory to 1 GB or more to install the Metadata Repository and Oracle Identity Management install type.|
|Cannot access /usr/sbin/lsattr|Grant execute permission on /usr/sbin/lsattr to the current user.|]]></action>
<action type="positive"><![CDATA[The machine has enough memory to install the Metadata Repository and Oracle Identity Management install type.]]></action>
</rule>
<rule condition="==" id="4" maximum="N" minimum="Available" mode="VERIFY" name="Memory for OIM Only" repeat="1" command_type="RDA">
<command><![CDATA[import $MEM
call setHcveResult(cond(\
  not(defined($MEM)),  'Cannot access /usr/sbin/lsattr',\
  expr('>=',$MEM,512), 'Available',\
                       'Need at least 512 MB'))
]]></command>
<description><![CDATA[This rule checks that the machine has enough memory to install the Oracle Identity Management only install type. The minimum requirement is 512 MB.]]></description>
<action type="negative" syntax="wiki"><![CDATA[|*Return Value*|*Action*|
|Need at least 512 MB|Increase the memory to 512 MB or more to install the Oracle Identity Management only install type.|
|Cannot access /usr/sbin/lsattr|Grant execute permission on /usr/sbin/lsattr to the current user.|]]></action>
<action type="positive"><![CDATA[The machine has enough memory to install the Oracle Identity Management only install type.]]></action>
</rule>
<rule condition="==" id="5" maximum="N" minimum="Available" mode="VERIFY" name="Memory for MDR Only" repeat="1" command_type="RDA">
<command><![CDATA[import $MEM
call setHcveResult(cond(\
  not(defined($MEM)),  'Cannot access /usr/sbin/lsattr',\
  expr('>=',$MEM,750), 'Available',\
                       'Need at least 750 MB'))
]]></command>
<description><![CDATA[This rule checks that the machine has enough memory to install the Metadata Repository only install type. The minimum requirement is 750 MB.]]></description>
<action type="negative" syntax="wiki"><![CDATA[|*Return Value*|*Action*|
|Need at least 750 MB|Increase the memory to 750 MB or more to install the Metadata Repository only install type.|
|Cannot access /usr/sbin/lsattr|Grant execute permission on /usr/sbin/lsattr to the current user.|]]></action>
<action type="positive"><![CDATA[The machine has enough memory to install the Metadata Repository only install type.]]></action>
</rule>
<rule condition="==" id="6" maximum="N" minimum="Available" mode="VERIFY" name="Memory for J2EE" repeat="1" command_type="RDA">
<command><![CDATA[import $MEM
call setHcveResult(cond(\
  not(defined($MEM)),  'Cannot access /usr/sbin/lsattr',\
  expr('>=',$MEM,512), 'Available',\
                       'Need at least 512 MB'))
]]></command>
<description><![CDATA[This rule checks that the machine has enough memory to install the J2EE and Web Cache install type. The minimum requirement is 512 MB.]]></description>
<action type="negative" syntax="wiki"><![CDATA[|*Return Value*|*Action*|
|Need at least 512 MB|Increase the memory to 512 MB or more to install the J2EE and Web Cache install type.|
|Cannot access /usr/sbin/lsattr|Grant execute permission on /usr/sbin/lsattr to the current user.|]]></action>
<action type="positive"><![CDATA[The machine has enough memory to install the J2EE and Web Cache install type.]]></action>
</rule>
<rule condition="==" id="7" maximum="N" minimum="Available" mode="VERIFY" name="Memory for Portal" repeat="1" command_type="RDA">
<command><![CDATA[import $MEM
call setHcveResult(cond(\
  not(defined($MEM)),   'Cannot access /usr/sbin/lsattr',\
  expr('>=',$MEM,1000), 'Available',\
                        'Need at least 1 GB'))
]]></command>
<description><![CDATA[This rule checks that the machine has enough memory to install the Portal and Wireless install type. The minimum requirement is 1 GB.]]></description>
<action type="negative" syntax="wiki"><![CDATA[|*Return Value*|*Action*|
|Need at least 1 GB|Increase the memory to 1 GB or more to install the Portal and Wireless install type.|
|Cannot access /usr/sbin/lsattr|Grant execute permission on /usr/sbin/lsattr to the current user.|]]></action>
<action type="positive"><![CDATA[The machine has enough memory to install the Portal and Wireless install type.]]></action>
</rule>
<rule condition="==" id="8" maximum="N" minimum="Available" mode="VERIFY" name="Memory for BI and Forms" repeat="1" command_type="RDA">
<command><![CDATA[import $MEM
call setHcveResult(cond(\
  not(defined($MEM)),   'Cannot access /usr/sbin/lsattr',\
  expr('>=',$MEM,1000), 'Available',\
                        'Need at least 1 GB'))
]]></command>
<description><![CDATA[This rule checks that the machine has enough memory to install the Business Intelligence and Forms install type. The minimum requirement is 1 GB.]]></description>
<action type="negative" syntax="wiki"><![CDATA[|*Return Value*|*Action*|
|Need at least 1 GB|Increase the memory to 1 GB or more to install the Business Intelligence and Forms install type.|
|Cannot access /usr/sbin/lsattr|Grant execute permission on /usr/sbin/lsattr to the current user.|]]></action>
<action type="positive"><![CDATA[The machine has enough memory to install the Business Intelligence and Forms install type.]]></action>
</rule>
<rule condition="==" id="9" maximum="N" mode="RECORD" name="Space" repeat="1" command_type="RDA">
<command><![CDATA[var $ORACLE_HOME = getEnv('ORACLE_HOME')
var $DF = cond(\
  not($ORACLE_HOME),              'ORACLE_HOME is not set',\
  not(testDir('d',$ORACLE_HOME)), 'Cannot access ORACLE_HOME',\
                                  get_df($ORACLE_HOME))
call setHcveVariable('$DF')
call setHcveResult(cond(isNumber($DF),concat($DF,' KB'),$DF))
]]></command>
<description><![CDATA[This rule retrieves the available disk space.]]></description>
<action type="negative" syntax="wiki"><![CDATA[|*Return Value*|*Action*|
|ORACLE_HOME is not set|Set ORACLE_HOME environment variable.|
|Cannot access ORACLE_HOME|Set ORACLE_HOME to a valid directory.|]]></action>
<action type="positive"><![CDATA[NA]]></action>
</rule>
<rule condition="==" id="10" maximum="N" minimum="Available" mode="VERIFY" name="Space for Infra" repeat="1" command_type="RDA">
<command><![CDATA[import $DF
call setHcveResult(cond(\
  not(isNumber($DF)),     $DF,\
  expr('>=',$DF,4400000), 'Available',\
                          'Need at least 4.4 GB'))
]]></command>
<description><![CDATA[This rule checks that the machine has enough disk space to install the Infrastructure install type. The minimum requirement is 4.4 GB.]]></description>
<action type="negative" syntax="wiki"><![CDATA[|*Return Value*|*Action*|
|Need at least 4.4 GB|Increase the available space to 4.4 GB or more to install the Infrastructure install type.|
|ORACLE_HOME is not set|Set the ORACLE_HOME environment variable.|
|Cannot access ORACLE_HOME|Set ORACLE_HOME to a valid directory.|]]></action>
<action type="positive"><![CDATA[The machine has enough disk space to install the Infrastructure install type.]]></action>
</rule>
<rule condition="==" id="11" maximum="N" minimum="Available" mode="VERIFY" name="Space for J2EE" repeat="1" command_type="RDA">
<command><![CDATA[import $DF
call setHcveResult(cond(\
  not(isNumber($DF)),     $DF,\
  expr('>=',$DF,1400000), 'Available',\
                          'Need at least 1.4 GB'))
]]></command>
<description><![CDATA[This rule checks that the machine has enough disk space to install the J2EE and Web Cache install type. The minimum requirement is 1.4 GB.]]></description>
<action type="negative" syntax="wiki"><![CDATA[|*Return Value*|*Action*|
|Need at least 1.4 GB|Increase the available space to 1.4 GB or more to install the J2EE and Web Cache install type.|
|ORACLE_HOME is not set|Set the ORACLE_HOME environment variable.|
|Cannot access ORACLE_HOME|Set ORACLE_HOME to a valid directory.|]]></action>
<action type="positive"><![CDATA[The machine has enough disk space to install the J2EE and Web Cache install type.]]></action>
</rule>
<rule condition="==" id="12" maximum="N" minimum="Available" mode="VERIFY" name="Space for Portal" repeat="1" command_type="RDA">
<command><![CDATA[import $DF
call setHcveResult(cond(\
  not(isNumber($DF)),     $DF,\
  expr('>=',$DF,2300000), 'Available',\
                          'Need at least 2.3 GB'))
]]></command>
<description><![CDATA[This rule checks that the machine has enough disk space to install the Portal and Wireless install type. The minimum requirement is 2.3 GB.]]></description>
<action type="negative" syntax="wiki"><![CDATA[|*Return Value*|*Action*|
|Need at least 2.3 GB|Increase the available space to 2.3 GB or more to install the Portal and Wireless install type.|
|ORACLE_HOME is not set|Set the ORACLE_HOME environment variable.|
|Cannot access ORACLE_HOME|Set ORACLE_HOME to a valid directory.|]]></action>
<action type="positive"><![CDATA[The machine has enough disk space to install the Portal and Wireless install type.]]></action>
</rule>
<rule condition="==" id="13" maximum="N" minimum="Available" mode="VERIFY" name="Space for BI and Forms" repeat="1" command_type="RDA">
<command><![CDATA[import $DF
call setHcveResult(cond(\
  not(isNumber($DF)),     $DF,\
  expr('>=',$DF,3300000), 'Available',\
                          'Need at least 3.3 GB'))
]]></command>
<description><![CDATA[This rule checks that the machine has enough disk space to install the Business Intelligence and Forms install type. The minimum requirement is 3.3 GB.]]></description>
<action type="negative" syntax="wiki"><![CDATA[|*Return Value*|*Action*|
|Need at least 3.3 GB|Increase the available space to 3.3 GB or more to install the Business Intelligence and Forms install type.|
|ORACLE_HOME is not set|Set the ORACLE_HOME environment variable.|
|Cannot access ORACLE_HOME|Set ORACLE_HOME to a valid directory.|]]></action>
<action type="positive"><![CDATA[The machine has enough disk space to install the Business Intelligence and Forms install type.]]></action>
</rule>
<rule condition="==" id="14" maximum="N" minimum="Available" mode="VERIFY" name="Space for Developer Kit" repeat="1" command_type="RDA">
<command><![CDATA[import $DF
call setHcveResult(cond(\
  not(isNumber($DF)),     $DF,\
  expr('>=',$DF,1500000), 'Available',\
                          'Need at least 1.5 GB'))
]]></command>
<description><![CDATA[This rule checks that the machine has enough disk space to install the Developer Kit install type. The minimum requirement is 1.5 GB.]]></description>
<action type="negative" syntax="wiki"><![CDATA[|*Return Value*|*Action*|
|Need at least 1.5 GB|Increase the available space to 1.5 GB or more to install the Developer Kit install type.|
|ORACLE_HOME is not set|Set the ORACLE_HOME environment variable.|
|Cannot access ORACLE_HOME|Set ORACLE_HOME to a valid directory.|]]></action>
<action type="positive"><![CDATA[The machine has enough disk space to install the Developer Kit install type.]]></action>
</rule>
<rule condition="==" id="15" maximum="N" minimum="Available" mode="VERIFY" name="Space in tmp" repeat="1" command_type="RDA">
<command><![CDATA[var $TMP = nvl(getEnv('TMP'),getEnv('TMPDIR'),'/tmp')
call setHcveResult(cond(\
  not(testDir('d',$TMP)),         'Cannot access tmp directory',\
  expr('>=',get_df($TMP),400000), 'Available',\
                                  'Need at least 400 MB'))
]]></command>
<description><![CDATA[This rule checks that the machine has enough tmp space. Oracle Universal Installer (OUI) initially checks the TMP and TMPDIR environment variables to locate the temporary directory. If these environment variables do not exist, then OUI uses /tmp. The minimum requirement is 400 MB.]]></description>
<action type="negative" syntax="wiki"><![CDATA[|*Return Value*|*Action*|
|Need at least 400 MB|Increase the available tmp space to 400 MB or more. You can define TMP or TMPDIR to point to a directory with 150 MB of available space.|
|Cannot access tmp directory|Grant read and write permission on /tmp or directories in TMP or TMPDIR to the current user.|]]></action>
<action type="positive"><![CDATA[The machine has enough tmp space.]]></action>
</rule>
<rule condition="==" id="16" maximum="N" minimum="Available" mode="VERIFY" name="Swap Space" repeat="1" command_type="RDA">
<command><![CDATA[call setHcveResult(cond(\
  not(testFile('x','/usr/sbin/lsps')),\
    'Cannot access /usr/sbin/lsps',\
  expr('>=',replace(field('\s+',0,\
    grepCommand('/usr/sbin/lsps -s','\d+','f')),'MB'),1500),\
    'Available',\
    'Need at least 1.5 GB'))
]]></command>
<description><![CDATA[This rule checks that the machine has enough swap space. The minimum requirement is 1.5 GB.]]></description>
<action type="negative" syntax="wiki"><![CDATA[|*Return Value*|*Action*|
|Need at least 1.5 GB|Increase the swap space to 1.5 GB or more.|
|Cannot access /usr/sbin/lsps|Grant execute permission on /usr/sbin/lsps to the current user.|]]></action>
<action type="positive"><![CDATA[The machine has enough swap space.]]></action>
</rule>
<rule condition="==" id="17" maximum="N" minimum="Adequate" mode="VERIFY" name="Monitor Colors" repeat="1" command_type="RDA">
<command><![CDATA[call loadCommand('/usr/X11R6/bin/xdpyinfo 2>&1')
var @dpt = grepLastFile('depths')
call setHcveResult(cond(\
  grep(@dpt,'8','f'),              'Adequate',\
  not(defined(getEnv('DISPLAY'))), 'DISPLAY is not set',\
  grepLastFile('unable','f'),      'Cannot open DISPLAY',\
                                   'Need at least 256 colors'))
]]></command>
<description><![CDATA[This rule checks that the monitor has a minimum of 256 colors.]]></description>
<action type="negative" syntax="wiki"><![CDATA[|*Return Value*|*Action*|
|Need at least 256 colors|Use a display with 256 colors.|
|DISPLAY is not set|Set the DISPLAY environment variable to a valid display.|
|Cannot open DISPLAY|Set the DISPLAY environment variable to a correct display.|]]></action>
<action type="positive"><![CDATA[The monitor has enough colors.]]></action>
</rule>
<rule condition="==" id="18" maximum="N" minimum="Certified" mode="VERIFY" name="Operating System" repeat="1" command_type="RDA">
<command><![CDATA[import $OS_LVL
if !defined($OS_LVL)
 return setHcveResult('Cannot access /usr/bin/oslevel')
macro chk_maintenance
{import $lvl_sec
 return cond(compare('ge',$lvl_sec,'01'),\
   'Certified',\
   'Need at least Maintenance Level 1')
}
var ($lvl_fir,$lvl_sec) = split('\-',$OS_LVL,2)
call setHcveResult(cond(\
  compare('eq',$lvl_fir,'5200'), chk_maintenance(),\
  compare('ge',$lvl_fir,'5300'), chk_maintenance(),\
                                 'Need AIX 5.2 or 5.3'))
]]></command>
<description><![CDATA[This rule checks that the operating system is certified. The following operating systems are certified for Oracle Application Server 10g: AIX 5.2.0.0 Maintenance Level 1 or later, AIX 5.3.0.0 Maintenance Level 1 or later.]]></description>
<action type="negative" syntax="wiki"><![CDATA[|*Return Value*|*Action*|
|Need at least Maintenance Level 1|You must use AIX 5.2 or 5.3 with Maintenance Level 1 or later.|
|Need AIX 5.2 or 5.3|You must use AIX 5.2 or 5.3.|
|Cannot access /usr/bin/oslevel|Grant execute permission on /usr/bin/oslevel to the current user.|]]></action>
<action type="positive"><![CDATA[You are using a certified operating system.]]></action>
</rule>
<rule condition="==" id="19" maximum="N" minimum="All file sets exist" mode="VERIFY" name="File Sets" repeat="1" command_type="RDA">
<command><![CDATA[if !testFile('ex','/usr/bin/lslpp')
 return setHcveResult('Cannot access /usr/bin/lslpp')
loop $set ('bos.adt.base',\
               'bos.adt.lib',\
               'bos.adt.libm',\
               'bos.perf.perfstat',\
               'bos.perf.libperfstat',\
               'bos.perf.proctools')
{var ($res) = grepCommand(concat('lslpp -l ',$set),quote($set),'f')
 if !length($res)
  var @tbl = (@tbl,$set)
 elsif !compare('eq',field('\s+',2,$res),'COMMITTED')
  var @tbl = (@tbl,$set)
}
call setHcveResult(cond(\
  scalar(@tbl),concat('Missing [',join(' ',@tbl),']'),'All file sets exist'))
]]></command>
<description><![CDATA[This rule checks that the following file sets are installed and committed: bos.adt.base bos.adt.lib bos.adt.libm bos.perf.perfstat bos.perf.libperfstat bos.perf.proctools.]]></description>
<action type="negative" syntax="wiki"><![CDATA[|*Return Value*|*Action*|
|Missing ...|Install the listed missing file sets from : "bos.adt.base bos.adt.lib bos.adt.libm bos.perf.perfstat bos.perf.libperfstat bos.perf.proctools"|
|Cannot access /usr/bin/lslpp|Grant execute permission on /usr/bin/lslpp to the current user.|]]></action>
<action type="positive"><![CDATA[You are using a certified operating system.]]></action>
</rule>
<rule condition="==" id="20" maximum="N" minimum="All patches exist" mode="VERIFY" name="Patches" repeat="1" command_type="RDA">
<command><![CDATA[import $OS_LVL
if !testFile('ex','/usr/sbin/instfix')
 return setHcveResult('Cannot access /usr/sbin/instfix')
macro chk_patch
{var (\@tbl,$low,@pch) = @arg
 if compare('ge',$low,'07')
  var @pch = (@pch,'IY76141')
 elsif compare('ge',$low,'03')
  var @pch = (@pch,'IY76140')
 loop $pch (@pch)
 {if !grepCommand(concat('/usr/sbin/instfix -ia -ivk ',$pch),$pch,'f')
   var @tbl = (@tbl,$pch)
 }
}
var ($hgh,$low) = split('\-',$OS_LVL,2)
if compare('eq',$hgh,'5200')
 call chk_patch(\@tbl,$low,'IY43980','IY44810','IY45462','IY45707',\
                           'IY46214','IY46605','IY48525')
elsif compare('ge',$hgh,'5300')
 call chk_patch(\@tbl,$low,'IY66513','IY70159')
call setHcveResult(cond(\
  scalar(@tbl),concat('Missing [',join(' ',@tbl),']'),'All patches exist'))
]]></command>
<description><![CDATA[This rule checks that the necessary operating system patches are installed.]]></description>
<action type="negative" syntax="wiki"><![CDATA[|*Return Value*|*Action*|
|Missing ...|Install the listed missing patches.|
|Cannot access /usr/sbin/instfix|Grant execute permission on /usr/sbin/instfix to the current user.|]]></action>
<action type="positive"><![CDATA[All operating system patches are installed.]]></action>
</rule>
<rule condition="=~" id="21" maximum="N" minimum="TNS Listener 9.0.1 or later is running|Free" mode="VERIFY" name="Port 1521" repeat="1" command_type="RDA">
<command><![CDATA[var @lst = grepCommand('/bin/netstat -an','LISTEN')
if !grep(@lst,'1521','f')
 return setHcveResult('Free')
call cond(\
 testFile('x','/usr/sbin/lsof'),assign($prc,\
   grepCommand('/usr/sbin/lsof -i TCP:1521','LIST','f')),\
 testFile('x','/usr/bin/lsof'),assign($prc,\
   grepCommand('/usr/bin/lsof -i TCP:1521','LIST','f')),\
 testFile('x','/usr/local/bin/lsof'),assign($prc,\
   grepCommand('/usr/local/bin/lsof -i TCP:1521','LIST','f')))
if !length($prc)
 return setHcveResult('Cannot access lsof')
macro chk_tns
{var ($prc) = @arg
 var @cmd = grepCommand('ps -ef',field('\s+',1,$prc))
 var @ver = command(replace(field(\
    '\s+',8,grep(@cmd,'tnslsnr','f')),'tnslsnr','lsnrctl version'))
 var $ver = field('\s+',6,grep(@ver,'LSNRCTL','f'))
 return cond(compare('older',$ver,'9.0.1'),\
             concat('TNS Listener version [',$ver,'] is running'),\
             'TNS Listener 9.0.1 or later is running')
}
call setHcveResult(cond(not(match(field('\s+',0,$prc),'tnslsnr',true)),\
                        'Port is used by non-oracle program',\
                        chk_tns($prc)))
]]></command>
<description><![CDATA[This rule checks that port 1521 is free. If an Oracle listener version 9.0.1 or later uses port 1521, then the existing database and the Oracle Application Server 10g Metadata Repository will use the existing listener. The installer performs this configuration automatically. If an Oracle listener version earlier than 9.0.1 uses port 1521, then the existing listener must be stopped. After the installation is complete, you can configure the new 9.0.1 listener to listen to the existing (pre 9.0.1) databases. If non Oracle programs use port 1521, then this program must be configured to listen to ports other than 1521. For more information, see the "If Port 1521 is in Use" section of the ''Oracle Application Server 10g Installation Guide''.]]></description>
<action type="negative" syntax="wiki"><![CDATA[|*Return Value*|*Action*|
|TNS Listener version ... is running|Stop the existing listener.|
|Port is used by non-oracle program|Reconfigure the program to use a different port than 1521.|
|Cannot access lsof|Manually check port 1521.|]]></action>
<action type="positive"><![CDATA[Port 1521 is not used or is used by TNS*Listener version 9.0.1 or later.]]></action>
</rule>
<rule condition="==" id="22" maximum="N" minimum="Properly defined" mode="VERIFY" name="Environment Variables" repeat="1" command_type="RDA">
<command><![CDATA[if grepEnv('^(TNS_ADMIN|ORA_NLS|ORA_NLS32|ORA_NLS33)$')
 return setHcveResult('Some variables are set')
if testFile('e','/etc/oratab')
{if !testFile('r','/etc/oratab')
  return setHcveResult('Cannot access /etc/oratab')
 var @pth = (split(':',join(':',getEnv('PATH'),\
                                getEnv('CLASSPATH'),\
                                getEnv('LD_LIBRARY_PATH'))))
 loop $lin (grepFile('/etc/oratab','#|^$','v'))
 {var $pat = concat('^',quote(replace(field(':',1,$lin),'\/+$')),'(\/.*)?$')
  if grep(@pth,$pat)
   return setHcveResult('Variables containing reference to existing \
                         Oracle homes')
 }
}
return setHcveResult('Properly defined')

]]></command>
<description><![CDATA[This rule checks that the following environment variables are not set: TNS_ADMIN, ORA_NLS, ORA_NLS32, and ORA_NLS33. In addition, the following environment variables must not reference to any existing Oracle home, PATH, CLASSPATH, and LD_LIBRARY_PATH.]]></description>
<action type="negative" syntax="wiki"><![CDATA[|*Return Value*|*Action*|
|Variables containing reference to existing Oracle homes|Remove any reference to existing Oracle homes from PATH, CLASSPATH, and LD_LIBRARY_PATH.|
|Some variables are set|Unset TNS_ADMIN, ORA_NLS, ORA_NLS32, and ORA_NLS33.|
|Cannot access /etc/oratab|Grant read permission on /etc/oratab to the current user.|]]></action>
<action type="positive"><![CDATA[Environment variables do not have references to existing Oracle homes.]]></action>
</rule>
<rule id="23" mode="RECORD" name="Domain Name" repeat="1" command_type="RDA">
<command><![CDATA[var ($hst) = command('hostname')
var ($nam,$dom) = split('\.',$hst,2)
if testFile('x','/bin/domainname')
 var ($nis) = command('/bin/domainname')
if testFile('r','/etc/resolv.conf')
 var $dns = field('\s+',1,grepFile('/etc/resolv.conf','domain'))
if testFile('x','/usr/bin/nslookup')
{if $nam
 {var $nsl = field(concat(quote($nam),'\.'),1,\
                  grepCommand(concat('/usr/bin/nslookup ',$hst),'Name','f'))
 }
 else
 {var $nsl = field(concat(quote($hst),'\.'),1,\
                  grepCommand(concat('/usr/bin/nslookup ',$hst),'Name','f'))
 }
}
call setHcveResult(cond($dom,$dom,\
                        $nis,$nis,\
                        $dns,$dns,\
                        $nsl,$nsl,\
                            'NotFound'))
]]></command>
<description><![CDATA[This rule gets the host domain name.]]></description>
</rule>
<rule id="24" mode="RECORD" name="IP Address" repeat="1" command_type="RDA">
<command><![CDATA[var ($hst) = command('hostname')
var @lst = grepCommand(concat('/usr/sbin/ping -c 1 ',$hst),'.')
call setHcveResult(replace(field('\s+',3,grep(@lst,'\d+:','f')),':'))
]]></command>
<description><![CDATA[This rule gets the host IP address.]]></description>
</rule>
<rule condition="==" id="25" minimum="Host correctly registered in DNS" mode="VERIFY" name="DNS Lookup" repeat="1" command_type="RDA">
<command><![CDATA[var $ip  = "%24%"
var $hst = field('\.',0,command('hostname'))
call setHcveResult(cond(\
  not(length($ip)),\
    'Cannot determine IP address',\
  not(testFile('x','/usr/bin/nslookup')),\
    'Cannot access /usr/bin/nslookup',\
  and(grepCommand(concat('/usr/bin/nslookup ',$hst),quote($ip),'f'),\
      grepCommand(concat('/usr/bin/nslookup ',$ip),quote($hst),'f')),\
    'Host correctly registered in DNS',\
    'Host not correctly registered in DNS'))
]]></command>
<description><![CDATA[This rule checks that the host is registered properly in the DNS.]]></description>
<action type="negative" syntax="wiki"><![CDATA[|*Return Value*|*Action*|
|Host not correctly registered in DNS|Register the host.domain in the DNS.|
|Cannot determine IP address|Fix any problem with the host IP address.|
|Cannot access /usr/bin/nslookup|Grant execute permission on /usr/bin/nslookup to the current user.|]]></action>
<action type="positive"><![CDATA[The host is registered correctly in the DNS.]]></action>
</rule>
<rule condition="==" id="26" minimum="Contains host.domain" mode="VERIFY" name="/etc/hosts Format" repeat="1" command_type="RDA">
<command><![CDATA[var $dom = "%23%"
var $ip  = "%24%"
if !testFile('r','/etc/hosts')
 return setHcveResult('Cannot access /etc/hosts')
var $hst = field('\.',0,command('hostname'))
var $fqd = concat($hst,'.',$dom)
var ($lin) = grepFile('/etc/hosts',quote($fqd),'f')
var @fld = split('\s+',$lin,4)
call setHcveResult(cond(\
  compare('eq',join('|',$fld[0],$fld[1]),join('|',$ip,$fqd)),\
    'Contains host.domain',\
    'Missing host.domain'))
]]></command>
<description><![CDATA[This rule checks that the /etc/hosts file contains a line with "ip_address fully_qualified_domainname short_hostname".]]></description>
<action type="negative" syntax="wiki"><![CDATA[The Fully Qualified Host Name is not configured properly. 
|*Return Value*|*Action*|
|Missing host.domain|Add the FQDN to the /etc/hosts file.|
|Cannot access /etc/hosts|Grant read permission on /etc/hosts to the current user.|]]></action>
<action type="positive"><![CDATA[The Fuly Qualified Domain name is set correctly.]]></action>
</rule>
<rule condition="==" id="27" minimum="Less than 127 char" mode="VERIFY" name="Oracle Home Length" repeat="1" command_type="RDA">
<command><![CDATA[var $ORACLE_HOME = getEnv('ORACLE_HOME')
call setHcveResult(cond(\
  not(defined($ORACLE_HOME)),\
    'ORACLE_HOME is not set',\
  expr('<=',length($ORACLE_HOME),127),\
    'Less than 127 char',\
    'Longer than 127 characters'))
]]></command>
<description><![CDATA[This rule checks that the path to the Oracle home directory is not longer than 127 characters.]]></description>
<action type="negative" syntax="wiki"><![CDATA[|*Return Value*|*Action*|
|Longer than 127 characters|Change ORACLE_HOME to a directory not longer than 127 characters.|
|ORACLE_HOME is not set|Set the ORACLE_HOME environment variable.|]]></action>
<action type="positive"><![CDATA[The Oracle home directory is not longer than 127 characters.]]></action>
</rule>
<rule condition="=~" id="28" minimum="Not set|Set properly" mode="VERIFY" name="NLS_LANG" repeat="1" command_type="RDA">
<command><![CDATA[var $env = getEnv('NLS_LANG')
call setHcveResult(cond(\
  not(defined($env)),\
    'Not set',\
  match($env,'american_america',true),\
    'Set properly',\
    'Not set properly'))
]]></command>
<description><![CDATA[This rule checks that the NLS_LANG environment variable is defined. If it is defined, then it must be set to American_America, otherwise OID Configuration Assistant will fail.]]></description>
<action type="negative" syntax="wiki"><![CDATA[|*Return Value*|*Action*|
|Not set properly|Set the NLS_LANG environment variable to AMERICAN_AMERICA.&lt;characterset&gt;|]]></action>
<action type="positive"><![CDATA[The NLS_LANG environment variable is set properly or is not set.]]></action>
</rule>
</hcve>
