Centos 6.8下安裝oracle10g數據庫、


 

一、首先執行以下腳本

more installoracle.sh

#!/bin/bash
# Oracle 10g
# Oracle 10.2.0.1.0
# System CentOS6.8
# created by zclinux@126.com
# at 2017-9-14 11:35

 


#software checking...
echo "configure the yum repository......"
yum -y install binutils compat-libstdc++-33 \
compat-libstdc++-33.i686 elfutils-libelf \
elfutils-libelf-devel gcc gcc-c++ glibc glibc.i686 \
glibc-common glibc-devel glibc-devel.i686 glibc-headers ksh \
libaio libaio.i686 libaio-devel\
libaio-devel.i686 libgcc \
libgcc.i686 libstdc++ libstdc++.i686 \
libstdc++-devel make sysstat &>/dev/null

if [ $? = 0 ]
then echo "the yum is successful"
else echo " the yum is faild"
fi

echo "-----------------------------------------------------------"
echo "yum the libXp"
yum install libXp -y &>/dev/null
yum -y install libXp.i686 &>/dev/null
if [ $? = 0 ]
then echo "the libXp.i686 is successful"
else echo " the libXp.i686 is faild"
fi

echo "-----------------------------------------------------------"
echo "yum the libXtst.i686 "
yum -y install libXtst.i686 --setopt=protected_multilib=false zlib &>/dev/null
if [ $? = 0 ]
then echo "the libXtst.i686 is successful"
else echo " the libXtst.i686 is faild"
fi

echo "-----------------------------------------------------------"
echo "yum the libXt.i686 "
yum -y install libXt.i686 &>/dev/null
if [ $? = 0 ]
then echo "the libXt.i686 is successful"
else echo " the libXt.i686 is faild"
fi

#create oracle groups & users

echo "-----------------------------------------------------------"

if grep -q oinstall /etc/group > /dev/null
then
echo "The oinstall group exist."
else
/usr/sbin/groupadd -g 1100 oinstall
echo "The oinstll group is created successful"
fi
if grep -q dba /etc/group > /dev/null
then
echo "The dba group exist."
else
/usr/sbin/groupadd -g 1200 dba
echo "The dba group is created successful"
fi
if grep -q oracle /etc/passwd > /dev/null
then
userdel -r oracle
useradd -u 777 -g oinstall -G dba oracle
echo oracle | passwd oracle --stdin
echo "The user oracle is created successful"
echo "The oracle's password is [ oracle ] "
else
/usr/sbin/useradd -u 777 -g oinstall -G dba oracle
echo oracle | passwd oracle --stdin
echo "The user oracle is created successful"
echo "The oracle's password is [ oracle ] "
fi

if [ ! -d /u01/app/oracle ]
then
mkdir -p /u01/app/oracle
chown -R oracle.oinstall /u01/app
echo "make the file /u01/app/oracle"
else
chown -R oracle.oinstall /u01/app
echo "the file is exist !"
fi


#configure oracle user profile


echo "export TMP=/tmp" >> ~oracle/.bash_profile
echo 'export TMPDIR=$TMP' >> ~oracle/.bash_profile
echo 'export ORACLE_BASE=/u01/app/oracle' >> ~oracle/.bash_profile
echo 'export ORACLE_HOME=$ORACLE_BASE/product/10.2.0/dbhome_1' >> ~oracle/.bash_profile
echo 'export ORACLE_SID=prod' >> ~oracle/.bash_profile
echo 'export ORACLE_TERM=xterm' >> ~oracle/.bash_profile
echo 'export PATH=/usr/sbin:$PATH' >> ~oracle/.bash_profile
echo 'export PATH=$ORACLE_HOME/bin:$PATH' >> ~oracle/.bash_profile
echo 'export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib' >> ~oracle/.bash_profile
echo 'export CLASSPATH=$ORACLE_HOME/jre:$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib' >> ~oracle/.bash_profile

 

#install oracle shell scripts
#auther: Matrix
#oracle 10g installation

if [ $? -eq 0 ];then
echo "Software is ready for install oracle!"
fi


#configure the red-release
echo "-----------------------------------------------------------"
echo 'redhat-4' > /etc/redhat-release
echo "/etc/redhat-release is changed"

 


#configure system kernel parameter
echo "-----------------------------------------------------------"
if grep -q 'kernel\.shmall' /etc/sysctl.conf
then
sed -i.bak '/kernel\.shmall/c kernel.shmall = 2097152' /etc/sysctl.conf
else
echo "kernel.shmall = 2097152 " >> /etc/sysctl.conf
fi

if grep -q 'kernel\.shmmax' /etc/sysctl.conf
then
sed -i '/shmmax/c kernel.shmmax = 2147483648' /etc/sysctl.conf
else
echo "kernel.shmmax = 2147483648" >> /etc/sysctl.conf
fi

if grep -q 'kernel\.shmmni' /etc/sysctl.conf
then
sed -i '/shmmni/c kernel.shmmni = 4096' /etc/sysctl.conf
else
echo "kernel.shmmni = 4096" >> /etc/sysctl.conf
fi

if grep -q 'kernel\.sem' /etc/sysctl.conf
then
sed -i '/kernel\.sem/c kernel.sem = 250 32000 100 128' /etc/sysctl.conf
else
echo "kernel.sem = 250 32000 100 128" >> /etc/sysctl.conf
fi

if grep -q 'fs\.file' /etc/sysctl.conf
then
sed -i '/fs\.file/c fs.file-max = 6815744' /etc/sysctl.conf
else
echo "fs.file-max = 6815744" >> /etc/sysctl.conf
fi

if grep -q 'ip_local_port_range' /etc/sysctl.conf
then
sed -i '/port_range/c net.ipv4.ip_local_port_range = 1024 65500' /etc/sysctl.conf
else
echo "net.ipv4.ip_local_port_range = 1024 65500" >> /etc/sysctl.conf
fi

if grep -q 'rmem_default' /etc/sysctl.conf
then
sed -i '/rmem_default/c net.core.rmem_default = 4194304' /etc/sysctl.conf
else
echo "net.core.rmem_default = 4194304" >> /etc/sysctl.conf
fi

if grep -q 'rmem_max' /etc/sysctl.conf
then
sed -i '/rmem_max/c net.core.rmem_max = 4194304' /etc/sysctl.conf
else
echo "net.core.rmem_max = 4194304" >> /etc/sysctl.conf
fi

if grep -q 'wmem_default' /etc/sysctl.conf
then
sed -i '/wmem_default/c net.core.wmem_default = 262144' /etc/sysctl.conf
else
echo "net.core.wmem_default = 262144" >> /etc/sysctl.conf
fi

if grep -q 'wmem_max' /etc/sysctl.conf
then
sed -i '/wmem_max/c net.core.wmen_max = 262144' /etc/sysctl.conf
else
echo "net.core.wmem_max = 262144" >> /etc/sysctl.conf
fi

sysctl -p

#configure system source limit

sed -i.bak '$d' /etc/security/limits.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 "#End of file" >> /etc/security/limits.conf

#solve the ORA-27125 problem
echo 1200 >/proc/sys/vm/hugetlb_shm_group
echo 'echo 1200 >/proc/sys/vm/hugetlb_shm_group' >> /etc/rc.local

#changed the /etc/hosts
IP=$(ifconfig |sed -n '2p'|awk -F " " '{print $2}'|awk -F ":" '{print $2}')
NAME=$(hostname)
echo $IP $NAME >> /etc/hosts
echo "The /etc/hosts is chenged"


#configure the login
echo 'session  required  pam_limits.so' >> /etc/pam.d/login
echo 'session required /lib/security/pam_limits.so' >> /etc/pam.d/login
echo "-------------------------------------------------------------------"
#successful
echo "EVERY THINGS IS SUCCESSFUL ! "

#Prompt
echo "THEN YOU CAN USE THE [ gunzip xxxx.gz ] and [ cpio -idmv < xxxx.cpio ] "
echo " the next step by the DESKTOP!"

二、上傳Oracle10g安裝包,對/home/oracle/database 授權777

三、屬主 屬組 chown -R oracle:oinstall /u01/app/oracle

四、root用戶下執行xhost +

五、執行./runInstaller開始安裝

(注意:我這里用的圖形化安裝工具是vnc,如果沒有,yum安裝一下即可;  yum install -y tigervnc-server  執行vncserver  輸入密碼兩次即可 )

六、開始圖形化界面的安裝:

1.選擇高級安裝

 

2.確認inventory目錄的路徑和相關用戶組

3.選擇安裝企業版

4.確認Oracle家目錄的位置

5.安裝前自檢查

6.僅安裝數據庫軟件

 

后面執行dbcanetca來創建數據庫和監聽

 

7.安裝Oracle軟件

8.安裝中回報一個error,這個是10g的一個bug,忽略continue就可以

9.安裝到最后會彈出一個窗口,運行兩個腳本

Root權限下執行

這兩個腳本分先后順序,先執行1,在執行2,全部執行完成后再點擊ok

10.安裝Oracle成功,退出即可

 

 

DBCA創建數據庫

oracle用戶下執行dbca

1.歡迎頁面

2.創建一個數據庫

3.選擇默認的template即可

4.填寫相關的完整數據庫名稱和sid的名稱

這個要和你的/etc/hostshostname要一致,否則報錯

5.安裝EM企業管理器

這個安裝或者不安裝都可以

6.給相關用戶設定密碼

7.選擇數據存儲的方式

8.選擇template的創建方式

9.設置閃回恢復區的大小和路徑和是否開啟歸檔

10.是否安裝樣例

11.選擇字符集

12.安裝數據庫

NETCA創建監聽和本地服務名

oracle用戶下執行netca圖形化界面安裝

 

1.選擇監聽配置

2.選擇添加監聽

3.設置監聽名稱

4.設置監聽協議

5.選擇設置監聽端口

6.是否再次創建監聽

7.完成監聽安裝

 

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM