大家好,我是考100分的小小码 ,祝大家学习进步,加薪顺利呀。今天说一说shell 一键配置单实例oracle基础环境变量(linux7)[通俗易懂],希望您对编程的造诣更进一步.
#!/bin/bash echo "修改主机名" hostnamectl set-hostname wangxfa hostname sleep 1 echo "查看并关闭防火墙" systemctl status firewalld systemctl stop firewalld systemctl disable firewalld systemctl status firewalld sleep 1 echo "禁用Selinux" sed -i "s/SELINUX=enforcing/SELINUX=disabled/g" /etc/selinux/config #add user and group echo "创建安装oracle所需的用户和组" groupadd -g 1030 oinstall groupadd -g 1031 dba useradd -u 54321 -g oinstall -G dba oracle echo "oracle" | passwd --stdin "oracle" echo "创建oracle相关目录" sleep 1 mkdir –p /u01/app/oracle/product/11.2.0 chmod -R 775 /u01 chown -R oracle:oinstall /u01 echo "备份并修改/etc/securitylimits.conf" sleep 1 cp /etc/security/limits.conf /etc/security/limits_bake.conf echo "oracle soft nproc 2047" >>/etc/security/limits.conf echo "oracle hard nproc 16384" >>/etc/security/limits.conf echo "oracle soft nofile 1024" >>/etc/security/limits.conf echo "oracle hard nofile 65536" >>/etc/security/limits.conf echo "备份并修改/etc/sysctl.conf文件" sleep 1 cp /etc/sysctl.conf /etc/sysctl_bak.conf echo "fs.file-max = 6815744" >>/etc/sysctl.conf echo "fs.aio-max-nr = 1048576" >>/etc/sysctl.conf echo "kernel.shmall = 1677721" >>/etc/sysctl.conf (注:此处需要根据shmmax大小来计算,shmmax/PAGESIZE 则计算为 6871947673/4K=1677721) echo "kernel.shmmax = 6871947673" >>/etc/sysctl.conf (注:此处需要根据实际内存大小来计算,加入内存大小为8G,将内存的80%用于数据库,计算方法:1024*1024*1024*8*08=6871947673) 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 = 4194304" >>/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 = 1048576" >>/etc/sysctl.conf echo "使sysctl.conf立即生效" sysctl -p sleep 1 echo "备份并修改/etc/profile文件" cp /etc/profile /etc/profile_bak echo "if [ $USER = "oracle" ]; then" >>/etc/profile echo "if [ $SHELL = "/bin/ksh" ]; then" >>/etc/profile echo "ulimit -p 16384" >>/etc/profile echo "ulimit -n 65536" >>/etc/profile echo "else " >>/etc/profile echo "ulimit -u 16384 -n 65536" >>/etc/profile echo "fi" >>/etc/profile echo "fi" >>/etc/profile echo "设置oracle用户环境变量" su - oracle cp /home/oracle/.bash_profile /home/oracle/.bash_profile_bak echo "export ORACLE_BASE=/u01/app/oracle" >>/home/oracle/.bash_profile echo "export ORACLE_HOME=$ORACLE_BASE/product/11.2.0" >>/home/oracle/.bash_profile echo "export PATH=$ORACLE_HOME/bin:$ORACLE_HOME/bin:$PATH" >>/home/oracle/.bash_profile echo "export LD_LIBRARY_PATH=$ORACLE_HOME/lib" >>/home/oracle/.bash_profile echo "#export ORACLE_SID=hisdb1" >>/home/oracle/.bash_profile echo "export NLS_LANG=AMERICAN_AMERICA.ZHS16GBK" >>/home/oracle/.bash_profile echo "export EDITOR=vi" >>/home/oracle/.bash_profile echo "set -o vi" >>/home/oracle/.bash_profile echo "umask 022" >>/home/oracle/.bash_profile
代码100分
版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 举报,一经查实,本站将立刻删除。
转载请注明出处: https://daima100.com/10243.html