redhat linux安装oracle之前需要配置一些系统环境,每次配置比较麻烦,为方便,写了个简单的脚本,在rhel5.8系统测试通过。

 
  
  1. #!/bin/bash

  2. ################################################################################

  3. # Description:此脚本为rhel5或rhel6环境安装oracle 10g的系统准备工作,需要配置好yum源

  4. # 添加的oracle用户默认密码为oracle

  5. # Author:snaid

  6. # Email:snaid_x@163.com

  7. ################################################################################

  8. #difine oracle_sid

  9. read -p "Please input your oracle sid that will be install:" ora_sid

  10. #modify system version

  11. echo "Red Hat Enterprise Linux Server release 4.8 (Tikanga)" > /etc/redhat-release

  12. #install depdent packge

  13. for i in binutils compat-gcc-34 compat-libstdc++-296 control-center gcc gcc-c++ \

  14. glibc glibc-common glibc-devel libaio libgcc libstdc++ libstdc++-devel libXp \

  15. make openmotif22 setarch

  16. do

  17. yum -y install $i 2>/dev/null ;

  18. done

  19. #modify kernel parameter

  20. printf "kernel.shmall = 2097152 \n

  21. kernel.shmmax = 2147483648 \n

  22. kernel.shmmni = 4096 \n

  23. kernel.sem = 250 32000 100 128 \n

  24. fs.file-max = 65536 \n

  25. net.ipv4.ip_local_port_range = 1024 65000 \n

  26. net.core.rmem_default = 1048576 \n

  27. net.core.rmem_max = 1048576 \n

  28. net.core.wmem_default = 262144 \n

  29. net.core.wmem_max = 262144 ">> /etc/sysctl.conf

  30. /sbin/sysctl -p

  31. #adduser

  32. /usr/sbin/groupadd -g 1000 oinstall

  33. /usr/sbin/groupadd -g 1001 dba

  34. /usr/sbin/useradd -u 1000 -g oinstall -G dba oracle

  35. echo "oracle"| passwd oracle --stdin > /dev/null 2>&1

  36. #build oracle directory

  37. mkdir -p /u01/oracle

  38. chown -R oracle.oinstall /u01

  39. #oracle environment variable

  40. echo export ORACLE_BASE=/u01/oracle >> /home/oracle/.bash_profile

  41. echo export ORACLE_HOME=\$ORACLE_BASE/product/10.2.0 >> /home/oracle/.bash_profile

  42. echo export ORACLE_SID=$ora_sid >> /home/oracle/.bash_profile

  43. echo export PATH=\$PATH:\$HOME/bin:\$ORACLE_HOME/bin >> /home/oracle/.bash_profile

  44. echo export LD_LIBRARY_PATH=\$ORACLE_HOME/lib:/lib:/usr/lib >> /home/oracle/.bash_profile

  45. source /home/oracle/.bash_profile

  46. #oracle's ulimit

  47. printf

  48. "oracle soft nproc 2047 \n

  49. oracle hard nproc 16384 \n

  50. oracle soft nofile 1024 \n

  51. oracle hard nofile 65536 \n" >> /etc/security/limits.conf

  52. echo "Please make sure your hostname and host file configure ok."