Install Oracle10g On RedhatEL AS3 update2 Step-by-
2024-08-29 13:29:09
供稿:網友
 
本文來源于網頁設計愛好者web開發社區http://www.html.org.cn收集整理,歡迎訪問。
雖然 windows 平臺下的 oracle 已經裝過幾回了,但是 linux 下沒有試過??淳W上的文檔 , 好像比 windows 下裝要復雜不少,更改系統參數,創建 user&group, 檢查必要的軟件包,設置環境變量等一大堆工作要做。于是趁周末在vmware中裝了一回,記下具體步驟以供以后參考。
os 版本 : red hat enterprise linux as release3 update2 kernel 2.4.21-15.el (安裝好內核開發工具)
oracle 版本 : oracle 10.1.0.2 for linux x86
oracle10g 的的下載地址 : http://otn.oracle.com/software/products/database/oracle10g/htdocs/linuxsoft.html 
準備安裝 
檢查磁盤空間 
oracle universal installer 約需要 400m 左右的 /tmp 空間
# df -k /tmp 
如果當前 /tmp 空間不夠 , 你可以在其他空間足夠的 filesystem 上創建新的臨時目錄
# mkdir /<anotherfilesystem>/tmp
# chown root.root /<anotherfilesystem>/tmp
# chmod 1777 /<anotherfilesystem>/tmp
# export temp=/<anotherfilesystem>
# export tmpdir=/<anotherfilesystem> 
裝好 oracle 后再恢復到原來的狀態
# rmdir /<anotherfilesystem>/tmp
# unset temp
# unset tmpdir 
oracle 大約需要 3g 左右的空間(默認安裝且包括初始庫),事先請規劃好 
檢查內存和交換區 
 查看物理內存大小
# grep memtotal /proc/meminfo 
查看交換區大小
# grep swaptotal /proc/meminfo 
 安裝 oracle 需要足夠大的內存和交換區 , 所以最好還是找臺好點的機器。 oracle 推薦最好內存 512m 以上, swap 1g 以上。如果只是安裝一個玩玩,實際上沒那么多也沒關系啦,我的虛擬機就只分了 384m 的內存和 768m 的 swap 。 
檢查軟件包 
 使用指令
# rpm –qa | grep packname // 其中 packname 是需要檢查的軟件包的名字 
保證以下的包(或者更高版本)已經安裝好。沒裝的話到 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) 
 修改系統核心參數 
編輯 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
保存退出后,執行以下命令使其生效 ( 當然重啟也是可以的 ^-^)
# 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
這些參數也可以直接更改 /proc/sys/kernel 下相應文件來實現,詳細請參考
http://download-west.oracle.com/docs/html/a96167_01/pre.htm#chdhdabj
如果是生產庫,出于性能上的考慮 , 還需要進行如下的設定,以便改進 oracle 用戶的有關 nofile( 可打開的文件描述符的最大數 ) 和 nproc( 單個用戶可用的最大進程數量 ) 。如果僅僅是測試安裝的話,也可以不用修改。
# 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 
設置環境變量 
# su oracle
$ cd ~
$ vi .bach_profile 
添加以下內容
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 請事先建好并給予相應的權限,簡單一點可以將其 owner 設為 oracle ( chown –r oracle.oinstall /opt/oracle ),作為 oracle 的安裝目錄 ( 可以自己另外規劃 ) 
確認并是修改生效
$ source .bash_profile 
開始安裝 
由于我是用虛擬機裝的 , 我把從網上下的 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 
如果出現如下錯誤
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(設置后可能有安全隱患);
•  # xhost + yourip 
yourip being added to acces control list 
//xhost + yourip 使 ip 上的用戶能夠訪問 xserver
順利的話,應該會出現 welcome 畫面,點“ next ”繼續。 
指定 inventory 目錄和安裝時使用的 group ,使用默認值即可,點“ next ” 
這時會彈出一個窗口,讓你開啟另外一個 terminal ,以 root 身份執行以下命令:
# /home/oracle/orainventory/orainstroot.sh 
執行完后點“ continue ”繼續 
接下來修改安裝文件路徑 , 按你的實際需要修改好后“ next ” 
選擇安裝內型,這里我選“ enterprise edition ”安裝企業版,“ next ”繼續下一步。 
這時會自動檢查你的系統是否滿足安裝的需求(可以按“stop”跳過),結果如下: 
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 ,繼續下一步。否則,請參照 準備安裝 部分重新作相應修改,然后“ retry ”重新檢測,直到 passed 到下一步。
接下來選擇建庫的類型,這里我先不建庫,待安裝好后在利用 dbca 來建庫或者手工建庫(如何用 dbca 建庫請到 http://www.google.com 搜索相應文章)。所以選擇“ do not create a starter database ”后“ next ”。
出現“ summary ”畫面,確認后按“ install ”。
最后還會彈出一個對話框,要求以root身份執行$oracle_home/root.sh
# $oracle_home/root.sh 
友情提示
安裝過程中如果出現錯誤,請利用 google 搜索相應的解決方法。
參考文章
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