本文來源于網(wǎng)頁設(shè)計(jì)愛好者web開發(fā)社區(qū)http://www.html.org.cn收集整理,歡迎訪問。
本文將指導(dǎo)大家安裝以下內(nèi)容: 
- oracle 10g (10.1.0) on red hat enterprise linux advanced server 3 (rhelas3)
- oracle 10g (10.1.0) on red hat enterprise linux advanced server 2.1 (rhelas2.1)
- oracle 10g (10.1.0) on red hat 9 (rh9)
- oracle 10g (10.1.0) on red hat fedora core 1 (fc1)
 
從otn上下載oracle10g for linux 版
http://otn.oracle.com/software/products/database/oracle10g/index.html
 
下載的文件ship.db.cpio.gz作如下處理:
如果你是在windows os下載的文件,可以通過linux的samba功能直接拷貝ship.db.cpio.gz至你的linux目錄下.
做一下crc (cyclic redundancy check)檢查:
$cksum ship.db.cpio.gz
將ship.db.cpio.gz放在/tmp下,解壓ship.db.cpio.gz
$gunzip ship.db.cpio.gz
得到disk1這樣的目錄,這就是oracle10g for linux的安裝文件
===========
再做以下檢查:
$grep memtotal /proc/meminfo
檢查swap空間的大小, 
$grep swaptotal /proc/meminfo
請確保你的swap大小為內(nèi)存的2倍左右,這樣對於oracle的安裝和使用有好處,否則在建立資料庫時(shí)會(huì)出問題,我的內(nèi)存為1.5g , 我的swap設(shè)為2.9g
如果你安裝linux時(shí)預(yù)先沒有設(shè)定swap至足夠大請照如下設(shè)定執(zhí)行
$su - root
#dd if=/dev/zero of=tmpswap bs=1k count=900000
#chmod 600 tmpswap
#mkswap tmpswap
#swapon tmpswap
=======
安裝oracle universal installer 需要在/tmp下至少400 mb 的自由空間. 
檢查/tmp: 
$df /tmp
如果你在/tmp下沒有足夠空間, 你可以在另一個(gè)分區(qū)中臨時(shí)的建立一個(gè)tmp目錄請看如下做法: 
$su - root
#mkdir /<anotherfilesystem>/tmp
#chown root.root /<anotherfilesystem>/tmp
#chmod 1777 /<anotherfilesystem>/tmp
#export temp=/<anotherfilesystem>           # 被oracle使用
#export tmpdir=/<anotherfilesystem>         # 用於linux應(yīng)用程序
當(dāng)你安裝完oracle10g, 關(guān)閉oracle並移除臨時(shí)性的tmp目錄,如下作法: 
$su - root
#rmdir /<anotherfilesystem>/tmp
#unset temp
#unset tmpdir
=====
檢查linux上的安裝包(rpms),主要檢查與compat-gcc, compat-libstdc++等等兼容性,因?yàn)樵趚-windows下安裝oracle10g需要用到窗口api函數(shù)接口.
檢查linux核心rpms
$uname –a 
結(jié)果應(yīng)該是2.4.9以上的版本才行.
檢查glibc rpms
對於redhat elas 2.1需要如下變更
$su – root
#rpm -uvh glibc-2.2.4-32.11.i686.rpm glibc-common-2.2.4-32.11.i386.rpm
 
檢查gcc, make, and binutils rpms
#rpm -q gcc make binutils
查出以下rpms是否被安裝:
- 對於rhelas3 和rhelas2.1: make-3.79 或以上版本
- 對於rhelas3 and rhelas2.1: binutils-2.11.90.0.8-12 或以上版本
- 對於rhelas3: gcc-3.2.3-2或以上版本
- 對於rhelas2.1: gcc-2.96-108.1或以上版本
 
rhelas3 系統(tǒng)中, make和binutils rpms 已經(jīng)被安裝.然而, 還有以下一些rpms 需要安裝,你能在rhelas3安裝碟中的第3個(gè)找到這些rpms,當(dāng)然也可以下載新版的來裝. 
$su - root
#rpm -uvh gcc-3.2.3-20.i386.rpm /
          glibc-devel-2.3.2-95.3.i386.rpm /
          glibc-headers-2.3.2-95.3.i386.rpm /
          glibc-kernheaders-2.4-8.34.i386.rpm
rhelas2.1系統(tǒng)中, 在"redhat 2.1 advanced server"安裝中,如果你沒有選擇"software development" ,將不會(huì)安裝binutils 和gcc的rpms,為了滿足oracle安裝對於x-windows的需要相依性,需要執(zhí)行以下指令 
$su - root
#rpm -ivh gcc-2.96-108.1.i386.rpm /
          binutils-2.11.90.0.8-12.i386.rpm /
          cpp-2.96-108.1.i386.rpm /
          glibc-devel-2.2.4-32.11.i386.rpm /
          kernel-headers-2.4.9-e.3.i386.rpm
 
rh9系統(tǒng)中, make rpm 已經(jīng)被安裝. 還有以下包需要再裝,請注意oracle不支持在rh9上安裝,你應(yīng)該努力去找到一些合適的rpm , 以下需安裝的包請先在你的rh9的cd中找找,如沒有可以在google.com中搜索到. 
$su - root
#rpm -uvh gcc-3.2.2-5.i386.rpm /
          glibc-devel-2.3.2-5.i386.rpm /
          cpp-3.2.2-5.i386.rpm /
          glibc-kernheaders-2.4-8.10.i386.rpm /
          binutils-2.13.90.0.18-9.i386.rpm
 
 
fc1系統(tǒng)中, make rpm 已經(jīng)被安裝. 還有以下包需要再裝. 注意fc1的情況與rh9類似都不被oracle支持, 你應(yīng)該努力去找到一些合適的rpm , 以下需安裝的包請先在你的rh9的cd中找找,如沒有可以在google.com中搜索到.
$su - root
#rpm -uvh gcc-3.3.2-1.i386.rpm /
          glibc-devel-2.3.2-101.i386.rpm /
          cpp-3.3.2-1.i386.rpm /
          glibc-headers-2.3.2-101.i386.rpm /
          glibc-kernheaders-2.4-8.36.i386.rpm /
          binutils-2.14.90.0.6-3.i386.rpm
 
檢查openmotif rpm
$rpm -q openmotif  (開放軟體基金會(huì)的圖形介面,相關(guān)於linux下的directx)
(以下各個(gè)文件請?jiān)趓h的安裝cd中找,或去google.com搜索,我試過基本都能找到) 
 
rhelas3, 如果沒有安裝openmotif ,請執(zhí)行
$su - root
#rpm -ivh openmotif-2.2.2-16.i386.rpm (或更新版本)
rhelas2.1, 如果沒有安裝openmotif ,請執(zhí)行
$su - root
#rpm -ivh openmotif-2.1.30-11.i386.rpm
 
rh9, 請執(zhí)行 
$su - root
#rpm -uvh openmotif-2.2.2-14.i386.rpm 
 
fc1, 請執(zhí)行 
$su - root
#rpm -uvh openmotif-2.2.2-16.1.i386.rpm
 
檢查setarch rpm
rhelas3, 執(zhí)行以下指令,查核是否為setarch-1.3-1 rpm 或更新版本: 
#rpm -q setarch
setarch是rhel3的一個(gè)新功能. 用於模擬一個(gè)3gb 的虛擬地址空間,以允許如此的應(yīng)用程式能夠正常運(yùn)作,假如沒有安裝請執(zhí)行: 
$su - root
#rpm -uvh setarch-1.3-1.i386.rpm
 
rhelas2.1 和rh9, 不需要setarch rpm. 
對於fc1, 雖然用不到它,也請執(zhí)行: 
$su - root
#rpm -uvh setarch-1.0-1.i386.rpm
檢查redhat-release rpm
查出redhat-release rpm 是否被安裝: 
$rpm -q redhat-release
這個(gè)rpm對於rhel系列的linux很重要,因?yàn)樗鼘⒂渺秓racle的安裝認(rèn)證. 沒有這個(gè)包, oracle10g 將會(huì)認(rèn)定該os不被支持.
- 對rhelas3, 請執(zhí)行(在rhelas3 disk 1中可找到此rpm): 
$su - root
#rpm -ivh redhat-release-3as-1.i386.rpm
- 對 rhelas2.1, 請執(zhí)行(在rhelas3 disk 1中可找到此rpm): 
$su - root
#rpm -ivh redhat-release-as-2.1as-4.noarch.rpm
但是對於rh9 和fc1 ,你只要編輯一下/etc/redhat-release 這個(gè)文件就行了, 
$su - root
#cp /etc/redhat-release /etc/redhat-release.backup
#cat > /etc/redhat-release << eof
#red hat enterprise linux as release 3 (taroon)
#eof
記得安裝完oracle10g要還原該文件內(nèi)容: 
$su - root
#cp /etc/redhat-release.backup /etc/redhat-release
好了,做完以上的準(zhǔn)備工作,我們該開始令人激動(dòng)的oracel10g安裝! 安裝前我們還需設(shè)定一下與oracle相關(guān)的內(nèi)核參數(shù)
先看看所有內(nèi)核參數(shù): 
$su - root
#sysctl -a
安裝執(zhí)行指令在/tmp/disk1下,我們不建議直接執(zhí)行
runinstaller -ignoresysprereqs 
對於oracle10g, 需要設(shè)定為以下參數(shù)值,可以設(shè)定更大一點(diǎn)的值: 
查核結(jié)果可執(zhí)行右邊括號(hào)中內(nèi)容
shmmax  = 2147483648     (cat /proc/sys/kernel/shmmax)
這意味著系統(tǒng)的共享內(nèi)存達(dá)到4g,這是不合適的。一般,shmmax的設(shè)置可略大于本機(jī)內(nèi)存配置。 
事實(shí)上,缺省安裝的redhat 6.0核心運(yùn)行oracle 8.0.5是沒有問題的,一般情況下可不對這些參數(shù)作出調(diào)整。 
如確需調(diào)整,在完成修改后,要按文檔要求重生成核心,并用lilo命令指定用新的核心進(jìn)行引導(dǎo)。
shmmni  = 4096           (cat /proc/sys/kernel/shmmni)
shmall  = 2097152        (cat /proc/sys/kernel/shmall)
shmmin  = 1              (ipcs -lm |grep "min seg size")
shmseg  = 10             (被硬編碼在kernel中,缺省值更高)
semmsl  = 250            (cat /proc/sys/kernel/sem | awk '{print $1}')
semmns  = 32000          (cat /proc/sys/kernel/sem | awk '{print $2}')
semopm  = 100            (cat /proc/sys/kernel/sem | awk '{print $3}')
semmni  = 128            (cat /proc/sys/kernel/sem | awk '{print $4}')
file-max = 65536         (cat /proc/sys/fs/file-max)
ip_local_port_range = 1024 65000 
                         (cat /proc/sys/net/ipv4/ip_local_port_range)
 
note: do not change the value of any kernel parameter on a system where it is already higher than listed as minimum requirement. 
on rhelas3, rhelas2.1, rh9, and on fc1 i had to increase the kernel parameters shmmax, semopm, and filemax to meet the minimum requirement. 
oracle also recommends to set the local port range ip_local_port_range for outgoing messages to "1024 65000" which is needed for high-usage systems. this kernel parameter defines the local port range for tcp and udp traffic to choose from. 
i added the following lines to the /etc/sysctl.conf file which is used during the boot process: 
kernel.shmmax=2147483648
kernel.sem=250 32000 100 128
fs.file-max=65536
net.ipv4.ip_local_port_range=1024 65000
adding these lines to the /etc/sysctl.conf file will cause the system to change these kernel parameters after each boot using the /etc/rc.d/rc.sysinit script which is invoked by /etc/inittab. but in order that these new added lines or settings in /etc/sysctl.conf become effective immediately, execute the following command: 
su - root
sysctl -p
for more information on shmmax, shmmni, shmmin, shmseg, and shmall, see setting shared memory. 
for more information on semmsl, semmni, semmns, and semopm, see setting semaphores. 
for more information on filemax, see setting file handles.
-------------------
<在/oracle/10.1.0/bin/dbshut 加入>
 
##自動(dòng)關(guān)閉listner
if [ -f $oracle_home/bin/lsnrctl ] ; then
  $oracle_home/bin/lsnrctl stop
fi
##自動(dòng)關(guān)閉oracle apache jserv
if [ -f $oracle_home/apache/apache/bin/httpdsctl ] ; then
  $oracle_home/apache/apache/bin/httpdsctl stop
fi
 
36.完成後請測試
        $/oracle/10.1.0/bin/dbstart
        $/oracle/10.1.0/bin/dbshut
37.開機(jī)自動(dòng)啟動(dòng) oracle
    請將oracle10g這個(gè)script cp至/etc/rc.d/init.d
        $cp oracle10g /etc/rc.d/init.d
    再加入開機(jī)服務(wù)程序中
    #chkconfig --add oracle10g
    #linuxconf
   用linuxconf即可控制啟動(dòng)的層次.
************
***oracle10g 執(zhí)行檔
#!/bin/sh
#
# chkconfig: 345 51 49
# description: starts the oracle dabase de
#
echo "oracle 10g auto start/stop"
 
ora_owner=oracle
ora_home=/oracle/10.1.0/db
 
case "$1" in
   'start')
 
echo -n "starting oracle10g: "
su - $ora_owner -c $ora_home/bin/dbstart
touch /var/lock/subsys/oracle10g
echo
;;
 
'stop')
echo -n "shutting oracle10g: "
su - $ora_owner -c $ora_home/bin/dbshut
rm -f /var/lock/subsys/oracle10g
echo
;;
 
 
'restart')
 
echo -n "restarting oracle10g: "
$0 stop
$0 start
echo
;;
 
*)
echo "usage: oracle10g {start | stop | restart }"
exit 1
 
esac
exit 0
*********************oracle10g************