Oracle 10g 安裝環境配置指令碼
#!/bin/bash
#Test in RHEL 5.5 for 10g
c=`cat /etc/shadow | grep oracle | wc -l`
if [ $c != 0 ]
then
w=0
while [ $w -eq 0 ]
do
echo "--Find user oracle has been existed!--"
echo "--Do you want to delete user oracle?[yes/no]:"
read yn
case $yn in
"yes")
gpasswd -d oracle dba
userdel -r oracle
rm -fr /home/oracle
echo "--User oracle has been deleted.--"
/usr/sbin/groupadd oinstall
/usr/sbin/groupadd dba
/usr/sbin/useradd -g oinstall -G dba oracle
echo "--Please set user oracle's password--"
passwd oracle
echo "--password is ok!--"
w=1
;;
"no")
echo "--I will not delete user oracle!--"
w=1
;;
*)
echo "--Please input yes or no!--"
w=0
;;
esac
done
else
/usr/sbin/groupadd oinstall
/usr/sbin/groupadd dba
/usr/sbin/useradd -g oinstall -G dba oracle
echo "--Please set user oracle's password."
passwd oracle
echo "--password is ok!--"
fi
mkdir -p /u01/app/oracle
chown -R oracle:oinstall /u01
chmod -R 775 /u01
sed -i '/kernel.shmmax/d' /etc/sysctl.conf
sed -i '/kernel.shmall/d' /etc/sysctl.conf
sed -i '/kernel.shmmni/d' /etc/sysctl.conf
sed -i '/kernel.sem/d' /etc/sysctl.conf
sed -i '/fs.file-max/d' /etc/sysctl.conf
sed -i '/net.ipv4.ip_local_port_range/d' /etc/sysctl.conf
sed -i '/net.core.rmem_default/d' /etc/sysctl.conf
sed -i '/net.core.rmem_max/d' /etc/sysctl.conf
sed -i '/net.core.wmem_default/d' /etc/sysctl.conf
sed -i '/net.core.wmem_max/d' /etc/sysctl.conf
sed -i "/#fordelbegin/,/#fordelend/d" /etc/sysctl.conf
cat >> /etc/sysctl.conf << "EOF"
#fordelbegin#################################
#use for oracle
kernel.shmmax = 2147483648
kernel.shmall = 2097152
kernel.shmmni = 4096
kernel.sem = 250 32000 100 128
fs.file-max = 65536
net.ipv4.ip_local_port_range = 1024 65000
net.core.rmem_default = 1048576
net.core.rmem_max = 1048576
net.core.wmem_default = 262144
net.core.wmem_max = 262144
#fordelend
EOF
/sbin/sysctl -p
echo "--/ect/sysctl.conf is ok!--"
sed -i "/#fordelbegin/,/#fordelend/d" /etc/security/limits.conf
cat >> /etc/security/limits.conf << "EOF"
#fordelbegin#################################
#use for oracle
oracle soft nproc 2047
oracle hard nproc 16384
oracle soft nofile 1024
oracle hard nofile 65536
#fordelend
EOF
echo "--/etc/security/limits.conf is ok!--"
sed -i "/#fordelbegin/,/#fordelend/d" /etc/pam.d/login
cat >> /etc/pam.d/login << "EOF"
#fordelbegin#################################
#use for oracle
#session required /lib64/security/pam_limits.so #for 64
session required /lib/security/pam_limits.so #for 32
session required pam_limits.so
#fordelend
EOF
echo "--/etc/pam.d/login is ok!--"
sed -i "/#fordelbegin/,/#fordelend/d" /etc/profile
cat >> /etc/profile << "EOF"
#fordelbegin#################################
#use for oracle
if [ $USER = "oracle" ]; then
if [ $SHELL = "/bin/ksh" ]; then
ulimit -p 16384
ulimit -n 65536
else
ulimit -u 16384 -n 65536
fi
fi
#fordelend
EOF
echo "--/etc/profile is ok!--"
sed -i "/#fordelbegin/,/#fordelend/d" /home/oracle/.bash_profile
cat >> /home/oracle/.bash_profile << "EOF"
#fordelbegin#################################
#use for oracle
umask 022
ORACLE_BASE=/u01/app/oracle
ORACLE_HOME=$ORACLE_BASE/product/10.2.0/db_1
ORACLE_SID=db01
PATH=$ORACLE_HOME/bin:$PATH
LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib
NLS_LANG=AMERICAN_AMERICA.ZHS16GBK
export ORACLE_BASE ORACLE_HOME ORACLE_SID PATH LD_LIBARY_PATH NLS_LANG
#fordelend
EOF
echo "--Please set you oracle_sid:"
read orasid
sed -i "s/db01/$orasid/g" /home/oracle/.bash_profile
source /home/oracle/.bash_profile
echo "--/home/oracle/.bash_profile is ok!--"
echo "--Config is OK!--"
echo "--Dont forget to vi your /etc/hosts.--"
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/27633655/viewspace-1081031/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- Git環境配置與安裝Git
- GoLand安裝及環境配置GoLand
- scala安裝及環境配置
- Java安裝和環境配置Java
- Linux環境HBase安裝配置Linux
- angular環境配置及安裝Angular
- Linux環境Azkaban安裝配置Linux
- 關於python Miniconda的指令碼安裝及 環境控制Python指令碼
- ORACLE windows和linux環境下 10g升級到11.2.0.4 並安裝11.2.0.4.19補丁OracleWindowsLinux
- ISO 映象安裝oracle 10gOracle 10g
- Python 環境配置(三)安裝pytorchPythonPyTorch
- MacOS Flutter環境配置和安裝MacFlutter
- QT Creator配置環境和安裝QT
- [JAVA] JAVA 8 環境安裝配置Java
- Linux環境下nginx安裝配置LinuxNginx
- Expo 環境配置和安裝指南
- 安裝gnome桌面環境配置工具
- Docker 下安裝配置 lnmp 環境DockerLNMP
- jdk安裝,環境變數配置JDK變數
- Mac環境下安裝配置RedisMacRedis
- Linux環境安裝Oracle11g(一)——配置檢查及依賴項安裝LinuxOracle
- linux下expect環境安裝以及簡單指令碼測試Linux指令碼
- 新入手 mac,需要配置環境,索性就建立了一鍵安裝指令碼(homebrew+omz)Mac指令碼
- [Oracle] -- 配置Oracle環境變數Oracle變數
- Node.js安裝及環境配置Node.js
- Java軟體安裝以及環境配置Java
- Linux環境Spark安裝配置及使用LinuxSpark
- Win 10 環境配置VirtualBox安裝UbuntuUbuntu
- Linux環境Flume安裝配置及使用Linux
- Python開發環境的安裝配置Python開發環境
- Linux環境Sqoop安裝配置及使用LinuxOOP
- Linux環境Hive安裝配置及使用LinuxHive
- 安裝與配置Flutter開發環境Flutter開發環境
- Python+Selenium安裝及環境配置Python
- 安裝python虛擬環境並配置虛擬環境以及安裝scrapy模組Python
- Linux環境安裝Oracle11g(三)——使用者、路徑建立及配置環境變數LinuxOracle變數
- Oracle Restart環境下的開機啟動指令碼OracleREST指令碼
- Linux 使用Yum安裝Go和配置環境LinuxGo
- jenkins簡單安裝及配置(Windows環境JenkinsWindows