Install Oracle10g On RedhatEL AS3 Update2 Step-by-Step
2024-08-29 13:44:50
供稿:網(wǎng)友
雖然 windows 平臺下的 Oracle 已經(jīng)裝過幾回了,但是 linux 下沒有試過。看網(wǎng)上的文檔 , 似乎比 windows 下裝要復(fù)雜不少,更改系統(tǒng)參數(shù),創(chuàng)建 user&group, 檢查必要的軟件包,設(shè)置環(huán)境變量等一大堆工作要做。 于是趁周末在VMWare中裝了一回,記下具體步驟以供以后參考。
OS 版本 : Red Hat EnterPRise Linux AS release3 Update2 Kernel 2.4.21-15.EL (安裝好內(nèi)核開發(fā)工具)
Oracle 版本 : Oracle 10.1.0.2 for linux x86
Oracle10g 的的下載地址 : http://otn.oracle.com/software/prodUCts/database/oracle10g/htdocs/linuxsoft.Html
預(yù)備安裝
檢查磁盤空間
Oracle Universal Installer 約需要 400M 左右的 /tmp 空間
# df -k /tmp
假如當前 /tmp 空間不夠 , 你可以在其他空間足夠的 filesystem 上創(chuàng)建新的臨時目錄
# mkdir /<AnotherFilesystem>/tmp
# chown root.root /<AnotherFilesystem>/tmp
# chmod 1777 /<AnotherFilesystem>/tmp
# eXPort TEMP=/<AnotherFilesystem>
# export TMPDIR=/<AnotherFilesystem>
裝好 oracle 后再恢復(fù)到原來的狀態(tài)
# rmdir /<AnotherFilesystem>/tmp
# unset TEMP
# unset TMPDIR
oracle 大約需要 3G 左右的空間(默認安裝且包括初始庫),事先請規(guī)劃好
檢查內(nèi)存和交換區(qū)
查看物理內(nèi)存大小
# grep MemTotal /proc/meminfo
查看交換區(qū)大小
# grep SwapTotal /proc/meminfo
安裝 oracle 需要足夠大的內(nèi)存和交換區(qū) , 所以最好還是找臺好點的機器。 oracle 推薦最好內(nèi)存 512M 以上, swap 1G 以上。假如只是安裝一個玩玩,實際上沒那么多也沒關(guān)系啦,我的虛擬機就只分了 384M 的內(nèi)存和 768M 的 swap 。
檢查軟件包
使用指令
# rpm –qa grep packname // 其中 packname 是需要檢查的軟件包的名字
保證以下的包(或者更高版本)已經(jīng)安裝好。沒裝的話到 redhat 的安裝盤里都可以找到
gcc-3.2.3-34
make-3.79.1-17
binutils-2.14.90.0.4-35
openmotif-2.2.2-16
setarch-1.3-1
compat-db-4.0.14.5
compat-gcc-7.3-2.96.128
compat-gcc-c++-7.3-2.96.128
compat-libstdc++-7.3-2.96.128
compat-libstdc++-devel-7.3-2.96.128
安裝RPM包
# rpm -Uvh packname
添加 group 和 user
# /usr/sbin/groupadd oinstall
# /usr/sbin/groupadd dba
建立 oracle 用戶,其默認組為 oinstall ,同時也是 dba 組的成員
# /usr/sbin/useradd -g oinstall -G dba oracle
修改 oracle 用戶的 passWord
# passwd oracle
建好后可以檢查一下
# id oracle
uid=500(oracle) gid=500(oinstall) groups=500(oinstall),501(dba)
修改系統(tǒng)核心參數(shù)
編輯 sysctl.conf
# vi /etc/sysctl.conf
添加以下內(nèi)容
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
保存退出后,執(zhí)行以下命令使其生效 ( 當然重啟也是可以的 ^-^)
# sysctl –p
檢查一下上面的操作是否正確 :
# /sbin/sysctl -a grep sem
# /sbin/sysctl -a grep shm
# /sbin/sysctl -a grep file-max
# /sbin/sysctl -a grep ip_local_port_range
這些參數(shù)也可以直接更改 /proc/sys/kernel 下相應(yīng)文件來實現(xiàn),具體請參考
http://download-west.oracle.com/docs/html/A96167_01/pre.htm#CHDHDABJ
假如是生產(chǎn)庫,出于性能上的考慮 , 還需要進行如下的設(shè)定,以便改進 Oracle 用戶的有關(guān) nofile( 可打開的文件描述符的最大數(shù) ) 和 nproc( 單個用戶可用的最大進程數(shù)量 ) 。
假如僅僅是測試安裝的話,也可以不用修改。
# vi /etc/security/limits.conf
添加如下的行
* soft nproc 2047
* hard nproc 16384
* soft nofile 1024
* hard nofile 65536
# vi /etc/pam.d/login
添加如下的行
session required /lib/security/pam_limits.so
# 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
之后,驗證一下
# su oracle
$ ulimit -a
設(shè)置環(huán)境變量
# su oracle
$ cd ~
$ vi .bach_profile
添加以下內(nèi)容
export ORACLE_BASE=/opt/oracle
export ORACLE_HOME=$ORACLE_BASE/product/10.1.0/
export ORACLE_SID=db01
export PATH=$PATH:$HOME/bin:$ORACLE_HOME/bin
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/usr/lib
export LC_CTYPE=en_US.UTF-8
其中 /opt/oracle 請事先建好并給予相應(yīng)的權(quán)限,簡單一點可以將其 owner 設(shè)為 oracle ( chown –R oracle.oinstall /opt/oracle ),作為 oracle 的安裝目錄 ( 可以自己另外規(guī)劃 )
確認并是修改生效
$ source .bash_profile
開始安裝
由于我是用虛擬機裝的 , 我把從網(wǎng)上下的 oracle10g(ship.db.cpio.gz)copy 到了硬盤上,目錄為 /tmp, 先作一下 CRC 驗證,以免下載的 oracle 有問題。
# cksum ship.db.cpio.gz
解壓縮
# gzip –d ship.db.cpio.gz
解包 ship.db.cpio
# cpio -idmv < ship.db.cpio
得到安裝目錄 /tmp/Disk1 ,假如你有刻錄機的話就可以把該目錄刻到光盤上了。這里我從硬盤安裝。
# su oracle
$ cd /tmp/Disk1
$ ./runInstaller
假如出現(xiàn)如下錯誤
xlib:connection to "localhost:0.0" refused by server
xlib:client is not authorized to connect to server
Exception in thread "main" java.lang.InternalError:can't connect to x11 window server using "localhost:0.0"
at .......
解決方法:
• # xhost +
access control disabled,clients can connect from any host.
//xhost + 是使所有用戶從任何一個終端都能訪問 Xserver(設(shè)置后可能有安全隱患);
• # xhost + yourip
yourip being added to acces control list
//xhost + yourip 使 ip 上的用戶能夠訪問 Xserver
順利的話,應(yīng)該會出現(xiàn) welcome 畫面,點“ Next ”繼續(xù)。
指定 Inventory 目錄和安裝時使用的 group ,使用默認值即可,點“ Next ”
這時會彈出一個窗口,讓你開啟另外一個 terminal ,以 root 身份執(zhí)行以下命令:
# /home/oracle/oraInventory/orainstRoot.sh
執(zhí)行完后點“ Continue ”繼續(xù)
接下來修改安裝文件路徑 , 按你的實際需要修改好后“ Next ”
選擇安裝內(nèi)型,這里我選“ Enterprise Edition ”安裝企業(yè)版,“ Next ”繼續(xù)下一步。
這時會自動檢查你的系統(tǒng)是否滿足安裝的需求(可以按“stop”跳過),結(jié)果如下:
hecking Operating system certification
Expected result: One of redhat-2.1,redhat-3,UnitedLinux-1.0
Actual Result: redhat-3
Check complete. The overall result of this check is: Passed
=======================================================================
Checking kernel parameters
Checking for VERSION=2.4.9.25; found VERSION=2.4.21. Passed
Checking for shmall=2097152; found shmall=2097152. Passed
Checking for shmseg=10; found shmseg=4096. Passed
Checking for semmsl=250; found semmsl=250. Passed
Checking for semmni=128; found semmni=128. Passed
Checking for filemax=65536; found filemax=39321. Passed
Checking for shmmni=4096; found shmmni=4096. Passed
Checking for semmns=32000; found semmns=32000. Passed
Checking for semopm=100; found semopm=32. passed
Checking for shmmin=1; found shmmin=1. Passed
Checking for shmmax=2147483648; found shmmax=33554432. passed
Check complete. The overall result of this check is: passed
=======================================================================
Checking recommended operating system packages
Checking for make-3.79; found make-3.79.1-17. Passed
Checking for binutils-2.11.90.0.8-12; found binutils-2.14.90.0.4-35. Passed
Checking for gcc-2.96; found gcc-3.2.3-34. Passed
Checking for openmotif-2.1.30-11; found openmotif-2.2.2-16. Passed
Check complete. The overall result of this check is: Passed
=======================================================================
Checking recommended glibc version
Expected result: 2.2.4.31.7
Actual Result: 2.3.2.95.20
Check complete. The overall result of this check is: Passed
=======================================================================
Validating ORACLE_BASE location (if set)
Check complete. The overall result of this check is: Passed
=======================================================================
假如全部 passed ,繼續(xù)下一步。否則,請參照 預(yù)備安裝 部分重新作相應(yīng)修改,然后“ Retry ”重新檢測,直到 passed 到下一步。
接下來選擇建庫的類型,這里我先不建庫,待安裝好后在利用 dbca 來建庫或者手工建庫(如何用 dbca 建庫請到 http://www.Google.com 搜索相應(yīng)文章)。所以選擇“ Do not create a starter database ”后“ Next ”。
出現(xiàn)“ Summary ”畫面,確認后按“ Install ”。
最后還會彈出一個對話框,要求以root身份執(zhí)行$ORACLE_HOME/root.sh
# $ORACLE_HOME/root.sh
友情提示
安裝過程中假如出現(xiàn)錯誤,請利用 google 搜索相應(yīng)的解決方法。
參考文章
Fenng 的 Installing Oracle 10g on RHEL AS 3 Step-by-Step
http://www.dbanotes.net/Oracle/Install-Oracle10g-RHEL3.htm
Werner Puschitz 的 10g 安裝指南
http://www.puschitz.com/InstallingOracle10g.shtml
Oracle Database Quick Installation Guide 10 g Release 1 (10.1) for Linux x86
http://download-west.oracle.com/docs/html/B10813_01/toc.htm right">(出處:清風(fēng)軟件下載學(xué)院)