一直以来在UNIX/Linux like操作系统上安装Oracle数据库软件都是一门精细活,在实际安装软件前有不少操作系统参数或配置需要我们关心。我们以10g release 2为例,尽可能完整地列出所有有必要的预检查工作。
1.确认使用的AIX版本经过认证,AIX 5.2之前的版本包括5.1都没有通过Oracle 10g的认证,换而言之如果你要安装10g的话就要保证AIX的版本>=5.2,我们可以通过以下脚本进行验证:
OS=`/usr/bin/uname -s`
if /usr/bin/test /usr/bin/oslevel
then
OSVER6CHAR=`/usr/bin/oslevel -r | /usr/bin/sed 's/-//''`
OSVER3CHAR=`/usr/bin/oslevel -r | /usr/bin/awk '{print substr($1,1,3)}'`
OSVER=`/usr/bin/oslevel -r`
else
OSVER6CHAR="000000"
OSVER3CHAR="000"
OSVER="000000"
fi
case $OSVER3CHAR in
"414"|"415"|"420"|"421"|"432"|"433"|"510")
/usr/bin/echo "$OS $OSVER is not certified with 10g RDBMS"
;;
"520"|"530")
if test -x /usr/bin/lslpp
then
OSBIT=`/usr/bin/lslpp -L | /usr/bin/grep bos.64bit | /usr/bin/awk '{print $1}' | /usr/bin/sed 's/bos.//' | /usr/bin/sed 's/bit//'`
else
OSBIT="32"
fi
if /usr/bin/test /usr/bin/getconf
then
GETCONFHWBIT=`/usr/bin/getconf HARDWARE_BITMODE 2>>/dev/null`
case $GETCONFHWBIT in
"undefined")
/usr/bin/echo "HARDWARE_BITMODE is undefined or invalid, AIX OS is not 5.2 or 5.3"
;;
"64")
HARDWARE_BITMODE=64
;;
"32")
HARDWARE_BITMODE=32
;;
*)
/usr/bin/echo "HARDWARE_BITMODE check is invalid"
;;
esac
else
/usr/bin/echo "getconf command is not found"
fi
if [ $OSBIT = 64 -a $GETCONFHWBIT = 64 ]
then
/usr/bin/echo "Certified with 10g RDBMS"
else
/usr/bin/echo "$OS $OSVER is not certified with 10g RDBMS"
fi
;;
*)
/usr/bin/echo "$OS OS Version not determinable"
;;
esac
若以上脚本输出结果为Certified with 10g RDBMS,则说明当前的操作系统版本通过了10g的认证。
2.系统软件包是否完整安装,其中包括"bos.adt.base" "bos.adt.lib" "bos.adt.libm" "bos.perf.perfstat" "bos.perf.libperfstat" "bos.perf.proctools"等基础包:
OSpackagesOK=true
if /usr/bin/test -x /usr/bin/lslpp
then
for PACKAGE in "bos.adt.base" "bos.adt.lib" "bos.adt.libm" "bos.perf.perfstat" "bos.perf.libperfstat" "bos.perf.proctools"
do
if [ `/usr/bin/lslpp -l | /usr/bin/grep -c $PACKAGE` != 0 ]
then
STATE=`/usr/bin/lslpp -l | /usr/bin/grep $PACKAGE | /usr/bin/awk '{print $3}' | /usr/bin/sed '2,$d'`
if [ $STATE != "COMMITTED" ]
then
if [ $STATE != "APPLIED" ]
then
/usr/bin/echo "$PACKAGE"NotApplied
OSpackagesOK=false
fi
fi
else
/usr/bin/echo "$PACKAGE"NotInstalled
OSpackagesOK=false
fi
done
else
/usr/bin/echo "NoAccess"
OSpackagesOK=false
fi
if [ $OSpackagesOK = true ]
then
/usr/bin/echo "All required OS packages are installed"
fi
若以上脚本未返回"All required OS packages are installed",则说明系统包安装不完整,各种返回结果的相关解释:
ReturnValue Action
---------------------------------------------------------------------
"$PACKAGE"NotInstalled Please install OS $package or its latest
version. Please refer to the following list of
required OS packages:
bos.adt.base, bos.adt.lib, bos.adt.libm,
bos.perf.perfstat, bos.perf.proctools
"$PACKAGE"NotApplied The $package was found but is not applied or
commited, please make sure that it is applied.
NoAccess OS packages could not be verified because the
user has no execute permission to /bin/lslpp.
Please provide user with execute permission.
3.是否安装了合适的操作系统补丁,如果是5.3的话要求在ML02的基础上安装有IY58143 IY59386 IY60930 IY66513 IY70159 apar fix。
OSpatchesOK=true
if /usr/bin/test oslevel
then
OSVER4CHAR=`/usr/bin/oslevel -r | /usr/bin/awk -F- '{print $1}'`
else
OSVER4CHAR="0000"
fi
if test -x /usr/sbin/instfix
then
if [ $OSVER4CHAR -eq "5200" ]
then
for PATCH in IY63133 IY64978 IY63366 IY64691 IY64737 IY65001
do
if [ `/usr/sbin/instfix -ik $PATCH 2>&1 | /usr/bin/grep -ic "no"` != 0 ]
then
/usr/bin/echo "$PATCH"_NotInstalled
OSpatchesOK=false
fi
done
if [ `/usr/sbin/instfix -ik 5200-04_AIX_ML 2>&1 | /usr/bin/grep -ic "no"` != 0 ]
then
/usr/bin/echo "5200-04_AIX_ML_NotInstalled"
OSpatchesOK=false
fi
elif [ $OSVER4CHAR -eq "5300" ]
then
for PATCH in IY58143 IY59386 IY60930 IY66513 IY70159
do
if [ `/usr/sbin/instfix -ik $PATCH 2>&1 | /usr/bin/grep -ic "no"` != 0 ]
then
/usr/bin/echo "$PATCH"_NotInstalled
OSpatchesOK=false
fi
done
if [ `/usr/sbin/instfix -ik 5300-02_AIX_ML 2>&1 | /usr/bin/grep -ic "no"` != 0 ]
then
/usr/bin/echo "5300-02_AIX_ML_NotInstalled"
OSpatchesOK=false
fi
fi
else
/usr/bin/echo "NoAccess"
OSpatchesOK=false
fi
if [ $OSpatchesOK = true ]
then
/usr/bin/echo "PatchesFound"
fi
若返回的结果不为PatchesFound,则可能是系统补丁安装不到位,各种可能的返回结果:
ReturnValue Action
---------------------------------------------------------------------
$PATCH# Please install OS $PATCH or its latest
version.
5.2: IY63133, IY64978, IY63366, IY64691,
IY64737, IY65001 and
5200-04_AIX_ML maintenance level.
5.3: IY58142, IY59386, IY60930, IY66513,
IY70159 and
5300-02_AIX_ML maintenance level
NoAccess OS patches could not be verified because the
user has no execute permission to
/usr/sbin/instfix. Please provide user with
execute permission.
4.正确配置了操作系统用户,当前登录的用户名应出现在/etc/passwd文件中:
USER=`/usr/bin/id -nu`
if /usr/bin/test -r /etc/passwd
then
if [ "x${USER}x" = `/usr/bin/cat /etc/passwd | /usr/bin/awk -F: '{print "x"$1"x"}' | /usr/bin/grep -e "x${USER}x"` ]
then
/usr/bin/echo userOK
else
/usr/bin/echo "$USER not in /etc/passwd."
fi
else
/usr/bin/echo "Can not read /etc/passwd"
fi
5.正确配置了用户组,当前用户的主用户组应出现在/etc/group文件中:
GROUP=`/usr/bin/id -ng`
if /usr/bin/test -r /etc/group
then
if [ "x${GROUP}x" = "`/usr/bin/cat /etc/group | /usr/bin/awk -F: '{print "x"$1"x"}' | /usr/bin/grep "x${GROUP}x"`" ]
then
/usr/bin/echo "GroupOK"
else
/usr/bin/echo "Group not in /etc/group"
fi
else
/usr/bin/echo "Can not read /etc/group"
fi
6.验证ORACLE_HOME环境变量指定的目录是否有效:
if /usr/bin/test %40%
then
if /usr/bin/test -d %40%
then
if /usr/bin/test -h %40%
then
/usr/bin/echo OHsymlink
else
/usr/bin/echo "OHexists"
fi
else
/usr/bin/echo OHnotvalid
fi
else
/usr/bin/echo "OHNotSpecified"
fi
该项其实可以不做硬性要求,可能返回的各种结果:
Return value Action required
---------------------------------------------------------------------
OHnotvalid Please ensure that the correct location is provided
or ensure that this directory has been created and
re-run this script
OHsymlink ORACLE_HOME is a symbolic link
OHNotSpecified No ORACLE_HOME value was provided for verification
7.ORACLE_HOME环境变量指定目录的权限设置是否合理:
READPERMISSION=false
WRITEPERMISSION=false
EXECUTEPERMISSION=false
if /usr/bin/test %40%
then
if /usr/bin/test -d %40%
then
if /usr/bin/test -r %40%
then
READPERMISSION=true
else
/usr/bin/echo NoReadPerm
fi
if /usr/bin/test -w %40%
then
WRITEPERMISSION=true
else
/usr/bin/echo NoWritePerm
fi
if /usr/bin/test -x %40%
then
EXECUTEPERMISSION=true
else
/usr/bin/echo NoExecutePerm
fi
else
/usr/bin/echo OHNotExist
fi
else
/usr/bin/echo OHNotSpecified
fi
if [ $WRITEPERMISSION = true -a $READPERMISSION = true -a $EXECUTEPERMISSION = true ]
then
/usr/bin/echo CorrectPerms
else
if /usr/bin/test %40%
then
/usr/bin/echo WrongPerms
fi
fi
若未设置ORACLE_HOME环境变量则无需关心,可能返回的各种结果:
Return value Action required
---------------------------------------------------------------------
NoReadPerm Make sure the install user has read permission
on ORACLE_HOME
NoWritePerm Make sure the install user has write permission
on ORACLE_HOME
NoExecutePerm Make sure the install user has execute permission
on ORACLE_HOME
OHNotExist ORACLE_HOME does not exist, please create the
ORACLE_HOME mount point and ensure the permissions
are correctly set (chmod 755)
OHNotSpecified ORACLE_HOME can not be verified as the ORACLE_HOME
is not specified
WrongPerms The specified ORACLE_HOME does not have correct
permissions. Please have your System
Administrator correct the permissions to "rwx" for
the ORACLE_HOME mount point"
8.当前用户的umask掩码是否设置为022,若不是则需要修改为022:
MASK=`/usr/bin/umask`
if [ $MASK -eq 022 ]
then
/usr/bin/echo UmaskOK
else
/usr/bin/echo UmaskNotOK
fi
9.是否设置了LD_LIBRARY_PATH环境变量,若设置了则需要unset该变量以保证安装顺利:
if /usr/bin/test $LD_LIBRARY_PATH
then
/usr/bin/echo IsSet
else
/usr/bin/echo UnSet
fi
10.如上若设置了LIBPATH环境变量,则需要unset该变量:
if /usr/bin/test $LIBPATH
then
/usr/bin/echo IsSet
else
/usr/bin/echo UnSet
fi
11.进一步验证当前PATH变量中不存在引用/etc/oratab文件中列出的其他ORACLE_HOME的条目,若存在则需要在安装前移除:
NoneFound=true
if /usr/bin/test -f /etc/oratab
then
for FILE in /etc/oratab
do
for LINE in `/usr/bin/cat $FILE | /usr/bin/grep -v '#' | /usr/bin/grep -v '^$' | /usr/bin/awk -F: '{print $2}' | /usr/bin/sort -u`
do
for ENVPATHS in PATH
do
if [ `/usr/bin/env | /usr/bin/grep -wc $ENVPATHS | /usr/bin/grep :$ENVPATHS= | /usr/bin/wc -l` -ge 1 ]
then
if [ `/usr/bin/env | /usr/bin/grep -w $ENVPATHS | /usr/bin/grep :$ENVPATHS= | /usr/bin/grep -c $LINE` -ge 1 ]
then
/usr/bin/echo OratabEntryInPath
NoneFound=false
fi
fi
done
done
done
fi
if [ $NoneFound = true ]
then
/usr/bin/echo NoneFound
fi
一般结果都为NoneFound,除非你的系统中确实使用到了多个ORACLE_HOME。
12.oraInventory目录的权限设置是否合理,若不合理会导致安装程序无法写入软件安装信息:
if /usr/bin/test -f /etc/oraInst.loc
then
ORAINVENTORYLOC=`/usr/bin/cat /etc/oraInst.loc | /usr/bin/grep 'inventory_loc' | /usr/bin/grep -v "#" | /usr/bin/awk -F= '{print $2}'`
if /usr/bin/test -w "$ORAINVENTORYLOC"
then
if /usr/bin/test -r "$ORAINVENTORYLOC"
then
/usr/bin/echo oraInventoryOK
else
/usr/bin/echo oraInventoryNotOK
fi
else
/usr/bin/echo oraInventoryNotOK
fi
else
/usr/bin/echo oraInventoryNotFound
fi
可能返回的各类结果:
Return value Action required
---------------------------------------------------------------------
oraInventoryNotOK Make sure the install user has write permission
to $ORAINVLOC
oraInventoryNotFound The file /etc/oraInst.loc was not found. This
is not a problem if this is the first install of
oracle on the server.
13./tmp临时目录是否可写,并Free空间足够:
tmpOK=false
vartmpOK=false
if /usr/bin/test $TEMP
then
TEMPLOC=$TEMP
else
if /usr/bin/test $TMP
then
TEMPLOC=$TMP
else
TEMPLOC=/tmp
fi
fi
if /usr/bin/test -d $TEMPLOC
then
TMPFREE=`/usr/bin/df -k $TEMPLOC | /usr/bin/awk '{print $3}' | /usr/bin/sed '1d'`
TMPFREE=`/usr/bin/expr $TMPFREE / 1024`
if [ $TMPFREE -lt 400 ]
then
/usr/bin/echo TempFreeIsLow
else
if /usr/bin/test -w "$TEMPLOC"
then
tmpOK=true
else
/usr/bin/echo TempNoWrite
fi
fi
else
/usr/bin/echo invalidDIR
fi
if /usr/bin/test $TMPDIR
then
TMPDIRLOC=$TMPDIR
else
TMPDIRLOC=/var/tmp
fi
if /usr/bin/test -d $TMPDIRLOC
then
TMPDIRSIZE=`/usr/bin/df -k "$TMPDIRLOC" | /usr/bin/awk '{print $3}' | /usr/bin/sed '1d'`
TMPDIRSIZE=`/usr/bin/expr $TMPDIRSIZE / 1024`
if [ $TMPDIRSIZE -lt 200 ]
then
/usr/bin/echo TMPDIRTooSmall
else
if /usr/bin/test -w "$TMPDIRLOC"
then
vartmpOK=true
else
/usr/bin/echo TMPDIRNoWrite
fi
fi
else
/usr/bin/echo invalidDIR
fi
if [ $tmpOK = true -a $vartmpOK = true ]
then
/usr/bin/echo TempSpaceOK
fi
/tmp目录不可写或空间不足均会引起安装失败,可能返回的各类结果:
ReturnValue Action
----------------------------------------------------------------------
TempFreeIsLow ALERT- Your temp space ($TEMP or $TMP or /tmp) has
less than the required 400 Mb free space. Please
make sure your temp space has at least 400 Mb of
free space
TempNoWrite ALERT- your temp space ($TEMP or $TMP or /tmp) does
not have write permissions for this user
TMPDIRTooSmall ALERT- $TMPDIR or /tmp has less than the
required 200 Mb. Please point the TMPDIR
environmental variable to a mount point with at
least 200 Mb of free space
TMPDIRNoWrite ALERT- $TMPDIR is set in the environment;
however, $TMPDIRLOC does not have write permissions
for this user
invalidDIR ALERT- $TEMP or $TMPDIR are set in the environment
with invalid directory
FYI: The runInstaller (OUI) uses/checks for temporary space by checking first for the TEMP environmental variable, then the TMP environmental variable and lastly the actual '/tmp' mount point
FYI: The operating system also needs additional space by creating files under /tmp or if it finds TMPDIR environmental variable it will use that.
14.空闲SWAP是否充足,SWAP过少可能导致安装失败:
if test -x /usr/sbin/lsps
then
SWAP=`/usr/sbin/lsps -s | /usr/bin/awk '{print $1}' | /usr/bin/sed '1d' | /usr/bin/sed 's/MB/ /'`
if /usr/bin/test -z "$SWAP"
then
/usr/bin/echo SWAPNotSet
else
/usr/bin/echo $SWAP
fi
else
/usr/bin/echo "ALERT- SWAP space cannot be determined"
fi
15.是否有已启动的Oracle Universal Installer,若有则需要先停止OU的java安装界面进程:
if [ `/usr/bin/ps -ef | /usr/bin/grep -i runInstaller | /usr/bin/grep -v grep | /usr/bin/wc -l` -ge 1 ]
then
/usr/bin/echo AnotherOUIup
else
/usr/bin/echo NoOtherOUI
fi
16.ORACLE_HOME指向文件夹所在文件系统是否有足够的磁盘空间,若空间不足则建议改变软件安装的文件系统或扩充文件系统:
if /usr/bin/test %40%
then
if /usr/bin/test -d %40%
then
OHDISKSPACEKB=`/usr/bin/df -k %40% | /usr/bin/awk '{print $3}' | /usr/bin/sed '1d'`
OHDISKSPACE=`/usr/bin/expr $OHDISKSPACEKB / 1024`
DBANDSW=4200
DBORSW=3000
CLIENTONLY=1500
if [ $OHDISKSPACE -ge $DBANDSW ]
then
/usr/bin/echo DiskSpaceOK
elif [ $OHDISKSPACE -ge $DBORSW ]
then
/usr/bin/echo OnlySpaceForOne
elif [ $OHDISKSPACE -ge $CLIENTONLY ]
then
/usr/bin/echo ClientOnly
else
/usr/bin/echo NoSpace
fi
else
/usr/bin/echo OHNotValid
fi
else
/usr/bin/echo OHNotSpecified
fi
可能返回的各类结果:
ReturnValue Action
----------------------------------------------------------------------
OnlySpaceForOne %40% has sufficient free disk space to
install the 10g software but not enough to create
a database.
ClientOnly %40% only has sufficient free disk space to
do a client installation.
NoSpace %40% has insufficient free disk space
to do a 10g install.
OHNotFound Disk space calculations cannot be performed
since $ORACLE_HOME is not a valid directory
17. 环境变量AIXTHREAD_SCOPE是否设置为S,Oracle推荐设置AIX操作系统上特有的参数,以获取更佳的性能:
if /usr/bin/test $AIXTHREAD_SCOPE
then
if [ $AIXTHREAD_SCOPE = "S" ]
then
/usr/bin/echo AIXTHREAD_SCOPEOK
else
/usr/bin/echo AIXTHREAD_SCOPEBad
fi
else
/usr/bin/echo AIXTHREADNotSet
fi
若结果为AIXTHREADNotSet则可以在该用户的profile中指定"export AIXTHREAD_SCOPE=S"。
18.保证未设置LINK_CNTRL环境参数:
if /usr/bin/test $LINK_CNTRL
then
/usr/bin/echo LINK_CNTRLBad
else
/usr/bin/echo LINK_CNTRLunset
fi
若设置了该操作可能导致程序link阶段出错,通过unset LINK_CNTRL命令重置该变量。
19.验证是否有足够的物理内存,若物理内存小于1023MB则不通过:
MEM=`/usr/sbin/lsattr -HE -l sys0 -a realmem | /usr/bin/sed '1d' | /usr/bin/awk '{print $2}'`
MEM=`/usr/bin/expr $MEM / 1024`
/usr/bin/echo $MEM
20.配置的交换空间是对比物理内存是否合理:
if /usr/bin/test %130%
then
if [ %130% -lt 1610 ]
then
/usr/bin/echo InsufficientSwap
else
if [ %140% -gt 0 ]
then
if [ %140% -gt 1024 -a %140% -lt 2048 ]
then
if [ %130% -lt `/usr/bin/expr %140% \* 3 / 2` ]
then
/usr/bin/echo SwapLessThanRAM
else
/usr/bin/echo SwapToRAMOK
fi
elif [ %140% -gt 2049 -a %140% -lt 8192 ]
then
if [ %130% -lt %140% ]
then
/usr/bin/echo SwapLessThanRAM
else
/usr/bin/echo SwapToRAMOK
fi
else [ %140% -gt 8192 ]
if [ %130% -lt `/usr/bin/expr %140% \* 3 / 4` ]
then
/usr/bin/echo SwapLessThanRAM
else
/usr/bin/echo SwapToRAMOK
fi
fi
else
/usr/bin/echo MemNotDetermined
fi
fi
else
/usr/bin/echo SwapNotDetermined
fi
Oracle推荐Swap空间至少同主机上的物理内存大小一致,若小于则建议扩展该交换空间,可能返回的各类结果:
ReturnValue Action
--------------------------------------------------------------------
SwapNotDetermined ALERT- A Swap to Memory ratio cannot be
determined because swap has not been setup or
you do not have execute permission to
determine swap
SwapLessThanRAM ALERT- Swap space is less than the physical
memory. Set swap space at least the same
size as the physical memory
InsufficientSwap ALERT- 10g RDBMS 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
21.ld,nm,ar,make等编译工具是否可用,若不可能则在安装的编译阶段可能出错:
ARFOUND=false
LDFOUND=false
NMFOUND=false
MAKEFOUND=false
arvalue=`/usr/bin/which ar`
if /usr/bin/test -h $arvalue
then
arvalue=`/usr/bin/ls -l $arvalue | /usr/bin/awk '{print $11}' | /usr/bin/awk -F* '{print $1}'`
fi
if [ "$arvalue" != "/usr/ccs/bin/ar" ]
then
/usr/bin/echo ArFoundInPath
else
ARFOUND=true
fi
ldvalue=`/usr/bin/which ld`
if /usr/bin/test -h $ldvalue
then
ldvalue=`/usr/bin/ls -l $ldvalue | /usr/bin/awk '{print $11}' | /usr/bin/awk -F* '{print $1}'`
fi
if [ "$ldvalue" != "/usr/ccs/bin/ld" ]
then
/usr/bin/echo LdFoundInPath
else
LDFOUND=true
fi
nmvalue=`/usr/bin/which nm`
if /usr/bin/test -h $nmvalue
then
nmvalue=`/usr/bin/ls -l $nmvalue | /usr/bin/awk '{print $11}' | /usr/bin/awk -F* '{print $1}'`
fi
if [ "$nmvalue" != "/usr/ccs/bin/nm" ]
then
/usr/bin/echo NmFoundInPath
else
NMFOUND=true
fi
makevalue=`/usr/bin/which make`
if /usr/bin/test -h $makevalue
then
makevalue=`/usr/bin/ls -l $makevalue | /usr/bin/awk '{print $11}' | /usr/bin/awk -F* '{print $1}'`
fi
if [ "$makevalue" != "/usr/ccs/bin/make" ]
then
/usr/bin/echo MakeFoundInPath
else
MAKEFOUND=true
fi
if [ $ARFOUND = true -a $LDFOUND = true -a $NMFOUND=true -a $MAKEFOUND = true ]
then
/usr/bin/echo ld_nm_ar_make_found
fi
一般来说这些编译工具不会丢失,但若在您的系统中它们不见了,则需要联系系统管理人员重新安装上,可能的各类结果:
ReturnValue 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
22.ulimit相关的参数是否设置合理其中包括stack size,open files等重要参数:
TIMEOK=false
TIME=`/usr/bin/ulimit -t`
if /usr/bin/test -z "$TIME"
then
/usr/bin/echo TimeNotDef
elif [ $TIME != "unlimited" ]
then
/usr/bin/echo TimeTooSmall
else
TIMEOK=true
fi
FILEOK=false
FILE=`/usr/bin/ulimit -f`
if /usr/bin/test -z "$FILE"
then
/usr/bin/echo FileNotDefined
elif [ $FILE != "unlimited" ]
then
/usr/bin/echo FileTooSmall
else
FILEOK=true
fi
DATAOK=false
DATA=`/usr/bin/ulimit -d`
if /usr/bin/test -z "$DATA"
then
/usr/bin/echo DataNotDefined
elif [ $DATA = "unlimited" ]
then
DATAOK=true
elif [ $DATA -ge 1048576 ]
then
DATAOK=true
else
/usr/bin/echo DataTooSmall
fi
STACKOK=false
STACK=`/usr/bin/ulimit -s`
if /usr/bin/test -z "$STACK"
then
/usr/bin/echo StackNotDefined
elif [ $STACK = "unlimited" ]
then
STACKOK=true
elif [ $STACK -ge 32768 ]
then
STACKOK=true
else
/usr/bin/echo StackTooSmall
fi
NOFILESOK=false
NOFILES=`/usr/bin/ulimit -n`
if /usr/bin/test -z "$NOFILES"
then
/usr/bin/echo NoFilesNotDefined
elif [ $NOFILES = "unlimited" ]
then
NOFILESOK=true
elif [ $NOFILES -ge 4096 ]
then
NOFILESOK=true
else
/usr/bin/echo NoFilesTooSmall
fi
MEMORYOK=false
MEMORY=`/usr/bin/ulimit -m`
if /usr/bin/test -z "$MEMORY"
then
/usr/bin/echo MemoryNotDefined
elif [ $MEMORY = "unlimited" ]
then
MEMORYOK=true
elif [ $MEMORY -ge 2045680 ]
then
MEMORYOK=true
else
/usr/bin/echo MemoryTooSmall
fi
if [ $TIMEOK = true -a $FILEOK = true -a $DATAOK = true -a $STACKOK = true -a $NOFILESOK = true -a $MEMORYOK = true ]
then
/usr/bin/echo ulimitOK
fi
若未返回ulimitOK,则需要针对不同的结果修改/etc/security/limits.conf中当前用户相关的条目,各类不同的返回结果:
Return value Action required
----------------------------------------------------------------------
TimeNotDef 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 at least 1048576
StackNotDefined ulimit(STACK) has not been defined
StackTooSmall Increase the ulimit(STACK) to at least 32768
NoFilesNotDefined ulimit(NOFILES) has not been defined
NoFilesTooSmall Increase the ulimit(NOFILES) to at least 4096
MemoryNotDefined ulimit(MEMORY) has not been defined
MemoryTooSmall Increase the ulimit(MEMORY) to at least 2045680
23.此外一般大型的OLTP系统都需要运行成百上千的服务进程,AIX中单个用户同时能运行的进程数受到系统对象sys0的maxuproc属性限制,一般我们需要修改该参数:
/* 列出当前sys0的maxuproc设置 */
$ lsattr -El sys0|grep maxuproc|cut -c 1-20
maxuproc 128
/* root用户可以修改该属性 */
chdev -l sys0 -a maxuproc=4096
24.配置合理的AIX Virtual Memeory参数,这些参数可能包括maxperm,minperm等,以下为IBM给出的推荐设置:
minperm%=3
maxperm%=90
maxclient%=90
lru_file_repage=0
strict_maxperm=0
strict_maxclient=1
page_steal_method=1
可以通过以下命令完成配置:
#!/usr/bin/ksh
vmo -p -o maxperm%=90;
vmo -p -o minperm%=3;
vmo -p -o maxclient%=90;
vmo -p -o strict maxperm=0;
vmo -p -o strict maxclient=1;
vmo -p -o lru_file_repage=0;
vmo -r -o page_steal_method=1; (need to reboot to take into effect)
vmo -p -o strict_maxclient=1
vmo -p -o strict_maxperm=0;
This VMM tuning tip is applicable for AIX 5.2 ML4+ or AIX 5.3 ML1+
lru_file_repage :
This new parametter prevents the computational pages to be paged out.
By setting lru_file_repage=0 (1 is the default value) you’re telling the VMM that your
preference is to steal pages from FS Cache only.
minfree = 120 x # lcpus Increase if page stealing activity, vmstat “po” column
maxfree = minfree +(maxpaghead x # lcpus)
minperm% = from 3 to 10
maxperm% = maxclient% = from 70 to 90
strict_maxclient = 1
On AIX part
vmo –p –o v_pinshm = 1
Leave maxpin% at the default of 80% unless the SGA exceeds 77% of real memory :
vmo –p –o maxpin%=[(total mem-SGA size)*100/total mem] + 3
On Oracle part (9i/10g)
LOCK_SGA = TRUE
Large Page Support – improves performance of prefetching
On AIX part
vmo –r –o lgpg_size = 16777216 –o lgpg_regions=(SGA size / 16 MB)
chuser capabilities=CAP_BYPASS_RAC_VMM,CAP_PROPAGATE oracle (allow Oracle user ID to use
Large Pages)
ldedit –b lpdata oracle (to allow oracle binary to use large page data)
export LDR_CNTRL=LARGE_PAGE_TEXT=Y@LARGE_PAGE_DATA=M (prior Oracle user ID to
starting Oracle instance and listener to allow both large page text and large page data)
也可以参考VMM Tuning Tip: Protecting Computational Memory at
http://www.ibm.com/developerworks/wikis/download/attachments/53871915/VMM+Tuning+Tip+-+Proctecting+Comp+Memory.pdf?version=2
25.配置系统对象中的I/O pacing限制,在AIX 6.1中自动完成,而在5.3上我们需要手动修改sys0:
Users of AIX occasionally encounter long interactive-application response times when other applications in the system are running large writes to disk. Configuring I/O pacing limits the number of outstanding I/O requests against a file. AIX 6.1 enables I/O pacing by default and the default value: "minpout=4096 and maxpout=8193" is good for AIX6.1. However, in AIX 5.3, you need to explicitly enable this feature. Oracle's testing has shown that starting values of 8 for minpout and 12 for maxpout are a good baseline for most Oracle customers. However, every environment is different, and therefore different values may very well be acceptable, if the system has been properly tuned and shown to perform with differing values. To configure I/O pacing on the system via SMIT, using Oracle's recommended baseline values, enter the following at the command line as root
# smitty chgsys
# chdev -l sys0 -a minpout=8 -a maxpout=12
to be continued.......