oracle-安裝(11GR2)-和隨機啟動
本文件提供CentOS 6.6作業系統下Oracle 11.2.0.4的安裝說明,以便於相關人員順利安裝Oracle 11.2.0.4資料
一 安裝準備
1、已安裝完成的CentOS 6.6作業系統;
2、Oracle 11.2.0.4 For Linux 64位安裝程式
3、伺服器可以正常連線到網際網路
4、準備安裝所需系統環境
(1)、安裝相關的開發及工具包
yum -y install binutils compat-libstdc++-33 elfutils-libelf elfutils-libelf-devel glibc glibc-common glibc-devel gcc gcc-c++ libaio libaio-devel libgcc libstdc++ libstdc++-devel make sysstat unixODBC unixODBC-devel zip unzip lrzsz(2)、檢查/etc/hosts檔案中是否有
<IP地址><主機名>
這一配置項。如果有,則需確認主機名是否和/etc/sysconfig/network中的hostname一致(需要確保兩者一致);如果沒有,則手工新增。
(3)、修改核心引數
[[email protected] ~]# vi /etc/sysctl.conf
# 註釋掉下面三行
#net.bridge.bridge-nf-call-ip6tables = 0
#net.bridge.bridge-nf-call-iptables = 0
#net.bridge.bridge-nf-call-arptables = 0
#修改下面兩行
kernel.shmall = 10523004
在檔案最後新增下面內容
net.ipv4.ip_local_port_range = 9000 65500
mal style='text-indent:28.0pt;mso-char-indent-count:2.0;line-height:20.0pt;mso-line-height-rule:exactly'>fs.file-max =6815744kernel.shmmni =4096
kernel.sem = 25032000 100 128
net.core.rmem_default=262144
net.core.rmem_max=4194304
net.core.wmem_default=262144
net.core.wmem_max=1048576
fs.aio-max-nr =1048576
使修改生效:
[[email protected] ~]# sysctl -p4)、修改系統配置檔案
[[email protected] ~]#vi /etc/pam.d/login
在檔案最後新增下面內容 session required pam_limits.so
[[email protected] ~]# vi /etc/security/limits.conf
#在檔案最後新增下面內容
oracle soft nproc 2047
oracle hard nproc 16384
oracle soft nofile 1024
oracle hard nofile 65536
(5)、新增使用者及組
[[email protected] ~]#groupadd dba
[[email protected] ~]#useradd-g dba oracle(6)、修改系統環境變數
[[email protected] ~]# vi /etc/profile
#在檔案最後新增下面內容
if [ $USER = "oracle" ]; then
if [ $SHELL = "/bin/ksh" ]; then
ulimit -p 16384
ulimit -n 65536
else
ulimit -u 16384 -n 65536
fi
fi(7)、建立目錄
[[email protected] ~]#mkdir /opt/oracle
[[email protected] ~]#mkdir /opt/oraInventory
[[email protected] ~]#mkdir /opt/oracle/dbhome
[[email protected] ~]#chmod 775 /opt/oracle
[[email protected] ~]#chmod 775/opt/oraInventory
[[email protected] ~]#chown-R oracle:dba /opt/oracle /opt/oraInventory(8)、修改oracle使用者環境變數:
[[email protected] ~]#su - oracle
[[email protected] ~]$vi ~/.bash_profile
#在檔案最後新增下面內容
export ORACLE_BASE=/opt/oracle
export ORACLE_HOME=/opt/oracle/dbhome
export NLS_LANG="AMERICAN_AMERICA.UTF8"
export ORACLE_SID=orcl
export PATH=$PATH:$ORACLE_HOME/bin
(9)、上傳安裝檔案
在終端電腦上安裝SSH工具NetSarangXmanagerEnterprise 4,通過SSH遠端登入伺服器,使用SFTP工具將Oracle安裝檔案上傳到伺服器的/home/oracle目錄下,並修改檔案所有者屬性
[[email protected] ~]#chownoracle:dba/home/oracle/p13390677_112040_Linux- x86-64_*
(10)、解壓縮zip檔案,準備安裝
[[email protected] ~]#su - oracle
[[email protected] ~]$ unzip p13390677_112040_Linux-x86-64_1of7.zip
[[email protected] ~]$ unzip p13390677_112040_Linux-x86-64_2of7.zip
[[email protected] ~]$ unzip p13390677_112040_Linux-x86-64_3of7.zip
[[email protected] ~]$ unzip p13390677_112040_Linux-x86-64_4of7.zip
[[email protected] ~]$ unzip p13390677_112040_Linux-x86-64_5of7.zip
[[email protected] ~]$ unzip p13390677_112040_Linux-x86-64_6of7.zip
[[email protected] ~]$ unzip p13390677_112040_Linux-x86-64_7of7.zip
11)、安裝pdksh包
將pdksh-5.2.14-30.x86_64.rpm包上傳到伺服器,並以root使用者執行命令
[[email protected] ~]#rpm -ivhpdksh-5.2.14-30.x86_64.rpm二 安裝過程
1、解壓縮完成後,會生成client、database、deinstall、examples、gateways、grid六個目錄
[[email protected] ~]#rpm -ivh pdksh-5.2.14-30.x86_64.rpm2、切換到root使用者,執行命令:
[[email protected] ~]$ exit
[[email protected] ~]# xhost +
access control disabled, clients can connect from any host
命令執行後客戶端會自動開啟一個圖形介面的視窗,然後視窗會自動最小化
3、切換到oracle使用者,開始安裝資料庫:
[[email protected] ~]# su- oracle
[[email protected] ~]$ cd database
[[email protected] database]$ ./runInstaller4、執行命令後會彈出如圖所示的Oracle安裝介面,不輸入Email地址,並取消選中“I wish to receive security updates via My Oracle Suppor.”,點Next
5、彈出警告視窗,點Yes
6、選擇“Skip software updates”,點Next
7、選擇“Create and configure a database”,點Next
8、選擇“Server Class”,點Next
9、選擇“Single instance database installation”,點Next
10、選擇“Advanced Install”,點Next
11、將滾動條拉到最下邊,選中“SimplifiedChinese”,然後點“ ”按鈕,將簡體中文新增到右側視窗
12、選擇“Enterprise Edition(4.7GB)”,點選Next
13、無需修改,只需確保和圖示中一致即可,15、選擇“General Purpose/ Transaction Processing”,點選Next
16、修改“Global database name”,確保其和“OracleService Identifier (SID)”一樣都是orcl,點選Next
17、設定Oracle可用記憶體容量,將記憶體值設為實體記憶體的一半,然後點選“Character sets”選項卡
18、設定字符集,選中“Choose from the following list of character sets”,並從下拉列表中選擇“Simplified Chinese ZHS16GBK”,點選Next
22、選擇“Use the same password for allaccounts”並設定密碼,點選Next
30、點選“OK”按鈕後會彈出新的視窗,要求以root使用者身份執行兩個指令碼31、通過SSH工具登入到伺服器,以root使用者身份執行:
[[email protected]~]#/opt/oraInventory/orainstRoot.sh[[email protected]~]# /opt/oracle/dbhome/root.sh
31、兩個指令碼執行完成後,返回安裝介面,點選“OK”按鈕,至此,資料庫安裝完成三 安裝後操作
1、修改iptables配置檔案,開啟1521埠
[[email protected] ~]# vi /etc/sysconfig/iptables
在INPUT鏈中增加一條規則:
-A INPUT -m state--state NEW -m tcp -p tcp --dport1521 -j ACCEPTle;mso-wrap-style:square'> ”按鈕,將簡體中文新增到右側視窗2、修改root使用者環境變數
[[email protected] ~]# vi~/.bash_profile
export ORACLE_BASE=/opt/oracle
export ORACLE_HOME=/opt/oracle/dbhome
使修改生效
[[email protected] ~]# source~/.bash_profile
3、開機自動啟動Oracle
(1)將dbora-oneoff檔案上傳到/root目錄,將dbora檔案上傳到/etc/init.d目錄,將兩個檔案都增加可執行屬性:
[[email protected]~]#chmod +x /root/dbora-oneoff
[[email protected]~]#chmod +x /etc/init.d/dbora
(2)執行一遍dbora-oneoff,然後將其刪除[[email protected]~]#rm/root/dbora-oneoff start
[[email protected]~]#rm /root/dbora-oneoff
/root/dbora-oneoff
#!/bin/bash
# chkconfig: 35 99 10
# description: Starts and stops Oracle processes
# Please locate the script under the dirctory "/etc/init.d" as root privilege!
chgrp dba /etc/init.d/dbora
chmod 750 /etc/init.d/dbora
/sbin/chkconfig --add dbora
sed -i s/'N'/'Y'/g /etc/oratab
sed -i s/'ORACLE_HOME_LISTNER=$1'/'ORACLE_HOME_LISTNER=${1:-$ORACLE_HOME}'/g $ORACLE_BASE/dbhome/bin/dbstart
sed -i s/'ORACLE_HOME_LISTNER=$1'/'ORACLE_HOME_LISTNER=${1:-$ORACLE_HOME}'/g $ORACLE_BASE/dbhome/bin/dbshut
ORA_HOME=("/home/oracle/dbhome")
ORA_OWNER=("oracle")
declare -a ORA_HOME
declare -a ORA_OWNER
t=${#ORA_HOME[@]}
#t=1
for ((count=0;count<$t;count++))
do
case "$1" in
'start')
su - ${ORA_OWNER[$count]} -c "${ORA_HOME[$count]}/bin/lsnrctl start"
su - ${ORA_OWNER[$count]} -c ${ORA_HOME[$count]}/bin/dbstart
;;
'stop')
su - ${ORA_OWNER[$count]} -c "${ORA_HOME[$count]}/bin/lsnrctl stop"
su - ${ORA_OWNER[$count]} -c ${ORA_HOME[$count]}/bin/dbshut
;;
esac
done
/etc/init.d/dbora
#!/bin/bash
# chkconfig: 35 99 10
# description: Starts and stops Oracle processes
# Please locate the script under the dirctory "/etc/init.d" as root privilege!
#chgrp dba /etc/init.d/dbora
#chmod 750 /etc/init.d/dbora
#/sbin/chkconfig --add dbora
#sed -i s/'N'/'Y'/g /etc/oratab
#sed -i s/'ORACLE_HOME_LISTNER=$1'/'ORACLE_HOME_LISTNER=${1:-$ORACLE_HOME}'/g $ORACLE_BASE/dbhome/bin/dbstart
#sed -i s/'ORACLE_HOME_LISTNER=$1'/'ORACLE_HOME_LISTNER=${1:-$ORACLE_HOME}'/g $ORACLE_BASE/dbhome/bin/dbshut
ORA_HOME=("/home/oracle/dbhome")
ORA_OWNER=("oracle")
declare -a ORA_HOME
declare -a ORA_OWNER
t=${#ORA_HOME[@]}
#t=1
for ((count=0;count<$t;count++))
do
case "$1" in
'start')
su - ${ORA_OWNER[$count]} -c "${ORA_HOME[$count]}/bin/lsnrctl start"
su - ${ORA_OWNER[$count]} -c ${ORA_HOME[$count]}/bin/dbstart
;;
'stop')
su - ${ORA_OWNER[$count]} -c "${ORA_HOME[$count]}/bin/lsnrctl stop"
su - ${ORA_OWNER[$count]} -c ${ORA_HOME[$count]}/bin/dbshut
;;
esac
done