安裝oracl 前期工作
#!/bin/bash
#This program is used for helping you install oracle10g automatically.
#Be used in Redhat 5 enterprise.
#Statment:Before installing oracle10g by this program,you should prepare oracle10g tar.gz file, rlwrap and redhat install CD path.If you have any question about this program,you could contact me by the following email address.
#Author:Xinggang
#Written on xxxx
trap 'echo;exit 0;' 2 #Set trap,so you can interrupt the program when it is running.
shmmax=$(($(free |awk 'NR==2{print $2}')*1024/2)) #Set the argument "shmmax" according to the memory size of your computer.
read -p "Please input the oracle username that you want to create:" ooname
read -p "Please verify the oracle username:" oname
until [ ! -z "$oname" ] #Make judgment about if the variable $oname you given is null.
do
read -p "Please verify the oracle username:" oname
done
username=$(awk -F: '{print $1}' /etc/passwd)
for i in $username #Judge about if $oname already exists in your system.
do
if [ $oname = $i ]
then
echo "Error!The username you input is already exists in your system."; exit 1
fi
done
until [ ${oname}x = ${ooname}x ] #Make sure that the input is the very one which you want.
do
read -p "Please input the oracle username that you want to create:" ooname
read -p "Please verify the oracle username:" oname
if [ -z "$oname" ] #If $oname is still null,then exit this program.
then
echo "Error!"
exit 1
fi
done
read -p "Please input rlwrap path:" rlpath
read -p "Please input the path of CD:" cdpath
until [ -e "$cdpath"/Server ] #Make sure the path that you given is right.
do
read -p "Wrong path of CD,please retry:" cdpath
done
read -p "Please input your oracle tar.gz package name(include path) :" opackage
if [ ! -f "$opackage" ]
then
echo "The package is wrong!"
exit 1
fi
{
groupadd oinstall
groupadd dba
useradd -m -g oinstall -G dba $oname
mkdir -p /u01/app/$oname
chown -R $oname:oinstall /u01/app/$oname
chmod -R 775 /u01/app/$oname
}&>/dev/null
tar -zxf $opackage -C /home/$oname &>/dev/null
until [ "$?" -eq "0" ] #Make sure that the package you given is absolutely right.
do
read -p "Wrong package,please retry:" opachage
tar -zxf $opackage -C /home/$oname &>/dev/null
done
pushd $cdpath/Server &>/dev/null
{
rpm -Uvh compat-db-4*
rpm -Uvh libaio-0*
rpm -Uvh compat-libstdc++-33-3*
rpm -Uvh compat-gcc-34-3*
rpm -Uvh compat-gcc-34-c++-3*
rpm -Uvh libXp-1*
rpm -Uvh openmotif-2*
rpm -Uvh gcc-4*
}&>/dev/null
#rpm -Uvh glibc-2.5-12.i686.rpm
popd &>/dev/null
flag=0
{
pushd $rlpath
$rlpath/configure
make && make install
popd
}&>/dev/null
if [ "$?" -eq "1" ] #Be used for judging if rlwrap was compiled successfully.
then
flag=1
fi
grep 'fs.file-max' /etc/sysctl.conf &>/dev/null
if [ "$?" -eq "1" ] #Make jugdement if the configure file was already configured.
then
sed -i '/^kernel.shmmax/d' /etc/sysctl.conf #Delete the argument "kernerl.shmmax" in the configure file.
sed -i '/^kernel.shmall/d' /etc/sysctl.conf #Delete the argument "kernel.shmall" in the configure file
cat >> /etc/sysctl.conf <kernel.shmall = 2097152
kernel.shmmax = $shmmax
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=262144
net.core.rmem_max=262144
net.core.wmem_default=262144
net.core.wmem_max=262144
#signaturelevin
EOF
fi
sysctl -p &>/dev/null #Make the configured file come into effect immediately.
grep 'soft nproc' /etc/security/limits.conf &>/dev/null
if [ "$?" -eq "1" ]
then
cat >> /etc/security/limits.conf <soft nproc 2047
hard nproc 16384
soft nofile 1024
hard nofile 65536
#signaturelevin
EOF
fi
grep 'pam_limits.so' /etc/pam.d/login &>/dev/null
if [ "$?" -eq "1" ]
then
cat >> /etc/pam.d/login <session required pam_limits.so
#signaturelevin
EOF
fi
grep 'ORACLE_SID=orcl' /home/$oname/.bash_profile &>/dev/null
if [ "$?" -eq "1" ]
then
cat >>/home/$oname/.bash_profile <export TMP=/tmp
export ORACLE_BASE=/u01/app/$oname
export ORACLE_HOME=\$ORACLE_BASE/product/10g
export ORACLE_SID=orcl
export PATH=\$ORACLE_HOME/bin:\$PATH
export LD_LIBRARY_PATH=\$ORACLE_HOME/lib:/lib:/usr/lib
export CLASSPATH=\$ORACLE_HOME/JRE:\$ORACLE_HOME/jlib:\$ORACLE_HOME/rdbms/jlib
alias sqlplus="rlwrap sqlplus"
alias rman="rlwrap rman"
alias fox="firefox"
#signaturelevin
EOF
fi
. /home/$oname/.bash_profile
sed -i 's/5/4/' /etc/redhat-release #Resovling the problems brought by the version of your system.
xhost + &>/dev/null
echo -e "\a"
if [ "$flag" -eq "1" ]
then
echo -e "Configure successful but the rlwrap was not compiled successfully.You should compile it by your own after finishing installs of oracle10g.Now,the following steps are your own work.\n \n 1.export LANG=C \n 2.cd database/\n 3../runInstaller\n 4.Configure according to the Oracle GUI information.\n"
else
echo -e "Configure successful!The following steps are your own work.Just do it.\n \n 1.export LANG=C \n 2.cd database/\n 3../runInstaller\n 4.Configure according to the Oracle GUI information.\n"
fi
su - $oname
#This program is used for helping you install oracle10g automatically.
#Be used in Redhat 5 enterprise.
#Statment:Before installing oracle10g by this program,you should prepare oracle10g tar.gz file, rlwrap and redhat install CD path.If you have any question about this program,you could contact me by the following email address.
#Author:Xinggang
#Written on xxxx
trap 'echo;exit 0;' 2 #Set trap,so you can interrupt the program when it is running.
shmmax=$(($(free |awk 'NR==2{print $2}')*1024/2)) #Set the argument "shmmax" according to the memory size of your computer.
read -p "Please input the oracle username that you want to create:" ooname
read -p "Please verify the oracle username:" oname
until [ ! -z "$oname" ] #Make judgment about if the variable $oname you given is null.
do
read -p "Please verify the oracle username:" oname
done
username=$(awk -F: '{print $1}' /etc/passwd)
for i in $username #Judge about if $oname already exists in your system.
do
if [ $oname = $i ]
then
echo "Error!The username you input is already exists in your system."; exit 1
fi
done
until [ ${oname}x = ${ooname}x ] #Make sure that the input is the very one which you want.
do
read -p "Please input the oracle username that you want to create:" ooname
read -p "Please verify the oracle username:" oname
if [ -z "$oname" ] #If $oname is still null,then exit this program.
then
echo "Error!"
exit 1
fi
done
read -p "Please input rlwrap path:" rlpath
read -p "Please input the path of CD:" cdpath
until [ -e "$cdpath"/Server ] #Make sure the path that you given is right.
do
read -p "Wrong path of CD,please retry:" cdpath
done
read -p "Please input your oracle tar.gz package name(include path) :" opackage
if [ ! -f "$opackage" ]
then
echo "The package is wrong!"
exit 1
fi
{
groupadd oinstall
groupadd dba
useradd -m -g oinstall -G dba $oname
mkdir -p /u01/app/$oname
chown -R $oname:oinstall /u01/app/$oname
chmod -R 775 /u01/app/$oname
}&>/dev/null
tar -zxf $opackage -C /home/$oname &>/dev/null
until [ "$?" -eq "0" ] #Make sure that the package you given is absolutely right.
do
read -p "Wrong package,please retry:" opachage
tar -zxf $opackage -C /home/$oname &>/dev/null
done
pushd $cdpath/Server &>/dev/null
{
rpm -Uvh compat-db-4*
rpm -Uvh libaio-0*
rpm -Uvh compat-libstdc++-33-3*
rpm -Uvh compat-gcc-34-3*
rpm -Uvh compat-gcc-34-c++-3*
rpm -Uvh libXp-1*
rpm -Uvh openmotif-2*
rpm -Uvh gcc-4*
}&>/dev/null
#rpm -Uvh glibc-2.5-12.i686.rpm
popd &>/dev/null
flag=0
{
pushd $rlpath
$rlpath/configure
make && make install
popd
}&>/dev/null
if [ "$?" -eq "1" ] #Be used for judging if rlwrap was compiled successfully.
then
flag=1
fi
grep 'fs.file-max' /etc/sysctl.conf &>/dev/null
if [ "$?" -eq "1" ] #Make jugdement if the configure file was already configured.
then
sed -i '/^kernel.shmmax/d' /etc/sysctl.conf #Delete the argument "kernerl.shmmax" in the configure file.
sed -i '/^kernel.shmall/d' /etc/sysctl.conf #Delete the argument "kernel.shmall" in the configure file
cat >> /etc/sysctl.conf <
kernel.shmmax = $shmmax
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=262144
net.core.rmem_max=262144
net.core.wmem_default=262144
net.core.wmem_max=262144
#signaturelevin
EOF
fi
sysctl -p &>/dev/null #Make the configured file come into effect immediately.
grep 'soft nproc' /etc/security/limits.conf &>/dev/null
if [ "$?" -eq "1" ]
then
cat >> /etc/security/limits.conf <
hard nproc 16384
soft nofile 1024
hard nofile 65536
#signaturelevin
EOF
fi
grep 'pam_limits.so' /etc/pam.d/login &>/dev/null
if [ "$?" -eq "1" ]
then
cat >> /etc/pam.d/login <
#signaturelevin
EOF
fi
grep 'ORACLE_SID=orcl' /home/$oname/.bash_profile &>/dev/null
if [ "$?" -eq "1" ]
then
cat >>/home/$oname/.bash_profile <
export ORACLE_BASE=/u01/app/$oname
export ORACLE_HOME=\$ORACLE_BASE/product/10g
export ORACLE_SID=orcl
export PATH=\$ORACLE_HOME/bin:\$PATH
export LD_LIBRARY_PATH=\$ORACLE_HOME/lib:/lib:/usr/lib
export CLASSPATH=\$ORACLE_HOME/JRE:\$ORACLE_HOME/jlib:\$ORACLE_HOME/rdbms/jlib
alias sqlplus="rlwrap sqlplus"
alias rman="rlwrap rman"
alias fox="firefox"
#signaturelevin
EOF
fi
. /home/$oname/.bash_profile
sed -i 's/5/4/' /etc/redhat-release #Resovling the problems brought by the version of your system.
xhost + &>/dev/null
echo -e "\a"
if [ "$flag" -eq "1" ]
then
echo -e "Configure successful but the rlwrap was not compiled successfully.You should compile it by your own after finishing installs of oracle10g.Now,the following steps are your own work.\n \n 1.export LANG=C \n 2.cd database/\n 3../runInstaller\n 4.Configure according to the Oracle GUI information.\n"
else
echo -e "Configure successful!The following steps are your own work.Just do it.\n \n 1.export LANG=C \n 2.cd database/\n 3../runInstaller\n 4.Configure according to the Oracle GUI information.\n"
fi
su - $oname
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/23757700/viewspace-723343/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- Oracl11G靜默安裝-6
- Oracl11G靜默安裝-5
- Oracl11G靜默安裝-4
- Oracl11G靜默安裝-3
- Oracl11G靜默安裝-2
- Oracl11G靜默安裝-1
- Oracl資料庫+PL/SQL安裝與配置資料庫SQL
- Goldengate異構 mysql——>oraclGoMySql
- Oracl 發生鎖表--解鎖sqlSQL
- 關於web開發前期工作的一點想法Web
- codis安裝 (java 安裝 + zookeeper 安裝 + go 安裝 + codis 安裝JavaGo
- 安裝npm 解除安裝npm 安裝apidocNPMAPI
- mysql安裝 (yum 安裝)MySql
- MMM安裝、MHA安裝
- 中俄原油管道前期工作順利 接近具體實施階段
- mysql安裝------RPM包安裝及解除安裝MySql
- oracle安裝:OUI安裝Oracle(圖形介面安裝)OracleUI
- ffmpeg安裝之mac安裝Mac
- docker安裝及解除安裝Docker
- 02 安裝git、安裝TortoiseGitGit
- Ubuntu解除安裝和安裝Ubuntu
- Orace RAC安裝-DNS安裝DNS
- caffe安裝系列——安裝OpenCVOpenCV
- SPARK 安裝之scala 安裝Spark
- mac 安裝opencv homebrew安裝MacOpenCV
- Oracle 安裝與解除安裝Oracle
- solaris mysql 安裝 解除安裝MySql
- BiocManager安裝,devtools安裝dev
- JDK安裝和解除安裝JDK
- 怎樣使用castor 存取oracl資料庫中的blobAST資料庫
- ORACL Data Gurad支援異構平臺說明
- 安裝HomeBrew提示已安裝並無法解除安裝
- SQL Server 2012 安裝——安裝 OR 解除安裝SQLServer
- win10安裝版怎麼安裝_安裝版win10安裝教程Win10
- mysql安裝-----二進位制包安裝及解除安裝MySql
- cocoapods安裝/解除安裝/使用
- Mac Redis安裝與解除安裝MacRedis
- [ 安裝 ] Zeppelin安裝步驟!