码迷,mamicode.com
首页 > 数据库 > 详细

[Oracle]-Oracle_script

时间:2017-11-18 12:54:05      阅读:193      评论:0      收藏:0      [点我收藏+]

标签:clean   core   ipa   net   add   china   环境   sed   check   

YUM script

#!/bin/bash
rm -rf /etc/yum.repos.d/*
echo "
[yum]
name=yum
baseurl=file:///mnt/
enabled=1
gpgcheck=0
" > /etc/yum.repos.d/yum.repo
mount /dev/cdrom /mnt &> /dev/null
yum clean all
yum makecache

 Oracle script

#!/bin/bash
#配置ip:
sed -i "s/ONBOOT=no/ONBOOT=yes/g" /etc/sysconfig/network-scripts/ifcfg-eth0
sed -i "s/BOOTPROTO=dhcp/BOOTPROTO=static/g" /etc/sysconfig/network-scripts/ifcfg-eth0
echo "IPADDR=172.16.1.1" >> /etc/sysconfig/network-scripts/ifcfg-eth0
echo "NETMASK=255.255.255.0" >>/etc/sysconfig/network-scripts/ifcfg-eth0
service network restart &> /dev/null
#关闭Selinux:
getenforce &> /dev/null
#关闭防火墙:
service iptables stop &> /dev/null
#修改主机名:
hostname oracle.com
bash
#域名解析:
echo  "172.16.1.1     oracle.benet.com" >>  /etc/hosts
#调整内核参数:
echo "fs.aio-max-nr = 1048576" >>/etc/sysctl.conf
echo "fs.file-max = 6815744" >>/etc/sysctl.conf
echo "kernel.shmmni = 4096" >>/etc/sysctl.conf
echo "kernel.sem = 250 32000 100 128" >>/etc/sysctl.conf
echo "net.ipv4.ip_local_port_range = 9000 65500" >>/etc/sysctl.conf
echo "net.core.rmem_default = 262144" >>/etc/sysctl.conf
echo "net.core.rmem_max = 4194304" >>/etc/sysctl.conf
echo "net.core.wmem_default = 262144" >>/etc/sysctl.conf
echo "net.core.wmem_max = 1048586" >>/etc/sysctl.conf
#准备系统软件环境:
yum -y install binutils compat-libstdc++-33 elfutils-libelf elfutils-libelf-devel gcc gcc-c++ glibc glibc-common glibc-devel glibc-headers kernel-headers ksh libaio libaio-devel libgcc libgomp libstdc++ libstdc++-devel make numactl-devel sysstat unixODBC unixODBC-devel &> /dev/null

rpm -e ksh &> /dev/null
rpm -ivh pdksh-5.2.14-36.el5.i386.rpm &> /dev/null
rpm -ivh ksh-20100202-1.el5.i386.rpm &> /dev/null

mkdir -p /usr/share/fonts/zh_CN/TrueType
unzip Oracle字体库zysong.zip  &> /dev/null
cp zysong.ttf /usr/share/fonts/zh_CN/TrueType/
#创建用户:
groupadd -g 66 oinstall
groupadd -g 77 oracle
useradd -g oinstall -G oracle oracle
echo123.com‘ | passwd --stdin oracle &> /dev/null
#赋予权限:
mkdir /opt/oracle
chown -R oracle:oinstall /opt/oracle
chmod -R 775 /opt/oracle
#添加:
echo umask 022 >>/home/oracle/.bash_profile
echo export ORACLE_BASE=/opt/oracle >>/home/oracle/.bash_profile
echo export ORACLE_HOME=$ORACLE_BASE/product/11.2/db_1 >>/home/oracle/.bash_profile
echo export ORACLE_SID=orcl >>/home/oracle/.bash_profile
echo export LANG=zh_CN.UTF-8 >>/home/oracle/.bash_profile
echo export NLS_LANG="SIMPLIFIED CHINESE_CHINA.AL32UTF8" >>/home/oracle/.bash_profile
echo export PATH=$ORACLE_HOME/bin:$PATH >>/home/oracle/.bash_profile
echo "export DISPLAY=:0.0" >>/home/oracle/.bash_profile
#资源限制:
echo "session required /lib/security/pam_limits.so" >>/etc/pam.d/login
echo "session required pam_limits.so" >>/etc/pam.d/login
#资源限制:
echo "oracle soft nproc 8192" >>/etc/security/limits.conf
echo "oracle hard nproc 16384" >>/etc/security/limits.conf
echo "oracle soft nofile 32768" >>/etc/security/limits.conf
echo "oracle hard nofile 65536" >>/etc/security/limits.conf
echo "oracle soft stack 10240" >>/etc/security/limits.conf

mkdir /mnts
mount /dev/cdrom1 /mnts
mkdir /database cp -r /mnts/* /database/ xhost + &> /dev/null xhost + &> /dev/null su - oracle cd /database/ ./runInstaller

安装两个光盘

centos6.5挂载到/mnt下

Oracle挂载到自定义的/mnts下

注意第一次挂载的事cdrom,第二个是cdrom2

oracle.sh脚本注:执行完成脚本 须重新启动虚拟机 

重启之后在root界面重新执行xhost + ,否则会报错

 

[Oracle]-Oracle_script

标签:clean   core   ipa   net   add   china   环境   sed   check   

原文地址:http://www.cnblogs.com/chenwz/p/7856249.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!