Oracle 11g R1 Enterprise安裝研究(CentOS 5.2)
Oracle Database 11g Release 1 (11.1.0.6.0) Standard Edition, Standard Edition One, and Enterprise Edition
Linux x86 (1.7 GB) | See All (Including Client, Examples, Gateways, Clusterware)
http://www.oracle.com/technology/softwa ... index.html Oracle Express, Standard, Enterprise 功能比較表
http://www.oracle.com/database/product_editions.html 作業系統:CentOS-5.2-i386-bin-DVD.iso,安裝於虛擬主機上
虛擬主機軟體:VMware Workstation 6.5.1 build 126130
虛擬主機類型:Red Hat Enterprise Linux 5
下載檔案 (1.8 GB, 超大的)
linux_11gR1_database_1013.zip
Oracle Database Installation Guide 11g Release 1 (11.1) for Linux
http://download.oracle.com/docs/cd/B283 ... nstall.htm Installing Oracle Database 11g Release 1 on Enterprise Linux 5 (32- and 64-bit)
http://www.oracle.com/technology/pub/ar ... stall.html CentOS 5下安裝Oracle 11g (安裝過程語系設定為簡體中文,不可照抄;某些部分也疑似有問題)
http://dowson33.blog.163.com/blog/stati ... 865139614/文件庫
http://www.oracle.com/pls/db111/homepage 需求重點 (要求很多,請去安裝指引看)
引言回覆:
Memory 1 GB RAM (recommended), 256 MB RAM (min)
Display 65536 colors, set to at least 1024 X 768 resolution
On Linux x86 and Linux x86-64:
Asianux 2.0
Asianux 3.0
Oracle Enterprise Linux 4.0
Oracle Enterprise Linux 5.0
Red Hat Enterprise Linux 4.0
Red Hat Enterprise Linux 5.0
SUSE Linux Enterprise Server 10.0
Oracle商業版本安裝有很多前置作業,請忍耐完成。
請將X-Window設定為英文介面,避免putty或終端機在某些情況下訊息變成亂碼。(安裝後可以切到繁體介面使用)
請關閉SELINUX的工作模式
代碼:
[root@localhost ~]# vi /etc/selinux/config
把SELINUX設定為disabled
代碼:
SELINUX=disabled
然後重新啟動系統 (修改SELinux必須重新啟動系統才能生效)
代碼:
[root@localhost ~]# reboot
先建立 /u01目錄
代碼:
[root@localhost ~]# mkdir /u01
下載linux_11gR1_database.zip放在此目錄中,解壓縮,會產生database目錄:
代碼:
[root@localhost ~]# unzip linux_11gR1_database.zip
[root@localhost ~]# ls
database
Oracle建議用固定IP, 檢查 /etc/sysconfig/network-scripts/ifcfg-eth0
代碼:
[root@localhost ~]# cat /etc/sysconfig/network-scripts/ ifcfg-eth0
# Advanced Micro Devices [AMD] 79c970 [PCnet32 LANCE]
DEVICE=eth0
BOOTPROTO=dhcp
HWADDR=00:0C:29:C1:23:E1
ONBOOT=yes
[root@localhost network-scripts]#
改成固定IP,內容類似如下 (請依照自己環境修改)
代碼:
# Advanced Micro Devices [AMD] 79c970 [PCnet32 LANCE]
DEVICE=eth0
BOOTPROTO=none
HWADDR=00:0C:29:C1:23:E1
ONBOOT=yes
NETMASK=255.255.255.0
IPADDR=192.168.128.128
GATEWAY=192.168.128.2
TYPE=Ethernet
USERCTL=no
IPV6INIT=no
PEERDNS=yes
修改/etc/resolv.conf,設定DNS Server(請依照自己環境修改)
代碼:
[root@localhost ~]# cat /etc/resolv.conf
nameserver 168.95.1.1
修改主機名稱/etc/hosts,增加一筆
代碼:
192.168.128.128 oracle
重新啟動網路,讓設定生效
代碼:
[root@localhost ~]# service network restart
Shutting down interface eth0: [ OK ]
Shutting down loopback interface: [ OK ]
Bringing up loopback interface: [ OK ]
Bringing up interface eth0: [ OK ]
安裝必須套件 (這全部是同一行)
代碼:
[root@oracle ~]# yum -y install binutils compat-libstdc++-33 elfutils-libelf elfutils-libelf-devel gcc gcc-c++ glibc glibc-common glibc-devel glibc-headers libaio libaio-devel libgcc libstdc++ libstdc++-devel make sysstat unixODBC unixODBC-devel
如果沒有網路,必須用光碟安裝,請一一用rpm找出在哪個套件檔案中
代碼:
[root@oracle u01]# rpm -qa | grep <package_name>
要找出來安裝的套件名稱包含
代碼:
binutils-2.17.50.0.6-2.el5
compat-libstdc++-33-3.2.3-61
elfutils-libelf-0.125-3.el5
elfutils-libelf-devel-0.125
gcc-4.1.1-52
gcc-c++-4.1.1-52
glibc-2.5-12
glibc-common-2.5-12
glibc-devel-2.5-12
glibc-headers-2.5-12
libaio-0.3.106
libaio-devel-0.3.106
libgcc-4.1.1-52
libstdc++-4.1.1
libstdc++-devel-4.1.1-52.e15
make-3.81-1.1
sysstat-7.0.0
unixODBC-2.2.11
unixODBC-devel-2.2.11
然後執行下面命令安裝
代碼:
[root@oracle u01]# rpm -ivh <package_name>.rpm
建立Oracle所需要的群組名稱(oinstall、dba),建立用戶名稱(oracle)並加入oinstall和dba群組中,設定用戶oracle密碼:
代碼:
[root@oracle ~]# /usr/sbin/groupadd oinstall
[root@oracle ~]# /usr/sbin/groupadd dba
[root@oracle ~]# /usr/sbin/useradd -g oinstall -G dba oracle
[root@oracle ~]# passwd oracle
建立安裝目錄和設定權限:
代碼:
[root@oracle ~]# mkdir -p /u01/app/oracle/product/
[root@oracle ~]# chown -R oracle:oinstall /u01
[root@oracle ~]# chmod -R 775 /u01
修改核心參數:
代碼:
[root@oracle ~]# vi /etc/sysctl.conf
在最末尾的地方加上:
代碼:
kernel.shmall = 2097152
kernel.shmmax = 2147483648
kernel.shmmni = 4096
kernel.sem = 250 32000 100 128
net.ipv4.ip_local_port_range = 1024 65000
net.core.rmem_default = 4194304
net.core.rmem_max = 4194304
net.core.wmem_default = 262144
net.core.wmem_max = 262144
讓設定生效
代碼:
[root@oracle ~]# /sbin/sysctl –p
為oracle用戶設置Shell限制
代碼:
[root@oracle ~]# vi /etc/security/limits.conf
加上
代碼:
oracle soft nproc 2047
oracle hard nproc 16384
oracle soft nofile 1024
oracle hard nofile 65536
修改/etc/pam.d/login
代碼:
[root@oracle ~]# vi /etc/pam.d/login
增加一行
代碼:
session required pam_limits.so
如果使用bash Shell,修改/etc/profile
代碼:
[root@oracle ~]# 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
如果使用C Shell,修改/etc/csh.login
代碼:
[root@oracle ~]# vi /etc/csh.login
最後增加
代碼:
if ( $USER == "oracle" ) then
limit maxproc 16384
limit descriptors 65536
endif
修改作業系統名稱 (實際測試沒有改也可以安裝)
代碼:
[root@oracle ~]# vi /etc/redhat-release
將CentOS release 5 (Final) 修改成
代碼:
Red Hat Enterprise Linux AS release 5 (Taroon)
(因為oracle公司沒推出CentOS版本的oracle)
切換到oracle用戶
代碼:
[root@oracle ~]# su - oracle
修改.bash_profile,此文件為oracle用戶的環境變數
代碼:
[oracle@oracle ~]$ vi .bash_profile
最後增加
代碼:
# User specific environment and startup programs
ORACLE_BASE=/u01/app/oracle; export ORACLE_BASE
ORACLE_HOME=$ORACLE_BASE/product/11.1.0/db_1; export ORACLE_HOME
ORACLE_SID=ORCL; export ORACLE_SID
ORACLE_TERM=xterm; export ORACLE_TERM
TNS_ADMIN=$ORACLE_HOME/network/admin; export TNS_ADMIN
PATH=$ORACLE_HOME/bin:$PATH; export PATH
#NLS_LANG="TRADITIONAL CHINESE_TAIWAN".ZHT16BIG5;export NLS_LANG
export NLS_LANG
#LC_CTYPE=zh_TW.Big5; export LC_CTYPE
export LC_CTYPE
#LC_ALL=zh_TW.UTF8; export LC_ALL
export LC_ALL
#LANG=zh_TW.Big5; export LANG
export LANG
LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib; export LD_LIBRARY_PATH
CLASSPATH=$ORACLE_HOME/jdk/jre:$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib; export CLASSPATH
umask 022
讓設定生效
代碼:
[oracle@oracle ~]$ source .bash_profile
回到root模式
代碼:
[oracle@oracle ~]$ exit
在X-Windows下(不能在MS-Windows的putty下),以root權限下執行下面命令,讓oracle用戶執行時的圖形畫面可以傳送給root權限的X-Window上看到
代碼:
[root@oracle ~]# xhost +
Access control disabled, clients can connect from any host
再次以oracle用戶登錄,切換到/u01/database目錄
代碼:
[root@oracle ~]# su - oracle
[oracle@oracle ~]$ cd /u01/database
執行./runInstaller安裝,開始進入圖形介面安裝
代碼:
[oracle@oracle database]$ ./runInstaller
Select Installation Method畫面:輸入Database Password和Confirm Password
Specify Inventory directory and credentials畫面:按下Next繼續
Product-Specific Prerequisite Checks畫面:環境驗證,有問題則會顯示在下方,如果沒問題就按下Next

Oracle Configuration Manager Registration畫面:Oracle Enterprise雖然可以從官方網站下載安裝,但是下載Patch是要花錢的,此處只是安裝研究,按下Next過去就好
Summary畫面,按下Install開始安裝了

Install畫面
Database Configuration Assistant安裝畫面
Database Configuration Assistant部分安裝完成
Execute Configurations Scripts畫面:要在終端機下用root執行兩個命令,然後才能按下OK繼續
請到終端機以root命令執行
代碼:
[root@oracle ~]# /u01/app/oraInventory/orainstRoot.sh
Changing permissions of /u01/app/oraInventory to 770.
Changing groupname /u01/app/oraInventory to oinstall.
The execution of the script is complete
[root@oracle ~]# /u01/app/oracle/product/11.1.0/db_1/root.sh
Running Oracle 11g root.sh script...
The following environment variables are set as:
ORACLE_OWNER= oracle
ORACLE_HOME= /u01/app/oracle/product/11.1.0/db_1
Enter the full pathname of the local bin directory: [/usr/local/bin]:
Copying dbhome to /usr/local/bin ...
Copying oraenv to /usr/local/bin ...
Copying coraenv to /usr/local/bin ...
Creating /etc/oratab file...
Entries will be added to the /etc/oratab file as needed by
Database Configuration Assistant when a database is created
Finished running generic part of root.sh script.
Now product-specific root actions will be performed.
Finished product-specific root actions.
[root@oracle ~]#
修改/etc/oratab內容
代碼:
[root@oracle ~]# vi /etc/oratab
將
代碼:
ORCL:/u01/app/oracle/product/11.1.0/db_1:N
改為
代碼:
ORCL:/u01/app/oracle/product/11.1.0/db_1:Y
End of Isntallation畫面:安裝結束了
安裝完以後,某些oracle服務預設是沒有被啟動的,則需要手工進行啟動。請以oracle用戶身份登入,登入之後主要服務的啟動方式如下:
數據庫服務 啟動 (這個執行需要點時間,執行完成會回提示字元)
代碼:
[root@localhost ~]# su - oracle
[oracle@oracle ~]$ dbstart
ORACLE_HOME_LISTNER is not SET, unable to auto-start Oracle Net Listener
Usage: /u01/app/oracle/product/11.1.0/db_1/bin/dbstart ORACLE_HOME
Processing Database instance "orcl": log file /u01/app/oracle/product/11.1.0/db_1/startup.log
數據庫服務關閉
代碼:
[oracle@oracle bin]$ dbshut
監聽器 啟動
代碼:
[oracle@oracle bin]$ lsnrctl start
LSNRCTL for Linux: Version 11.1.0.6.0 - Production on 20-2-2009 21:07:11
Copyright (c) 1991, 2007, Oracle. All rights reserved.
TNS-01106: 已啟動名稱為 LISTENER 的監聽器
監聽器 關閉。
代碼:
[oracle@oracle bin]$ lsnrctl stop
進入em控制台(Web管理介面)
代碼:
[oracle@oracle bin]$ firefox https://localhost:1158/em &
選擇Or you can add exception來增加例外網站
按下Add Exception按鈕
按下Get Certificate嘗試取得憑證
按下Confirm Security Exception(確認安全性例外)按鈕
輸入安裝過程中設定的密碼(Oracle有幾個預設的帳號,例如SYS、SYSTEM)
英文管理畫面
如果要看中文化面,可以logout,切換語系再login,再次用瀏覽器連上。
這就是繁體中文介面
安裝完成!
PS : 小弟第一次嘗試安裝,如有疏漏錯誤或建議,歡迎批評指教。