<!-- $Id: A201DB11R1_sol.xml,v 1.2 2008/02/26 08:13:32 mschenke Exp $ -->
<!-- ARCS: $Header: /home/cvs/repository/RDA_4/src/scripting/lib/hcve/A201DB11R1_sol.xml,v 1.2 2008/02/26 08:13:32 mschenke Exp $ -->
<!--  Change History: 20080226  DEM  Modify documentation -->
<hcve name="Oracle Database 11g R1 (11.1.0) PreInstall (Solaris)" type="A" product="DB11R1" platform="solaris">
<rule condition="==" id="10" minimum="Certified with 11gR1 RDBMS" mode="VERIFY" name="OS Certified?" repeat="1" command_type="RDA">
<command><![CDATA[import $OS_NAM,$OS_VER,$OS_BIT
call setHcveResult(check(\
  $OS_VER,'^2\.(5\.1|6|7|8)$',\
               concat('Solaris ',$OS_VER,' is not Certified with 11gR1 RDBMS'),\
          '^2\.(9|10)$',\
            cond(expr('==',$OS_BIT,32),concat(\
               '11gR1 is not certified on 32bit Solaris ',$OS_VER),\
               'Certified with 11gR1 RDBMS'),\
               concat($OS_NAM,' OS version not determinable')))
]]></command>
<description><![CDATA[This rule checks for the correct version of Solaris required for installing Oracle Database 11g.]]></description>
<action type="negative"><![CDATA[!!SHOWSTOPPER!!
You do not have the correct version of Solaris installed on your server. For the certified versions of Solaris, see the ''Oracle Database Installation Guide 11g Release 1 (11.1) for Solaris'' and Oracle MetaLink.]]></action>
<action type="positive"><![CDATA[The correct version of Solaris is installed on your server.]]></action>
</rule>
<rule condition="==" id="20" maximum="N" minimum="userOK" mode="VERIFY" name="User in /etc/passwd?" repeat="1" command_type="RDA">
<command><![CDATA[call setHcveResult(cond(\
  not(testFile('r','/etc/passwd')),\
    'Can not read /etc/passwd',\
  grepFile('/etc/passwd',\
           concat('^',assign($usr,command('/usr/xpg4/bin/id -nu')),':'),\
           'f'),\
    'userOK',\
    concat($usr,' not in /etc/passwd.')))
]]></command>
<description><![CDATA[This rule verifies that the user name of the user who runs this script is found in the /etc/passwd file.]]></description>
<action type="negative"><![CDATA[The /etc/passwd file does not contain the user or else the file has no read permission. Add the user to the /etc/passwd file if the user does not exist in the file.]]></action>
<action type="positive"><![CDATA[The /etc/passwd file contains the user. No action is required.]]></action>
</rule>
<rule condition="==" id="40" maximum="N" minimum="GroupOK" mode="VERIFY" name="Group in /etc/group?" repeat="1" command_type="RDA">
<command><![CDATA[call setHcveResult(cond(\
  not(testFile('r','/etc/group')),\
    'Can not read /etc/group',\
  grepFile('/etc/group',concat('^',command('/usr/xpg4/bin/id -ng'),':'),'f'),\
    'GroupOK',\
    'Group not in /etc/group'))
]]></command>
<description><![CDATA[This rule verifies that the group to which the user belongs exists in the /etc/group file.]]></description>
<action type="negative"><![CDATA[ALERT:
The /etc/group file does not contain the group. Add the group to the /etc/group file.]]></action>
<action type="positive"><![CDATA[The /etc/group file contains the group of the user. No action required.]]></action>
</rule>
<rule condition="==" id="50" minimum="$ORACLE_HOME" mode="RECORD" name="Input ORACLE_HOME" repeat="1" command_type="PROMPT">
<command><![CDATA[Planned ORACLE_HOME location or if set]]></command>
<description><![CDATA[Variable to store ORACLE_HOME entered during the execution.]]></description>
</rule>
<rule condition="=~" id="60" maximum="N" minimum="OHexists|OHsymlink|OHNotSpecified" mode="VERIFY" name="ORACLE_HOME Valid?" repeat="1" command_type="RDA">
<command><![CDATA[var $ORACLE_HOME = replaceEnv('%50%')
call setHcveResult(cond(\
  not(defined($ORACLE_HOME)),    'OHNotSpecified',\
  not(testDir('d',$ORACLE_HOME)),'OHnotvalid',\
  not(testDir('l',$ORACLE_HOME)),'OHexists',\
                                 'OHsymlink'))
]]></command>
<description><![CDATA[This rule checks for the Oracle home directory.]]></description>
<action type="negative" syntax="wiki"><![CDATA[ALERT:
There is something wrong with the Oracle home directory. Verify the following:
|*Return Value*|*Action*|
|OHnotvalid|Ensure that you provided the correct location or ensure that this directory is created and then run this script again|
|OHsymlink|ORACLE_HOME is a symbolic link|
|OHNotSpecified|No ORACLE_HOME value was provided for verification|]]></action>
<action type="positive"><![CDATA[The Oracle home directory exists. No action required]]></action>
</rule>
<rule condition="=~" id="70" maximum="N" minimum="CorrectPerms|OHNotSpecified" mode="VERIFY" name="O_H Permissions OK?" repeat="1" command_type="RDA">
<command><![CDATA[var $ORACLE_HOME = replaceEnv('%50%')
call setHcveResult(cond(\
  not(defined($ORACLE_HOME)),    'OHNotSpecified',\
  not(testDir('d',$ORACLE_HOME)),'OHNotExist',\
  not(testDir('r',$ORACLE_HOME)),'NoReadPerm',\
  not(testDir('w',$ORACLE_HOME)),'NoWritePerm',\
  not(testDir('x',$ORACLE_HOME)),'NoExecutePerm',\
                                 'CorrectPerms'))
]]></command>
<description><![CDATA[This rule checks that the user has the correct privileges to install Oracle Database 11g in the Oracle home directory.]]></description>
<action type="negative" syntax="wiki"><![CDATA[|*Return Value*|*Action*|
|NoReadPerm|Ensure that the install user has read permission for the Oracle home directory|
|NoWritePerm|Ensure that the install user has write permission for the Oracle home directory|
|NoExecutePerm|Ensure that the install user has execute permission for the Oracle home directory|
|OHNotExist|The Oracle home directory does not exist. Create the ORACLE_HOME mount point and ensure the permissions are set correctly (chmod 755)|
|OHNotSpecified|RDA cannot verify the Oracle home directory because ORACLE_HOME is not specified|]]></action>
<action type="positive"><![CDATA[The permissions for the Oracle home directory are correct. No action required.]]></action>
</rule>
<rule condition="=~" id="80" maximum="N" minimum="oraInventoryOK|oraInventoryNotFound" mode="VERIFY" name="oraInventory Permissions" repeat="1" command_type="RDA">
<command><![CDATA[call setHcveResult(cond(\
  not(testFile('f','/var/opt/oracle/oraInst.loc')),\
    'oraInventoryNotFound',\
  not(testFile('wr',assign($INV_LOC,\
    value(grepFile('/var/opt/oracle/oraInst.loc','^inventory_loc','f'))))),\
    'oraInventoryNotOK',\
    'oraInventoryOK'))
call setHcveVariable('$INV_LOC')
]]></command>
<description><![CDATA[This rule verifies that the user who is installing Oracle Database 11g has sufficient privileges for the oraInventory directory.]]></description>
<action type="negative" syntax="wiki"><![CDATA[The user who is logged in currently to install Oracle Database 11g cannot access (write) the oraInventory. Verify that the user can write to the directory specified in the /var/opt/oracle/oraInst.loc file.
|*Return Value*|*Action*|
|oraInventoryNotOK|Make sure the install user has write permission to ${INV_LOC}|
|oraInventoryNotFound|The /var/opt/oracle/oraInst.loc file was not found.  This is not a problem if this is the first Oracle installation on the system.|]]></action>
<action type="positive"><![CDATA[The user who is logged in currently either has sufficient privileges for the oraInventory directory to install Oracle Database 11g or this is the first Oracle product to be installed on the system in which case the installer creates the oraInventory directory. No action required.]]></action>
</rule>
<rule condition="==" id="90" maximum="N" minimum="ld_nm_ar_make_Found" mode="VERIFY" name="Got ld,nm,ar,make?" repeat="1" command_type="RDA">
<command><![CDATA[var @tbl = ()
macro find_exe
{var (\@tbl,$exe,$ref) = @arg
 var $cmd = findCommand($exe)
 if $cmd
 {if testFile('l',$cmd)
  {var ($lin) = command(concat('/usr/bin/ls -l ',$cmd))
   var $cmd = field('\*',0,field('\s+',8,$lin))
  }
  if !compare('eq',$cmd,$ref)
   var @tbl = (@tbl,concat(ucfirst($exe),'FoundInPath'))
 }
 else
  var @tbl = (@tbl,concat(ucfirst($exe),'Notfound'))
}
call find_exe(\@tbl,'ar','/usr/ccs/bin/ar')
call find_exe(\@tbl,'ld','/usr/ccs/bin/ld')
call find_exe(\@tbl,'nm','/usr/ccs/bin/nm')
call find_exe(\@tbl,'make','/usr/ccs/bin/make')
call setHcveResult(cond(scalar(@tbl),join("\012",@tbl),'ld_nm_ar_make_Found'))
]]></command>
<description><![CDATA[This rule verifies that the required assembly tools for the installation of Oracle Database 11g exist.]]></description>
<action type="negative" syntax="wiki"><![CDATA[Some of the required assembly tools for the Oracle Database 11g installation were not found. Check your installation.
|*Return Value*|*Action*|
|ArFoundInPath|ar is found in PATH but not in /usr/ccs/bin or symbolically linked to /usr/ccs/bin as required|
|LdFoundInPath|ld is found in PATH but not in /usr/ccs/bin or symbolically linked to /usr/ccs/bin as required|
|NmFoundInPath|nm is found in PATH but not in /usr/ccs/bin or symbolically linked to /usr/ccs/bin as required|
|MakeFoundInPath|make is found in PATH but not in /usr/ccs/bin or symbolically linked to /usr/ccs/bin as required|]]></action>
<action type="positive"><![CDATA[All required assembly tools for the installation of Oracle Database 11g were found. No action required.]]></action>
</rule>
<rule condition="==" id="100" maximum="N" minimum="UmaskOK" mode="VERIFY" name="Umask Set to 022?" repeat="1" command_type="RDA">
<command><![CDATA[call setHcveResult(cond(\
  expr('==','022',command('/usr/bin/umask')),'UmaskOK','UmaskNotOK'))
]]></command>
<description><![CDATA[This rule checks if the umask value is set correctly for installing Oracle Database 11g.]]></description>
<action type="negative"><![CDATA[The umask value is not set correctly. Set the umask to 022 before installing Oracle Database 11g.]]></action>
<action type="positive"><![CDATA[The umask value is set correctly for installing Oracle Database 11g. No action required.]]></action>
</rule>
<rule condition="==" id="110" maximum="N" minimum="ulimitOK" mode="VERIFY" name="ulimits OK?" repeat="1" command_type="RDA">
<command><![CDATA[var @tbl =()
macro get_ulimit_unl
{var (\@tbl,$nam) = @arg
 var $lmt = field('\s+',1,grepLastFile(concat('^',$nam,'\('),'if'))
 if !defined($lmt)
  var @tbl = (@tbl,concat($nam,'NotDefined'))
 elsif compare('ne',$lmt,'unlimited')
  var @tbl = (@tbl,concat($nam,'TooSmall'))
}
macro get_ulimit_val
{var (\@tbl,$nam,$ref) = @arg
 var $lmt = field('\s+',1,grepLastFile(concat('^',$nam,'\('),'if'))
 if !length($lmt)
  var @tbl = (@tbl,concat($nam,'NotDefined'))
 elsif and(compare('ne',$lmt,'unlimited'),expr('<',$lmt,$ref))
  var @tbl = (@tbl,concat($nam,'TooSmall'))
}
call loadCommand('/usr/bin/ulimit -a')
call get_ulimit_unl(\@tbl,'Time')
call get_ulimit_unl(\@tbl,'File')
call get_ulimit_val(\@tbl,'Data',1048576)
call get_ulimit_val(\@tbl,'Stack',32768)
call get_ulimit_val(\@tbl,'NoFiles',4096)
call get_ulimit_val(\@tbl,'Vmemory',4194304)
call setHcveResult(cond(scalar(@tbl),join("\012",@tbl),'ulimitOK'))
]]></command>
<description><![CDATA[This rule verifies that the ulimit settings are adequate for installing Oracle Database 11g.]]></description>
<action type="negative" syntax="wiki"><![CDATA[Review the ulimit settings and check the recommended values from the ''Oracle Database Installation Guide 11g Release 1 (11.1) for Solaris'' before installing the software.
|*Return Value*|*Action*|
|TimeNotDefined|ulimit(TIME) has not been defined|
|TimeTooSmall|Increase the ulimit(TIME) to unlimited|
|FileNotDefined|ulimit(FILE) has not been defined|
|FileTooSmall|Increase the ulimit(FILE) to unlimited|
|DataNotDefined|ulimit(DATA) has not been defined|
|DataTooSmall|Increase the ulimit(DATA) to a minimum of 1048576|
|StackNotDefined|ulimit(STACK) has not been defined|
|StackTooSmall|Increase the ulimit(STACK) to a minimum of 32768|
|NoFilesNotDefined|ulimit(NOFILES) has not been defined|
|NoFilesTooSmall|Increase the ulimit(NOFILES) to a minimum of 4096|
|VmemoryNotDefined|ulimit(VMEMORY) has not been defined|
|VmemoryTooSmall|Increase the ulimit(VMEMORY) to a minimum of 4194304|]]></action>
<action type="positive"><![CDATA[The ulimit settings are adequate for installing Oracle Database 11g. No action required.]]></action>
</rule>
<rule condition="==" id="140" minimum="UnSet" mode="VERIFY" name="LDLIBRARYPATH Unset?" repeat="1" command_type="RDA">
<command><![CDATA[call setHcveResult(cond(\
  defined(getEnv('LD_LIBRARY_PATH')),'IsSet','UnSet'))
]]></command>
<description><![CDATA[This rule checks that the LD_LIBRARY_PATH environment variable is not set.]]></description>
<action type="negative"><![CDATA[The LD_LIBRARY_PATH environment variable is set in your environment and must be unset before installing Oracle Database 11g.]]></action>
<action type="positive"><![CDATA[The LD_LIBRARY_PATH environment variable is not set. No action required.]]></action>
</rule>
<rule condition="==" id="150" minimum="UnSet" mode="VERIFY" name="LDLIBRARYPATH64 Unset?" repeat="1" command_type="RDA">
<command><![CDATA[call setHcveResult(cond(\
  defined(getEnv('LD_LIBRARY_PATH_64')),'LDLBRYPATH64Set','UnSet'))
]]></command>
<description><![CDATA[This rule checks that the LD_LIBRARY_PATH_64 environment variable is not set.]]></description>
<action type="negative"><![CDATA[The LD_LIBRARY_PATH_64 environment variable is set in your environment and must be unset before installing Oracle Database 11g.]]></action>
<action type="positive"><![CDATA[The LD_LIBRARY_PATH_64 environment variable is not set. No action required.]]></action>
</rule>
<rule id="190" mode="RECORD" name="JDK Home" minimum="" repeat="1" command_type="PROMPT">
<command><![CDATA[JDK Home]]></command>
<description><![CDATA[This rule prompts user for the JDK home.]]></description>
</rule>
<rule condition="==" id="200" minimum="Adequate" mode="VERIFY" name="JDK Version" repeat="1" command_type="RDA">
<command><![CDATA[var $sdk = replaceEnv('%190%')
if !testDir('d',$sdk)
 return setHcveResult('JDK home is missing')
macro chk_sdk
{var ($dir) = @arg
 var $ver = field('\s+',3,\
   command(concat(catCommand($dir,'java'),' -fullversion 2>&1')))
 var $ver = trim(replace($ver,'[\-\_]','.',true),'"')
 return compare('valid',$ver,'1.5.0.11')
}
var $SDK_BIN = catDir($sdk,'bin')
if !testDir('d',$SDK_BIN)
 return setHcveResult('JDK bin directory is missing')
var $cnt = grepDir($SDK_BIN,'^javac$')
call setHcveResult(cond(not($cnt),         'JDK compiler is missing',\
                        chk_sdk($SDK_BIN), 'Adequate',\
                                           'Need 1.5.0.11 or later'))
]]></command>
<description><![CDATA[This rule checks that the JDK version installed is JDK 1.5.0.11 or later.]]></description>
<action type="negative" syntax="wiki"><![CDATA[|*Return Value*|*Action*|
|Need 1.5.0.11 or later|Install JDK 1.5.0.11 or later|
|JDK bin directory is missing|Install full JDK package.|
|JDK compiler is missing|Install full JDK package.|
|JDK home is missing|Provide correct location for JDK home.|]]></action>
<action type="positive"><![CDATA[The correct JDK version is installed.]]></action>
</rule>
<rule condition="==" id="210" maximum="N" minimum="NoneFound" mode="VERIFY" name="Other O_Hs in PATH?" repeat="1" command_type="RDA">
<command><![CDATA[var @pth = split(':',getEnv('PATH'))
loop $lin (grepFile(catFile('/var','opt','oracle','oratab'),'#|^$','v'))
{var $pat = concat('^',quote(replace(field(':',1,$lin),'\/+$')),'(\/.*)?$')
 if grep(@pth,$pat)
  return setHcveResult('OratabEntryInPath')
}
call setHcveResult('NoneFound')
]]></command>
<description><![CDATA[This rule checks that the PATH variable does not contain any references to other Oracle homes based on the /var/opt/oracle/oratab entries.]]></description>
<action type="negative"><![CDATA[The PATH variable contains one or more references to the Oracle homes found in the /var/opt/oracle/oratab file. Remove these references from the PATH variable before installing Oracle Database 11g.]]></action>
<action type="positive"><![CDATA[The PATH does not contain any of the Oracle homes found in the /var/opt/oracle/oratab file. No action required.]]></action>
</rule>
<rule condition="==" id="220" maximum="N" minimum="NoOtherOUI" mode="VERIFY" name="Other OUI Up?" repeat="1" command_type="RDA">
<command><![CDATA[call setHcveResult(cond(\
  grepCommand('/usr/bin/ps -ef','runInstaller','i'),'AnotherOUIup',\
                                                    'NoOtherOUI'))
]]></command>
<description><![CDATA[This rule checks for another active runInstaller process on the system.]]></description>
<action type="negative"><![CDATA[Stop the other instance of runInstaller that is currently active on your system.]]></action>
<action type="positive"><![CDATA[No other runInstaller process is running currently. No action required.]]></action>
</rule>
<rule condition="==" id="230" maximum="N" minimum="TempSpaceOK" mode="VERIFY" name="/tmp Adequate?" repeat="1" command_type="RDA">
<command><![CDATA[var @tbl = ()
macro check_tmp
{var (\@tbl,$dir,$siz,$nam) = @arg
 if !testDir('d',$dir)
 {var @tbl = (@tbl,'invalidDir')
  return
 }
 if expr('<',expr('/',get_df($dir),1024),$siz)
  var @tbl = (@tbl,concat($nam,'TooSmall'))
 elsif !testDir('w',$dir)
  var @tbl = (@tbl,concat($nam,'NoWrite'))
}
var $TEMP = nvl(getEnv('TEMP'),getEnv('TMP'),'/tmp')
var $TMPDIR = getEnv('TMPDIR','/var/tmp')
call setHcveVariable('$TEMP','$TMPDIR')
call check_tmp(\@tbl,$TEMP,275,'Temp')
call check_tmp(\@tbl,$TMPDIR,200,'TMPDIR')
call setHcveResult(cond(scalar(@tbl),join("\012",@tbl),'TempSpaceOK'))
]]></command>
<description><![CDATA[This rule checks that there is sufficient space available to store temporary files during the Oracle Database 11g installation.]]></description>
<action type="negative" syntax="wiki"><![CDATA[The temp space is not correctly configured.
|*Return Value*|*Action*|
|TempTooSmall|ALERT- Your temporary space ${TEMP} has less than the required 275 MB free space.  Make sure your temp space has at least 275 MB of free space|
|TempNoWrite|ALERT- Your temporary space ${TEMP} does not have write permissions for this user|
|TMPDIRTooSmall|ALERT- ${TMPDIR} has less than the required 200 MB.  Point the TMPDIR environment variable to a mount point with at least 200 MB of free space|
|TMPDIRNoWrite|ALERT- TMPDIR is set in the environment; however, ${TMPDIR} does not have write permissions for this user|
|invalidDir|ALERT- $TEMP or $TMPDIR are set in the environment with an invalid directory|
FYI: The runInstaller (OUI) uses or checks for temporary space by checking for the TEMP environment variable first, then the TMP environment variable, and lastly the actual '/tmp' mount point.
%BR%The operating system also requires additional space by creating files under /tmp or using the TMPDIR environment variable if it finds it.]]></action>
<action type="positive"><![CDATA[There is sufficient temporary disk space available for installing Oracle Database 11g. No action required.]]></action>
</rule>
<rule condition="=~" id="240" maximum="N" minimum="DiskSpaceOK|OHNotSpecified" mode="VERIFY" name="Disk Space OK?" repeat="1" command_type="RDA">
<command><![CDATA[var $ORACLE_HOME = replaceEnv('%50%')
call setHcveVariable('$ORACLE_HOME')
if !length($ORACLE_HOME)
 return setHcveResult('OHNotSpecified')
if !testDir('d',$ORACLE_HOME)
 return setHcveResult('OHNotValid')
var $dsk = expr('/',get_df($ORACLE_HOME),1024)
call setHcveResult(cond(expr('>=',$dsk,4813),\
                          'DiskSpaceOK',\
                        and(expr('>=',$dsk,1536),expr('<=',$dsk,2048)),\
                          'OnlySpaceForOne',\
                          'NoSpace'))
]]></command>
<description><![CDATA[This rules verifies that the amount of disk space in the Oracle home directory is sufficient for installing Oracle Database 11g.]]></description>
<action type="negative" syntax="wiki"><![CDATA[ORACLE_HOME has insufficient disk space for installing any type of Oracle Database 11g architecture. Verify the specifications:
|*Return Value*|*Action*|
|OnlySpaceForOne|${ORACLE_HOME} has sufficient free disk space to install the Oracle Database 11g software but not enough to create a database.|
|NoSpace|${ORACLE_HOME} has insufficient free disk space for an Oracle Database 11g installation.|
|OHNotValid|Disk space calculations cannot be performed because $ORACLE_HOME is not a valid directory|
|OHNotSpecified|ORACLE_HOME was not specified|]]></action>
<action type="positive"><![CDATA[ORACLE_HOME has sufficient disk space to install Oracle Database 11g software, and create a database. No action required.]]></action>
</rule>
<rule id="250" maximum="N" mode="RECORD" name="Swap (in MB)" repeat="1" command_type="RDA">
<command><![CDATA[if !testFile('x','/etc/swap')
 return setHcveResult('SWAPNotDetermined')
var ($cmd) = grepCommand('/etc/swap -s','^total:','f')
var $swp = field('\s+',0,replace(field('\s+',10,$cmd),'k',' k '))
call setHcveResult(cond(isNumber($swp),expr('/',$swp,1024),'SWAPNotSet'))
]]></command>
<description><![CDATA[This rule shows the amount of free swap space.]]></description>
</rule>
<rule condition="&gt;" id="260" minimum="1023" mode="VERIFY" name="RAM (in MB)" repeat="1" command_type="RDA">
<command><![CDATA[call setHcveResult(nvl(\
  field('\s+',2,grepCommand('/usr/sbin/prtconf','Memory','f')),\
  0))
]]></command>
<description><![CDATA[This rule verifies that your system has sufficient physical memory installed to install Oracle Database 11g.]]></description>
<action type="negative"><![CDATA[ALERT:
The amount of physical memory (Megabytes) in your system is not sufficient to install Oracle Database 11g.]]></action>
<action type="positive"><![CDATA[You have sufficient physical memory (Megabytes) installed to install Oracle Database 11g. No action required.]]></action>
</rule>
<rule condition="==" id="270" maximum="N" minimum="SwapToRAMOK" mode="VERIFY" name="SwapToRAM OK?" repeat="1" command_type="RDA">
<command><![CDATA[var $swp = "%250%"
var $mem = "%260%"
call setHcveResult(cond(\
  not(isNumber($swp)),                      'SwapNotDetermined',\
  expr('<',$swp,1610),                      'InsufficientSwap',\
  not(expr('>',$mem,0)),                    'MemNotDetermined',\
  and(expr('>',$mem,1024),expr('<',$mem,2048)),\
    cond(expr('<',$swp,expr('*',$mem,1.5)), 'SwapLessThanRAM','SwapToRAMOK'),\
  and(expr('>',$mem,2049),expr('<',$mem,8192)),\
    cond(expr('<',$swp,$mem),               'SwapLessThanRAM','SwapToRAMOK'),\
  expr('>',$mem,8192),\
    cond(expr('<',$swp,expr('*',$mem,0.75)),'SwapLessThanRAM','SwapToRAMOK'),\
                                            'SwapToRAMOK'))
]]></command>
<description><![CDATA[This rule verifies that the total amount of swap space is greater than or equal to the amount recommended by the ''Oracle Database Installation Guide 11g Release 1 (11.1) for Solaris''.]]></description>
<action type="negative" syntax="wiki"><![CDATA[The amount of swap space is less than the amount recommended in the ''Oracle Database Installation Guide 11g Release 1 (11.1) for Solaris''. Verify the requirements and adjust your system accordingly.
|*Return Value*|*Action*|
|SwapNotDetermined|ALERT- A Swap to Memory ratio cannot be determined because swap is not set up or you do not have execute permission to determine swap|
|SwapLessThanRAM|ALERT- Swap space is then required,%BR%If RAM = 1024MB to 2048MB %BR%then 1.5 times RAM %BR%elseif RAM > 2048MB and < 8192MB %BR%then match RAM %BR%else RAM > 8192MB %BR%then .75 times RAM|
|InsufficientSwap|ALERT- Oracle Database 11g requires at least 1.5 GB of swap space|
|MemNotDetermined|ALERT- A Swap to Memory ratio cannot be determined because you do not have execute permission to determine the physical memory|]]></action>
<action type="positive"><![CDATA[The amount of swap space meets the minimum requirements for installing Oracle Database 11g. No action required.]]></action>
</rule>
<rule id="290" mode="RECORD" name="IP Address" repeat="1" command_type="RDA">
<command><![CDATA[var ($hst) = command('hostname')
var $ip = field('\s+',1,grepCommand(concat('/usr/sbin/ping -a ',$hst),'.','f'))
call setHcveResult(substr($ip,1,expr('-',length($ip),2)))
]]></command>
<description><![CDATA[This rule gets the host IP address.]]></description>
</rule>
<rule id="300" 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/sbin/nslookup')
{if $nam
 {var $nsl = field(concat(quote($nam),'\.'),1,\
                  grepCommand(concat('/usr/sbin/nslookup ',$hst),'Name','f'))
 }
 else
 {var $nsl = field(concat(quote($hst),'\.'),1,\
                  grepCommand(concat('/usr/sbin/nslookup ',$hst),'Name','f'))
 }
}
call setHcveResult(cond($dom,$dom,\
                        $nis,$nis,\
                        $dns,$dns,\
                        $nsl,$nsl,\
                             'NotFound'))
]]></command>
<description><![CDATA[The rule gets the host domain name.]]></description>
</rule>
<rule condition="==" id="310" minimum="Host correctly registered in DNS" mode="VERIFY" name="DNS Lookup" repeat="1" command_type="RDA">
<command><![CDATA[var $ip  = "%290%"
var $hst = field('\.',0,command('hostname'))
call setHcveResult(cond(\
  not(length($ip)),\
    'Cannot determine IP address',\
  not(testFile('x','/usr/sbin/nslookup')),\
    'Cannot access /usr/sbin/nslookup',\
  and(grepCommand(concat('/usr/sbin/nslookup ',$hst),quote($ip),'f'),\
      grepCommand(concat('/usr/sbin/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/sbin/nslookup|Grant execute permission on /usr/sbin/nslookup to the current user.|]]></action>
<action type="positive"><![CDATA[The host is registered correctly in the DNS.]]></action>
</rule>
<rule condition="==" id="320" minimum="Contains host.domain" mode="VERIFY" name="/etc/hosts Format" repeat="1" command_type="RDA">
<command><![CDATA[var $dom = "%300%"
var $ip  = "%290%"
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 files contains a line with "ip_address fully_qualified_hostname 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="330" maximum="N" minimum="KernelOK" mode="VERIFY" name="Kernel Parameters OK?" repeat="1" command_type="RDA">
<command><![CDATA[import $OS_VER
var @tbl = ()
var $NOEXEC_USER_STACK_REQD = 1
var $SEMMNI_REQD = 100
var $SEMMNS_REQD = 1024
var $SEMMSL_REQD = 256
var $SEMVMX_REQD = 32767
var $SHMMAX_REQD = 4294967295
var $SHMMNI_REQD = 100
if !loadCommand('/etc/sysdef')
 return setHcveResult('NoAccess')
var $NOEXEC_USER_STACK = field('\s+',0,grepLastFile('NOEXEC_USER_STACK','f'))
var $SEMMNI = field('\s+',0,grepLastFile('SEMMNI','f'))
var $SEMMNS = field('\s+',0,grepLastFile('SEMMNS','f'))
var $SEMMSL = field('\s+',0,grepLastFile('SEMMSL','f'))
var $SEMVMX = field('\s+',0,grepLastFile('SEMVMX','f'))
var $SHMMAX = field('\s+',0,grepLastFile('SHMMAX','f'))
var $SHMMNI = field('\s+',0,grepLastFile('SHMMNI','f'))

if !defined($NOEXEC_USER_STACK)
{var $NOEXEC_USER_STACK = value(\
  grepFile('/etc/system','NOEXEC_USER_STACK','if'))
}

macro chk_min
{var (\@tbl,$nam,$ref,$val) = @arg
 if !defined($val)
 {var @tbl = (@tbl,concat($nam,'Undef'))
  return
 }
 if expr('<',$val,$ref)
  var @tbl = (@tbl,concat($nam,'TooSmall'))
}
if match($OS_VER,'^2\.9$')
{call chk_min(\@tbl,'NOEXEC_USER_STACK',$NOEXEC_USER_STACK_REQD,\
                                        $NOEXEC_USER_STACK)
 call chk_min(\@tbl,'SEMMNI',$SEMMNI_REQD,$SEMMNI)
 call chk_min(\@tbl,'SEMMNS',$SEMMNS_REQD,$SEMMNS)
 call chk_min(\@tbl,'SEMMSL',$SEMMSL_REQD,$SEMMSL)
 call chk_min(\@tbl,'SEMVMX',$SEMVMX_REQD,$SEMVMX)
 call chk_min(\@tbl,'SHMMAX',$SHMMAX_REQD,$SHMMAX)
 call chk_min(\@tbl,'SHMMNI',$SHMMNI_REQD,$SHMMNI)
}
elsif match($OS_VER,'^2\.10$')
{macro chk_param
 {var ($cmd,$prj) = @arg
  var ($lin) = grepCommand(concat($cmd,' -n ',$prj,' $$'),\
                           '(basic|privileged|system)','if')
  if match($lin,'\b(\d+(\.\d*)?)(\w*)\b')
   var ($siz,undef,$typ) = (last)
  return check(uc($typ),'^KB?$',expr('*',$siz,1024),\
                        '^MB?$',expr('*',$siz,1048576),\
                        '^GB?$',expr('*',$siz,1073741824),\
                        '^TB?$',expr('*',$siz,1099511627776),\
                        '^PB?$',expr('*',$siz,1125899906842624),\
                        '^EB?$',expr('*',$siz,1152921504606846976),\
                                $siz)
 }
 var $cmd = findCommand('prctl')
 call chk_min(\@tbl,'NOEXEC_USER_STACK',$NOEXEC_USER_STACK_REQD,\
                                        $NOEXEC_USER_STACK)
 call chk_min(\@tbl,'SEMMNI',$SEMMNI_REQD,\
                             chk_param($cmd,'project.max-sem-ids'))
 call chk_min(\@tbl,'SEMMSL',$SEMMSL_REQD,\
                             chk_param($cmd,'process.max-sem-nsems'))
 call chk_min(\@tbl,'SHMMAX',$SHMMAX_REQD,\
                             chk_param($cmd,'project.max-shm-memory'))
 call chk_min(\@tbl,'SHMMNI',$SHMMNI_REQD,\
                             chk_param($cmd,'project.max-shm-ids'))
}
else
 var @tbl = (@tbl,'Uncertified SunOS')
call setHcveResult(cond(scalar(@tbl),join("\012",@tbl),'KernelOK'))
]]></command>
<description><![CDATA[This rule verifies that the kernel parameters are set according to the ''Oracle Database Installation Guide 11g Release 1 (11.1) for Solaris''.]]></description>
<action type="negative" syntax="wiki"><![CDATA[The kernel parameters are not set according to the ''Oracle Database Installation Guide 11g Release 1 (11.1) for Solaris''. For the recommended values, see the ''Oracle Database Installation Guide 11g Release 1 (11.1) for Solaris''. If they have been set in the /etc/system file, then you may have to add the following to set the parameters at boot time:%BR%
forceload: sys/semsys%BR%
forceload: sys/shmsys%BR%
When you make the changes in the /etc/system file, save the file and reboot to take effect.%BR%
In Solaris 10, you are not required to make changes to the /etc/system file to implement the System V TPC. Solaris 10 uses the resource control facility for its implementation.
|*Return Value*|*Action*|
|NOEXEC_USER_STACKTooSmall|Increase the kernel parameter NOEXEC_USER_STACK to 1|
|NOEXEC_USER_STACKUndef|NOEXEC_USER_STACK has not been defined and must be set to 1|
|SEMMNITooSmall|Increase the kernel parameter SEMMNI to 100|
|SEMMNIUndef|SEMMNI has not been defined and must be set to 100|
|SEMMNSTooSmall|Increase the kernel parameter SEMMNS to at least 1024|
|SEMMNSUndef|SEMMNS has not been defined and must be set to 1024|
|SEMMSLTooSmall|Increase the kernel parameter SEMMSL to at least 256|
|SEMMSLUndef|SEMMSL has not been defined and must be set to 256|
|SEMVMXTooSmall|Increase the kernel parameter SEMVMX to 32767|
|SEMVMXUndef|SEMVMX has not been defined and must be set to 32767|
|SHMMAXTooSmall|Increase the kernel parameter SHMMAX to 4294967295|
|SHMMAXUndef|SHMMAX has not been defined and must be set to 4294967295|
|SHMMNITooSmall|Increase the kernel parameter SHMMNI to at least 100|
|SHMMNIUndef|SHMMNI has not been defined and must be set to 100 or more|
|NoAccess|You do not have access to /etc/sysdef|]]></action>
<action type="positive"><![CDATA[The kernel parameters are set according to the ''Oracle Database Installation Guide 11g Release 1 (11.1) for Solaris''. No action required.]]></action>
</rule>
<rule condition="==" id="370" minimum="adequate" mode="VERIFY" name="Kernel Level OK?" repeat="1" command_type="RDA">
<command><![CDATA[import $OS_VER
macro check_kernel
{var ($ref) = @arg
 if match(uname('v'),'(\d{6,})\-(\d+)')
  return cond(compare('valid',join('.',last),version($ref)),'adequate',\
              concat('Need at least ',$ref))
 return 'Inadequate'
}
call setHcveResult(check(\
  $OS_VER,'^2\.9$',  check_kernel('112233-11'),\
          '^2\.10$', 'adequate',\
                     'NotCertified'))
]]></command>
<description><![CDATA[This rule checks if the Kernel patch level required for the Oracle Database 11g installation is installed.]]></description>
<action type="negative" syntax="wiki"><![CDATA[Review the kernel patch level version and the recommended version from the ''Oracle Database Installation Guide 11g Release 1 (11.1) for Solaris'' before installing the software.
|*Return Value*|*Action*|
|Need at least 112233-11|Apply patch 112233-11 or higher kernel patch|
|Inadequate|Either the kernel patch is too old or else it is not the correct patch|
|NotCertified|Use a certified operating system.|]]></action>
<action type="positive"><![CDATA[The kernel patch level is adequate. No action required.]]></action>
</rule>
<rule condition="==" id="410" minimum="adequate" mode="VERIFY" name="Got OS Patches?" repeat="1" command_type="RDA">
<command><![CDATA[import $OS_VER
var @tbl = ()
macro check_patch
{var (\@tbl,@pch) = @arg
 loop $pch (@pch)
 {var $pch_num = field('\-',0,$pch)
  if field('\s+',0,field(':',1,grepLastFile($pch_num,'f')))
  {var %srt = ()
   loop $key (grepLastFile(concat('Patch: ',$pch_num)))
    var $srt{$key} = true
   var $pch_rev = field('\s+',1,reverse(keys(%srt)))
   if compare('lt',replace($pch_rev,'\-'),replace($pch,'\-'))
    var @tbl = (@tbl,\
                concat('Patch [',$pch_rev,'] must be at level [',$pch,']'))
  }
  else
   var @tbl = (@tbl,concat('Patch [',$pch_num,'] is not installed'))
 }
}
call loadCommand('/usr/bin/showrev -p')
if match($OS_VER,'^2\.9$')
{call check_patch(\@tbl,'112233-11','111722-04','112874-39','115675-01',\
                        '113471-08','115675-01')
 if grepCommand('/usr/bin/pkginfo','\bSUNWspro\b','f')
  call check_patch(\@tbl,'112760-05')
}
elsif match($OS_VER,'^2\.10$')
{call check_patch(\@tbl,'127111-02')
 if grepCommand('/usr/bin/pkginfo','\bSUNWspro\b','f')
 {call check_patch(\@tbl,'117837-05')
  call check_patch(\@tbl,'117846-08')
  call check_patch(\@tbl,'118682-01')
 }
}
else
 var @tbl = (@tbl,'OS version is not certified')
call setHcveResult(cond(scalar(@tbl),join("\012",@tbl),'adequate'))
]]></command>
<description><![CDATA[This rule checks for the OS patches required for the Oracle Database 11g installation.]]></description>
<action type="negative" syntax="wiki"><![CDATA[Some of the required OS patches for the installation of Oracle Database 11g were not met or found. Review the recommended OS patches from the ''Oracle Database Installation Guide 11g Release 1 (11.1) for Solaris'' before installing the software.
|*Return Value*|*Action*|
|Patch ... is not installed|Verify that the required OS patches are installed.%BR%For Sun 2.9/5.9, 112233-11 111722-04 112874-39  112760-05 115675-01 (NUMA Systems only) 113471-08 (NUMA Systems only) 115675-01 (NUMA Systems only)%BR%For Sun 2.10/5.10, 127111-02 117837-05 117846-08 118682-01|
|Patch ... must be at level ...|Verify that level of the required OS patches is equal to or higher than the specified level.%BR%For Sun 2.9/5.9, 112233-11 111722-04 112874-39  112760-05 115675-01 (NUMA Systems only) 113471-08 (NUMA Systems only) 115675-01 (NUMA Systems only)%BR%For Sun 2.10/5.10, 127111-02 117837-05 117846-08 118682-01|
]]></action>
<action type="positive"><![CDATA[All required OS patches are adequate. No action required.]]></action>
</rule>
<rule condition="==" id="430" minimum="All required OS packages are installed" mode="VERIFY" name="Got OS Packages?" repeat="1" command_type="RDA">
<command><![CDATA[import $OS_VER,$OS_BIT
var @tbl = ()
macro check_package
{var (\@tbl,$pkg) = @arg
 call loadCommand('/usr/bin/pkginfo')
 var @pkg = ('arc','btool','hea','libC','libm','libms','sprot','too','i1of',\
             'i1cs','i15cs','xwfnt','uiu8','ulcf',$pkg)
 loop $pkg (split('\s',concat('SUNW',join(' SUNW',@pkg))))
 {if not(grepLastFile($pkg,'f'))
   var @tbl = (@tbl,$pkg)
 }
}
call check(\
 $OS_VER,'^2\.10$', check_package(\@tbl),\
                    check_package(\@tbl,'sprox'))
if expr('==',$OS_BIT,32)
 var @tbl = (@tbl,\
             'OS is not showing as running as 64bit bit, investigate')
call setHcveResult(cond(\
  scalar(@tbl),join("\012",@tbl),'All required OS packages are installed'))
]]></command>
<description><![CDATA[This rule verifies that all required OS packages are installed.]]></description>
<action type="negative" syntax="wiki"><![CDATA[Some of the required OS packages were not found. Check your installation.
|*Return Value*|*Action*|
|SUNWarc|SUNWarc package must be installed|
|SUNWbtool|SUNWbtool package must be installed|
|SUNWhea|SUNWhea package must be installed|
|SUNWlibC|SUNWlibC package must be installed|
|SUNWlibm|SUNWlibm package must be installed|
|SUNWlibms|SUNWlibms package must be installed|
|SUNWsprot|SUNWsprot package must be installed|
|SUNWtoo|SUNWtoo package must be installed|
|SUNWi1of|SUNWi1of package must be installed|
|SUNWi1cs|SUNWi1cs package must be installed|
|SUNWi15cs|SUNWi15cs package must be installed|
|SUNWxwfnt|SUNWxwfnt package must be installed|
|SUNWuiu8|SUNWuiu8 package must be installed|
|SUNWulcf|SUNWulcf package must be installed|
|SUNWsprox|SUNWsprox package must be installed%BR%(SUNWsprox is not required for Solaris 10)|]]></action>
<action type="positive"><![CDATA[All required OS packages are installed. No action required.]]></action>
</rule>
<rule condition="==" id="580" minimum="TestCompleted" mode="VERIFY" name="Cluster Information" repeat="1" command_type="RDA">
<command><![CDATA[macro cluster_info
{var ($cmd,$pat) = @arg
 var $clu_up = field('\s+',0,grepCommand($cmd,$pat,'c'))
 return cond(expr('==',$clu_up,0),'ClusterWarning')
}
var $ver = cond(\
 testFile('f','/usr/cluster/bin/scconf'),              '3X',\
 testFile('f','/opt/SUNWcluster/bin/get_node_status'), '2X')
var $clu = check(\
 $ver,'2X',cluster_info('/opt/SUNWcluster/bin/get_node_status','membership:'),\
      '3X',cluster_info('/usr/cluster/bin/scstat -n','Online'))
call setHcveResult(cond($clu,$clu,'TestCompleted'))
]]></command>
<description><![CDATA[This rule checks the status of the Sun Cluster.]]></description>
<action type="negative" syntax="wiki"><![CDATA[Your Sun Cluster is not in good status. Refer to following return code information:
|*Return Value*|*Action*|
|ClusterWarning|No members of your cluster are in the UP status and the RAC option cannot be installed. Because a cluster has been detected or partially detected during a Typical Installation, the RAC option is installed automatically. This causes problems. Oracle recommends using the Custom Install and deselecting the RAC option to avoid any problems.|
|TestCompleted|If you do not have a Sun cluster, then this test does not apply. Otherwise, a cluster was detected and is up. No action is required.|]]></action>
<action type="positive"><![CDATA[The Sun Cluster status test is completed. If you do not have a Sun cluster, then this test does not apply. Otherwise, a cluster was detected and is running. No action is required.]]></action>
</rule>
</hcve>
