#!/bin/sh
groupadd -g 1200 oinstall
groupadd -g 1201 dba
groupadd -g 1202 oper
groupadd -g 1203 asmadmin
groupadd -g 1204 asmdba
groupadd -g 1205 asmoper
useradd -m -u 1200 -g oinstall -G dba,asmdba,oper oracle
## /etc/sysctl.conf 根据各自系统调整参数值
echo 'fs.aio-max-nr = 4194304 ' >> /etc/sysctl.conf
echo 'fs.file-max = 6815744 ' >> /etc/sysctl.conf
echo 'kernel.shmall = 2097152 ' >> /etc/sysctl.conf
echo 'kernel.shmmax = 4294967295 ' >> /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
sysctl -p
mkdir -p /work/oracle/app/oracle/product/11.2.0/dbhome_1
chown -R oracle:oinstall /work/oracle
##/home/oracle/.profile
echo 'export PATH=.:$PATH' >> /home/oracle/.profile
echo 'export ORACLE_BASE=/work/oracle/app/oracle' >> /home/oracle/.profile
echo 'export ORACLE_HOME=/work/oracle/app/oracle/product/11.2.0/dbhome_1' >> /home/oracle/.profile
echo 'export PATH=$ORACLE_HOME/bin:$PATH' >> /home/oracle/.profile
echo 'export ORACLE_SID=CRMS02' >> /home/oracle/.profile
echo 'export NLS_LANG=AMERICAN_AMERICA.ZHS16GBK' >> /home/oracle/.profile
##/etc/security/limits.conf
echo 'oracle soft nofile 65536' >> /etc/security/limits.conf
echo 'oracle hard nofile 65536' >> /etc/security/limits.conf
echo 'oracle soft nproc 65535' >> /etc/security/limits.conf
echo 'oracle hard nproc 65535' >> /etc/security/limits.conf
echo 'oracle soft stack 10240' >> /etc/security/limits.conf
echo 'oracle hard stack 32768' >> /etc/security/limits.conf
##/etc/fstab
echo 'shm /dev/shm tmpfs size=36G 0 0' >> /etc/fstab
fuser -mk /dev/shm
mount -o remount rw, /dev/shm