Chinaunix首页 | 论坛 | 博客
  • 博客访问: 231641
  • 博文数量: 57
  • 博客积分: 955
  • 博客等级: 准尉
  • 技术积分: 587
  • 用 户 组: 普通用户
  • 注册时间: 2010-11-14 13:30
文章分类

全部博文(57)

文章存档

2012年(2)

2011年(55)

分类: LINUX

2011-06-16 01:21:54

朋友奇度,oracle dba,写的脚本,我又加了几个地方,
放出来与大家share一下,刚dota了两把,嘿嘿准备睡觉
  1. #!/bin/bash
  2. # oracle
  3. # written by 奇度 && 辉少
  4. # time:2011-06-16 1:17
  5. # ORACLE_BASE=/u01
  6. echo "please ensure your redhat_iso_cd has insert into\n"
  7. HOSTNAME=oracle
  8. echo "\n#################\n"
  9. read -t 5 -p "Please enter ORACLE_BASE(default /u01):" ORACLE_BASE
  10. if [ -z $ORACLE_BASE ]
  11. then
  12. ORACLE_BASE=/u01
  13. fi
  14. echo "\n#################\n"
  15. # ORACLE_HOME=$ORACLE_BASE/oracle
  16. read -t 5 -p "Please enter HOME(default oracle):" HOME
  17. if [ -z $HOME ]
  18. then
  19. HOME=oracle
  20. fi
  21. ORACLE_HOME=$ORACLE_BASE/$HOME
  22. echo "\n#################\n"
  23. # ORACLE_SID=orcl
  24. read -p "Please enter ORACLE_SID(default orcl):" -t 5 ORACLE_SID
  25. if [ -z $ORACLE_SID ]
  26. then
  27. ORACLE_SID=orcl
  28. fi
  29. echo "\n#################\n"
  30. USER=oracle
  31. SYSCTL=/etc/sysctl.conf
  32. LIMITS=/etc/security/limits.conf
  33. PAM=/etc/pam.d/login
  34. YUM=/etc/yum.repos.d
  35. PROFILE=/etc/profile
  36. BASH_PROFILE=$ORACLE_HOME/.bash_profile
  37. IPADDR=`ifconfig eth0|grep "inet addr"|cut -d : -f 2|cut -d ' ' -f 1`
  38. HOSTS=/etc/hosts
  39. NETWORK=/etc/sysconfig/network
  40. # rpm install
  41. mount /dev/hdc /mnt
  42. cd $YUM
  43. find ./ -name "*.repo" -exec mv {} /tmp \;
  44. yum clean all
  45. cat >> $YUM/server.repo << !
  46. [base]
  47. name = server
  48. baseurl=file:///mnt/Server
  49. gpgcheck=0
  50. enable=1
  51. !
  52. yum install binutils compat-db control-center gcc gcc-c++ glibc libXp-1.0.0 libstdc++ libstdc++-devel -y
  53. yum install make openmotif control-center -y
  54. find /tmp -name "*.repo" -exec mv {} $YUM \
  55. rm -rf $YUM/server.repo
  56. yum clean all
  57. # hostname
  58. grep -v "HOSTNAME" $NETWORK > $NETWORK
  59. echo "HOSTNAME=$HOSTNAME" >> $NETWORK
  60. echo "$IPADDR $HOSTNAME">> $HOSTS
  61. hostname $HOSTNAME
  62. # useradd
  63. mkdir -p $ORACLE_BASE
  64. groupadd oinstall
  65. groupadd dba
  66. useradd -g oinstall -G dba -d $ORACLE_HOME $USER
  67. chown -R $USER:oinstall $ORACLE_BASE
  68. echo redhat | passwd --stdin $USER
  69. cat >> $SYSCTL << EOF
  70. kernel.shmall = 2097152
  71. kernel.shmmax = 2147483648
  72. kernel.shmmni = 4096
  73. kernel.sem = 250 32000 100 128
  74. net.ipv4.ip_local_port_range = 1024 65000
  75. net.core.rmem_default = 262144
  76. net.core.rmem_max = 4194304
  77. net.core.wmem_default = 262144
  78. net.core.wmem_max = 262144
  79. EOF
  80. cat >> $LIMITS <
  81. oracle soft nproc 2047
  82. oracle hard nproc 16384
  83. oracle soft nofile 1024
  84. oracle hard nofile 65536
  85. EOF
  86. cat >> $PAM <
  87. session required pam_limits.so
  88. EOF
  89. cat >> $PROFILE <
  90. if [ \$USER = "oracle" ]; then
  91. if [ \$SHELL = "/bin/ksh" ]; then
  92. ulimit -p 16384
  93. ulimit -n 65536
  94. else
  95. ulimit -u 16384 -n 65536
  96. fi
  97. fi
  98. EOF
  99. cat >> $BASH_PROFILE <
  100. ORACLE_BASE=\$ORACLE_BASE
  101. ORACLE_HOME=\$ORACLE_BASE/oracle
  102. ORACLE_SID=twtcom
  103. PATH=\$ORACLE_HOME/bin:\$PATH
  104. export ORACLE_BASE ORACLE_HOME ORACLE_SID PATH
  105. EOF
  106. sysctl -p
  107. /etc/init.d/network restart
  108. #####################################################################
  109. # configure redhat version
  110. mv /etc/redhat-release /tmp/redhat-release.bak
  111. cat >> /etc/redhat-release << !
  112. Red Hat Enterprise Linux AS release 3 (Taroon)
  113. !
  114. # the end

阅读(1424) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~