《Oracle 11g在Windows Server 2008 R2的安裝詳解》html
本篇博文參考《Oracle 10g官方文檔》等資料,故選《RHEL4》操做系統。生產環境中強烈建議以《Oracle 10g官方文檔》爲藍圖!linux
1、預備:c++
一、硬件:注:括號()中是官方提供數據!數據庫
1-檢查物理內存 (RAM至少1G)瀏覽器
[root@RHEL4 ~]# grep MemTotal /proc/meminfo
MemTotal: 1541764 kB //RAM是1.5G
[root@RHEL4 ~]# bash
2-檢查Swap大小 (1G<RAM<2G,則Swap=RAM X 1.5)服務器
[root@RHEL4 ~]# grep SwapTotal /proc/meminfo
SwapTotal: 3140696 kB //此處是1.5X2=3G
[root@RHEL4 ~]# 網絡
3-檢查可用RAM和swap空間session
[root@RHEL4 ~]# free
total used free shared buffers cached
Mem: 1541764 898536 643228 0 49480 542584
-/+ buffers/cache: 306472 1235292
Swap: 3140696 0 3140696
[root@RHEL4 ~]# oracle
4-檢查CPU
[root@RHEL4 ~]# grep "model name" /proc/cpuinfo
model name : Intel(R) Core(TM) i5-2430M CPU @ 2.40GHz
[root@RHEL4 ~]#
二、軟件:
1-操做系統版本
Red Hat Enterprise Linux AS 4.8 X64bit
2-內核版本號
[root@RHEL4 ~]# uname -r
2.6.9-82.EL
[root@RHEL4 ~]#
3-RHEL4所須要安裝的軟件包
(1)binutils-2.15.92.0.2-10.EL4 (2)compat-db-4.1.25-9 (3)control-center-2.8.0-12 (4)gcc-3.4.3-9.EL4 (5)gcc-c++-3.4.3-9.EL4 (6)glibc-2.3.4-2 (7)glibc-common-2.3.4-2 (8)gnome-libs-1.4.1.2.90-44.1 (9)libstdc++-3.4.3-9.EL4 (10)libstdc++-devel-3.4.3-9.EL4 (11)make-3.80-5 (12)pdksh-5.2.14-30 (13)sysstat-5.0.5-1 (14)xscreensaver-4.18-5.rhel4.2
備註:
//查詢是否已安裝了上面14個軟件包
rpm –qa | grep 軟件包名
//安裝軟件包
方法1:
rpm –ivh 軟件包名
方法2:
yum install 軟件包名
3. 在/etc/hosts後面添加1行:
127.0.0.1localhost.localdomain localhost
192.168.1.224 RHEL4
4. 建立用戶和組
[root@RHEL4 ~]# groupadd oinstall
[root@RHEL4 ~]# groupadd dba
[root@RHEL4 ~]# useradd -g oinstall -G dba oracle
[root@RHEL4 ~]#
5. 修改參數:
1-在/etc/sysctl.conf的最後添加:
vi /etc/sysctl.conf
kernel.shmall = 2097152 kernel.shmmax = 2147483648 //大於或等於物理內存一半或以上便可! 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
2-而後,使用sysctl -p 命令,即時生效
[root@RHEL4 ~]# sysctl -p
net.ipv4.ip_forward = 0
net.ipv4.conf.default.rp_filter = 1
net.ipv4.conf.default.accept_source_route = 0
kernel.sysrq = 0
kernel.core_uses_pid = 1
kernel.shmall = 2097152
kernel.shmmax = 2147483648
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
[root@RHEL4 ~]#
3-在/etc/security/limits.conf最後面添加:
[root@RHEL4 ~]# vi /etc/security/limits.conf
oracle soft nproc 2047
oracle hard nproc 16384
oracle soft nofile 1024
oracle hard nofile 65536
4-在/etc/pam.d/login最後面添加:
[root@RHEL4 ~]# vi /etc/pam.d/login
session required pam_limits.so
在/etc/profile最後面添加:
[root@RHEL4 ~]# 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
6. 建立Oracle 10g R2的安裝目錄
1-建立oracle安裝目錄且賦於權限
[root@RHEL4 ~]# mkdir /u01/app/oracle -p
[root@RHEL4 ~]# chown -R oracle:oinstall /u01
[root@RHEL4 ~]# chmod -R 755 /u01
[root@RHEL4 ~]#
2-設置Oracle的環境變量
在.bash_profile最後面添加:
[root@RHEL4 ~]# su – oracle //切換到oracle用戶賬戶
[oracle@RHEL4 ~]$ vi .bash_profile
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=/u01/app/oracle/product/10.2.0/db_1
export ORACLE_SID=jiagulun
export NLS_LANG=american_america.zhs16gbk
[root@RHEL4 ~]#exit //退出oracle用戶賬戶
[root@RHEL4 ~]# su – oracle //從新切換到oracle用戶賬戶
[oracle@RHEL4 ~]$ ls
2、Oracle數據庫的安裝
1-上傳Oracle數據庫軟件,再解壓它
//先建立一個目錄/oraapp/
[root@RHEL4 ~]# mkdir /oraapp/
[root@RHEL4 ~]# mount /dev/hdc /media/
mount: block device /dev/hdc is write-protected, mounting read-only
[root@RHEL4 ~]# cd /media/
[root@RHEL4 media]# ll
total 740658
-r-xr-xr-x 1 root root 758433170 Aug 10 23:46 10201_database_linux_x86_64.cpio.gz
[root@RHEL4 media]# cp 10201_database_linux_x86_64.cpio.gz /oraapp/
[root@RHEL4 media]# cd /oraapp/
[root@RHEL4 oraapp]# ll
total 741388
-r-xr-xr-x 1 root root 758433170 Aug 11 14:29 10201_database_linux_x86_64.cpio.gz
[root@RHEL4 oraapp]# gunzip 10201_database_linux_x86_64.cpio.gz //解壓之
2-gunzip將XXX.cpio.gz解後是XXX.cpio文件了,而後再用命令解壓便可:
[root@RHEL4 oraapp]# ll
total 783588
-r-xr-xr-x 1 root root 801603584 Aug 11 14:29 10201_database_linux_x86_64.cpio
[root@RHEL4 oraapp]# cpio -idmv < 10201_database_linux_x86_64.cpio //解壓之
[root@RHEL4 oraapp]# ls
10201_database_linux_x86_64.cpio database
[root@RHEL4 oraapp]# cd database/
[root@RHEL4 database]# ls
doc install response runInstaller stage welcome.html
[root@RHEL4 database]# w
16:03:35 up 9 min, 3 users, load average: 0.21, 0.48, 0.31
USER TTY FROM LOGIN@ IDLE JCPU PCPU WHAT
root :0 - 16:00 ?xdm? 31.12s 0.51s /usr/bin/gnome-session
root 192.168. 192.168.1.3 16:01 0.00s 0.00s 0.37s /usr/bin/gnome-session
root pts/1 192.168.1.3:1.0 16:02 0.00s 0.04s 0.02s w
[root@RHEL4 database]# xhost +
access control disabled, clients can connect from any host
[root@RHEL4 database]# export DISPLAY=192.168.1.3:1.0
[root@RHEL4 database]# su – oracle //切換到oracle用戶
[oracle@RHEL4 ~]$ cd /oraapp/
[oracle@RHEL4 oraapp]$ ls
10201_database_linux_x86_64.cpio database //此爲解壓後的文件
3-正式安裝Oracle 10g R2數據庫
[oracle@RHEL4 oraapp]$ cd database/
[oracle@RHEL4 database]$ ./runInstaller
//稍候……就出現以下圖所示界面:
//默認之,由於咱們前面設置了環境變量,因此會自動出來了
//選企業版,以下圖所示
或者選 定製 !以下圖所示:
//默認之,以下圖所示:
//選 iSQL*Plus 10.2.0.1.0 ,以下圖所示:
//檢查最後結果應該是:成功!以下圖所示:
//默認之,以下圖所示:
//僅安裝Oracle數據庫軟件,以下圖所示:
//下面咱們只須要點擊 安裝,以下圖所示:
//到以下圖所示時,不要點 OK !切記! 咱們從新打開一個窗口:
//執行第1個腳本,以下圖所示:
右擊 桌面空白處---> 打開終端 ,以下圖所示:
[root@RHEL4 ~]# su - oracle
[oracle@RHEL4 ~]$ pwd
/home/oracle
[oracle@RHEL4 ~]$ su
Password:
[root@RHEL4 oracle]# pwd
/home/oracle
[root@RHEL4 oracle]# cd /u01/app/oracle
[root@RHEL4 oracle]# cd oraInventory/
[root@RHEL4 oraInventory]# ls
Contents oraInst.loc
ContentsXML orainstRoot.sh
install.platform oui
logs sessionContext.ser
oraInstaller.properties
[root@RHEL4 oraInventory]# ./orainstRoot.sh //執行腳本
Changing permissions of /u01/app/oracle/oraInvent ory to 770.
Changing groupname of /u01/app/oracle/oraInventor y to oinstall.
The execution of the script is complete
[root@RHEL4 oraInventory]#
//執行第2個腳本,以下圖所示:
//下面咱們就能夠點擊 OK 按鈕了,以下圖所示:
//點擊 退出 後,oracle數據庫安裝已完成了!以下圖所示:
PS:
上圖中的5560端口,查詢方法:
3、建庫:
1-設置環境變量
//在.bash_profile最後面添加:
[oracle@RHEL4 ~]$ vi .bash_profile
# .bash_profile
# Get the aliases and functions
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
# User specific environment and startup programs
PATH=$PATH:$HOME/bin
export PATH
unset USERNAME
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=/u01/app/oracle/product/10.2.0/db_1
export ORACLE_SID=jiagulun
export NLS_LANG=american_america.zhs16gbk
export PATH=$PATH:$ORACLE_HOME/bin:. //此爲添加的1行
[oracle@RHEL4 ~]$ exit //退出
logout
[root@RHEL4 ~]# su – oracle //再用oracle用戶賬戶登陸!
2-運行數據庫配置助手(dbca),以下圖所示:
[oracle@RHEL4 ~]$ dbca
//選擇 建立數據庫 ,以下圖所示:
//選擇 通常用途(General Purpose)
//給數據庫起個名稱:jiagulun
//推薦使用EM,不管是實驗環境,仍是生產環境中!
//全部用戶都使用同一個口令:oracle
//選擇 文件系統(File System),生產環境 選 ASM 或 裸設備
//選第2項:全部數據庫文件使用公共位置
//默認,指定快速恢復區
//選擇 示例方案 ,實際生產中不會選 示例方案!
//選第2項(有國外機構的選它),國內企業通常選第3項!強烈建議:在此就選好,不然之後調整會出現問題。
//默認:控制文件、數據文件、重作日誌組
//開始 建立數據庫 ,以下圖所示:
//檢查下正確與否,正確,則點擊 OK !
//請等待……,以下圖所示:
//直到出現……以下圖所示:
至此,Oracle 10g R2數據庫安裝和建庫所有完成!
4、下面咱們去訪問Oracle 10g R2數據庫
1-在IE中輸入http://192.168.1.224:1158/em
註釋:
爲什麼會出現:Enterprise Manager沒法鏈接到數據庫實例。下面列出了組件的狀態。???
1)用戶經過IE瀏覽器 鏈接 EM,而EM經過 監聽(Listener)找到 Oracle數據庫;
2)前3個(Database、Listener和EM)在同一臺服務器上,EM在安裝Oracle數據庫時,就安裝了;
由上面報錯可分析出來,多是監聽出問題了!(事實上咱們尚未配置監聽^_^)
2-配置監聽
//運行命令netca來配置監聽
[oracle@RHEL4 ~]$ netca
//選第1項 配置監聽
//選第1項: 添加
//起個監聽名稱:LISTENER
//默認之,下一步
//默認之,下一步
//下一步,以下圖所示:
//出現以下圖所示,則說明監聽配置完成了!
3-本地Net服務名配置
1)本地Net服務名配置
[oracle@RHEL4 ~]$ netca
//選第3項:本地Net服務名配置
//默認之,添加
//起個服務名爲:jiagulun
//默認之,下一步
//主機名:192.168.1.224
//不測試,以下圖所示:
//網絡服務名爲:jiagulun
//咱們不配置另外一個Net服務名,以下圖所示:
//出現以下圖所示,則說明Net服務配置完成
至此,本地Net服務名配置完成!
2)因而去看看檢驗之,以下面所示:
[oracle@RHEL4 ~]$ lsnrctl status //查看監聽狀態
LSNRCTL for Linux: Version 10.2.0.1.0 - Production on 11-AUG-2013 22:31:01
Copyright (c) 1991, 2005, Oracle. All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=RHEL4)(PORT=1521)))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 10.2.0.1.0 - Production
Start Date 11-AUG-2013 21:56:58
Uptime 0 days 0 hr. 34 min. 3 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /u01/app/oracle/product/10.2.0/db_1/network/admin/listener.ora
Listener Log File /u01/app/oracle/product/10.2.0/db_1/network/log/listener.log
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=RHEL4)(PORT=1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC0)))
Services Summary...
Service "PLSExtProc" has 1 instance(s).
Instance "PLSExtProc", status UNKNOWN, has 1 handler(s) for this service...
Service "jiagulun" has 1 instance(s).
Instance "jiagulun", status READY, has 1 handler(s) for this service...
Service "jiagulunXDB" has 1 instance(s).
Instance "jiagulun", status READY, has 1 handler(s) for this service...
Service "jiagulun_XPT" has 1 instance(s).
Instance "jiagulun", status READY, has 1 handler(s) for this service...
The command completed successfully
[oracle@RHEL4 ~]$
3)中止、啓動監聽及查看監聽狀態
[oracle@RHEL4 ~]$ lsnrctl stop //關閉監聽程序
LSNRCTL for Linux: Version 10.2.0.1.0 - Production on 11-AUG-2013 22:39:05
Copyright (c) 1991, 2005, Oracle. All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=RHEL4)(PORT=1521)))
The command completed successfully
[oracle@RHEL4 ~]$
[oracle@RHEL4 ~]$lsnrctl start //啓動監聽
LSNRCTL for Linux: Version 10.2.0.1.0 - Production on 11-AUG-2013 22:42:21
Copyright (c) 1991, 2005, Oracle. All rights reserved.
Starting /u01/app/oracle/product/10.2.0/db_1/bin/tnslsnr: please wait...
TNSLSNR for Linux: Version 10.2.0.1.0 - Production
System parameter file is /u01/app/oracle/product/10.2.0/db_1/network/admin/listener.ora
Log messages written to /u01/app/oracle/product/10.2.0/db_1/network/log/listener.log
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=RHEL4)(PORT=1521)))
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC0)))
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=RHEL4)(PORT=1521)))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 10.2.0.1.0 - Production
Start Date 11-AUG-2013 22:42:21
Uptime 0 days 0 hr. 0 min. 0 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /u01/app/oracle/product/10.2.0/db_1/network/admin/listener.ora
Listener Log File /u01/app/oracle/product/10.2.0/db_1/network/log/listener.log
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=RHEL4)(PORT=1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC0)))
Services Summary...
Service "PLSExtProc" has 1 instance(s).
Instance "PLSExtProc", status UNKNOWN, has 1 handler(s) for this service...
The command completed successfully
[oracle@RHEL4 ~]$
[oracle@RHEL4 ~]$ lsnrctl status //再查看監聽狀態
LSNRCTL for Linux: Version 10.2.0.1.0 - Production on 11-AUG-2013 22:44:54
Copyright (c) 1991, 2005, Oracle. All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=RHEL4)(PORT=1521)))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 10.2.0.1.0 - Production
Start Date 11-AUG-2013 22:42:21
Uptime 0 days 0 hr. 2 min. 33 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /u01/app/oracle/product/10.2.0/db_1/network/admin/listener.ora
Listener Log File /u01/app/oracle/product/10.2.0/db_1/network/log/listener.log
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=RHEL4)(PORT=1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC0)))
Services Summary...
Service "PLSExtProc" has 1 instance(s).
Instance "PLSExtProc", status UNKNOWN, has 1 handler(s) for this service...
Service "jiagulun" has 1 instance(s).
Instance "jiagulun", status READY, has 1 handler(s) for this service...
Service "jiagulunXDB" has 1 instance(s).
Instance "jiagulun", status READY, has 1 handler(s) for this service...
Service "jiagulun_XPT" has 1 instance(s).
Instance "jiagulun", status READY, has 1 handler(s) for this service...
The command completed successfully
[oracle@RHEL4 ~]$
由上面查聽監聽狀態,可知監聽服務已經在工做了!
4-咱們再在IE中輸入http://192.168.1.224:1158/em
//接受/贊成
//下面是我把語言改成中文時的界面,以下圖所示:
好啦!《Red Hat Enterprise Linux AS 4.8中安裝Oracle 10g R2詳解》到此結束了!