preOracle.sh

2021/8/16 2:05:39

本文主要是介绍preOracle.sh,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!

#!/bin/bash
#
#
############################
#Define global variable

ORA_INST_DIR=/u01/app
ORA_SID=hworcl
ORA_VER=12.1.0

#####################################
#关闭防火墙,禁止防火墙开机自启
systemctl stop firewalld.service 
systemctl disable firewalld.service

#禁用SELINUX
setenforce 0
sed -i 's/SELINUX=enforcing/SELINUX=disabled/g' /etc/selinux/config

cat>/etc/sysctl.d/oracle_12c.conf<<EOF
# Oracle database 12c
fs.aio-max-nr = 1048576
fs.file-max = 6815744
kernel.shmall = 2097152
kernel.shmmax = 6442450944
kernel.shmmni = 4096
kernel.sem = 250 32000 100 128
kernel.panic_on_oops = 1
net.ipv4.ip_local_port_range = 9000 65500
net.core.rmem_default = 262144
net.core.rmem_max = 4194304
net.core.wmem_default = 262144
net.core.wmem_max = 1048586
EOF
sysctl -p /etc/sysctl.d/oracle_12c.conf


cat>>/etc/security/limits.conf<<EOF
# Oracle database 12c
oracle soft nproc 2047
oracle hard nproc 16384
oracle soft nofile 1024
oracle hard nofile 65536
oracle soft stack 10240
EOF

cat>>/etc/pam.d/login<<EOF
# Oracle database 12c
session required /lib64/security/pam_limits.so
session required pam_limits.so
EOF

#创建oracle用户
groupadd -g 51111 oinstall
groupadd -g 51112 dba
useradd  -u 51112 -g oinstall -G dba oracle

#创建目录并赋权
mkdir -p ${ORA_INST_DIR}/{data,oracle}
chown -R oracle:oinstall ${ORA_INST_DIR}
chmod -R 775 ${ORA_INST_DIR}

#关闭内存大叶
echo never > /sys/kernel/mm/transparent_hugepage/enabled

#oracle用户环境变量
cat>>/home/oracle/.bash_profile<<EOF
# Oracle database 12c
export ORACLE_VERSION=${ORA_VER}
export ORACLE_BASE=${ORA_INST_DIR}/oracle
export ORACLE_HOME=\${ORACLE_BASE}/product/\${ORACLE_VERSION}/db_1
export ORACLE_SID=${ORA_SID}
export PATH=$PATH:\$ORACLE_HOME/bin
alias sqlplus='rlwrap sqlplus'
alias rman='rlwrap rman'
export LC_ALL="en_US"
export LANG="en_US"
export NLS_LANG="AMERICAN_AMERICA.ZHS16GBK"
export NLS_DATE_FORMAT="YYYY-MM-DD HH24:MI:SS"
EOF

cat>>/etc/profile<<'EOF'
if [ $USER = "oracle" ]; then
   if [ $SHELL = "/bin/ksh" ]; then
       ulimit -p 16384
       ulimit -n 65536
    else
       ulimit -u 16384 -n 65536
   fi
fi
EOF


cat>${ORA_INST_DIR}/data/db_install.rsp<<EOF
oracle.install.option=INSTALL_DB_SWONLY
DECLINE_SECURITY_UPDATES=true
UNIX_GROUP_NAME=oinstall
INVENTORY_LOCATION=${ORA_INST_DIR}/inventory
SELECTED_LANGUAGES=en,zh_CN
ORACLE_HOSTNAME=oracledb
ORACLE_HOME=${ORA_INST_DIR}/oracle/product/11.2.0
ORACLE_BASE=${ORA_INST_DIR}/oracle
oracle.install.db.InstallEdition=EE
oracle.install.db.isCustomInstall=true
oracle.install.db.DBA_GROUP=dba
oracle.install.db.OPER_GROUP=dba
EOF

 https://blog.csdn.net/chenghuikai/article/details/85776622



这篇关于preOracle.sh的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!


扫一扫关注最新编程教程