軟件:Red Hat 4 AS U7, Oracle 10g R2 for linux32, VMWare 7, Windows 7
?
詳細步驟清單:
在Red Hat 4 AS U7上安裝oracle10gR2 1. 硬件需求: =========================================== 至少1024MB物理內存 # grep MemTotal /proc/meminfo =========================================== 交換空間大小分配需求 物理內存:1024 MB ~ 2048 MB, 1.5倍物理內存 物理內存:2049 MB ~ 8192 MB, 1倍物理內存 物理內存:8192 MB ~,0.75倍物理內存 # grep SwapTotal /proc/meminfo =========================================== /tmp目錄至少留有400 MB空間 # df -k /tmp =========================================== 1.5 GB至3.5 GB用于安裝Oracle軟件 # df -k =========================================== 1.2 GB用于預安裝Oracle數據庫 # df -k =========================================== 2. 軟件需求: Red Hat Enterprise Linux 4.0需要安裝如下包: binutils-2.15.92.0.2-13.EL4 compat-db-4.1.25-9 compat-libstdc++-296-2.96-132.7.2 control-center-2.8.0-12 gcc-3.4.3-22.1.EL4 gcc-c++-3.4.3-22.1.EL44 glibc-2.3.4-2.9 glibc-common-2.3.4-2.9 gnome-libs-1.4.1.2.90-44.1 libstdc++-3.4.3-22.1 libstdc++-devel-3.4.3-22.1 make-3.80-5 pdksh-5.2.14-30 sysstat-5.0.5-1 xscreensaver-4.18-5.rhel4.2 setarch-1.6-1 =========================================== rpm -q binutils compat-db compat-libstdc++ control-center gcc gcc-c++ glibc glibc-common rpm -q gnome-libs libstdc++ libstdc++-devel make pdksh sysstat xscreensaver setarch [root@ora10g ~]# cd /media/cdrom/RedHat/RPMS [root@ora10g RPMS]# rpm -Uvh compat-db* 在安裝rpm包時,如果遇到相關性檢查并報如下錯誤時,可通過安裝glibc-kernheaders-2.4-9.1.103.EL.i386.rpm 解決: kernel-headers is needed by glibc-headers-2.3.4-2.41.i386 kernel-headers >= 2.2.1 is needed by glibc-headers-2.3.4-2.41.i386 Ref:http://hi.baidu.com/wa0362/blog/item/023337efffd4ff1efcfa3ca9.html =========================================== 檢查red hat發行版本號: # cat /etc/issue =========================================== 檢查內核版本號: # uname -r =========================================== 查詢相應package是否安裝: # rpm -q package_name =========================================== 3. 網絡需求: =========================================== 檢查是否使用/etc/hosts進行名字解析(name resolution),如下命名應有files結果返回 # cat /etc/nsswitch.conf | grep hosts [root@ora10g ~]# cat /etc/nsswitch.conf | grep hosts #hosts: db files ldap nis dns hosts: files dns =========================================== 檢查主機名是否設置,如下命令應有類似結果(myhost.mycomputer.com)返回: # hostname [root@ora10g ~]# hostname ora10g =========================================== 檢查域名是否沒有被動態設置,如下命令不應返回任何結果: # domainname [root@ora10g ~]# domainname (none) =========================================== 檢查hosts文件是否包含完整的描述名稱(the fully qualified host name),如下命令應有類似結果( 192.168.100.16 myhost.us.mycompany.com myhost 127.0.0.1 localhost localhost.localdomain )返回: # cat /etc/hosts | grep `eval hostname` [root@ora10g ~]# cat /etc/hosts | grep `eval hostname` 192.168.168.213 ora10g.kl.com ora10g [root@ora10g ~]# =========================================== 4. 創建必要的操作系統組和用戶: oinstall組,必需,Oracle產品目錄組(Oracle Inventory Group): 如果如下命令沒有類似結果( inventory_loc=/u01/app/oracle/oraInventory inst_group=oinstall )返回,則必需創建該組: # more /etc/oraInst.loc 創建oinstall組 # /usr/sbin/groupadd oinstall =========================================== dba組,必需,如果需要使用不同的名字,則需要在安裝Oracle是進行指定, 可為不同的oracle安裝指定不同的dba組: 創建dba組 # /usr/sbin/groupadd dba =========================================== oper組,可選,該組用來區分dba的普通用戶,權限為SYSOPER: 創建oper組 # /usr/sbin/groupadd oper =========================================== 創建oracle安裝用戶 確認用戶是否存在,如果存在如下命令將有類似結果( uid=440(oracle) gid=200(oinstall) groups=201(dba),202(oper) )返回: # id oracle 不存在則可使用如下命令創建用戶,存在請更換用戶名: # /usr/sbin/useradd -g oinstall -G dba[,oper] oracle 設置密碼: # passwd oracle =========================================== [root@ora10g RPMS]# more /etc/oraInst.loc /etc/oraInst.loc: No such file or directory [root@ora10g RPMS]# /usr/sbin/groupadd oinstall [root@ora10g RPMS]# /usr/sbin/groupadd dba [root@ora10g RPMS]# groupadd oper [root@ora10g RPMS]# id oracle id: oracle: No such user [root@ora10g RPMS]# useradd -g oinstall -G dba,oper oracle [root@ora10g RPMS]# passwd oracle Changing password for user oracle. New UNIX password: BAD PASSWORD: it is based on a dictionary word Retype new UNIX password: passwd: all authentication tokens updated successfully. =========================================== 5. 配置內核參數 檢查/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 = 1048576 net.core.rmem_max = 1048576 net.core.wmem_default = 262144 net.core.wmem_max = 262144 以上內核參數需要重啟后生效。 =========================================== [root@ora10g RPMS]# cat /etc/sysctl.conf # Kernel sysctl configuration file for Red Hat Linux # # For binary values, 0 is disabled, 1 is enabled. See sysctl(8) and # sysctl.conf(5) for more details. # Controls IP packet forwarding net.ipv4.ip_forward = 0 # Controls source route verification net.ipv4.conf.default.rp_filter = 1 # Do not accept source routing net.ipv4.conf.default.accept_source_route = 0 # Controls the System Request debugging functionality of the kernel kernel.sysrq = 0 # Controls whether core dumps will append the PID to the core filename. # Useful for debugging multi-threaded applications. kernel.core_uses_pid = 1 [root@ora10g RPMS]# vi /etc/sysctl.conf [root@ora10g RPMS]# cat /etc/sysctl.conf # Kernel sysctl configuration file for Red Hat Linux # # For binary values, 0 is disabled, 1 is enabled. See sysctl(8) and # sysctl.conf(5) for more details. # Controls IP packet forwarding net.ipv4.ip_forward = 0 # Controls source route verification net.ipv4.conf.default.rp_filter = 1 # Do not accept source routing net.ipv4.conf.default.accept_source_route = 0 # Controls the System Request debugging functionality of the kernel kernel.sysrq = 0 # Controls whether core dumps will append the PID to the core filename. # Useful for debugging multi-threaded applications. 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 = 1048576 net.core.rmem_max = 1048576 net.core.wmem_default = 262144 net.core.wmem_max = 262144 [root@ora10g RPMS]# =========================================== 針對oracle用戶設置Shell的限制以優化性能 ------------------------------------------- 在/etc/security/limits.conf 文件中增加如下配置: oracle soft nproc 2047 oracle hard nproc 16384 oracle soft nofile 1024 oracle hard nofile 65536 ------------------------------------------- 在/etc/pam.d/login 文件中增加如下配置: session required /lib/security/pam_limits.so session required pam_limits.so ------------------------------------------- 在/etc/profile 文件中增加如下配置,適用于 Bash或者Korn shell: 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根目錄(Oracle Base Directory)已經存在: # more /var/opt/oracle/oraInst.loc 沒有則使用如下命令創建oracle根目錄: # mkdir -p /mount_point/app/oracle_sw_owner # chown -R oracle:oinstall /mount_point/app/oracle_sw_owner # chmod -R 775 /mount_point/app/oracle_sw_owner mount_point:為掛載點,如u01。 oracle_sw_owner:為安裝oracle軟件的用戶名,如oracle。 ------------------------------------------- [root@ora10g ~]# mkdir -p /u01/app/oracle [root@ora10g ~]# chown -R oracle:oinstall /u01/app/oracle/ [root@ora10g ~]# chmod -R 775 /u01/app/oracle/ [root@ora10g ~]# ------------------------------------------- 目錄創建好后需要設置環境變量ORACLE_BASE,使其指向/mount_point/app/oracle_sw_owner。 Bourne, Bash, or Korn shell: $ ORACLE_BASE=/u01/app/oracle $ ORACLE_SID=sales $ export ORACLE_BASE ORACLE_SID ------------------------------------------- [oracle@ora10g ~]$ ORACLE_BASE=/u01/app/oracle [oracle@ora10g ~]$ ORACLE_SID=ora10g [oracle@ora10g ~]$ export ORACLE_BASE ORACLE_SID [oracle@ora10g ~]$ =========================================== 設置建立文件和文件夾時預設的權限掩碼: 如果是Bourne shell (sh), Bash shell (bash), or Korn shell (ksh),執行如下命名編輯用戶shell啟動文件: $ vi .bash_profile 然后編輯或者增加如下行(umask 022相當與每建立一個文件或文件夾時都chmod 755): umask 022 最后運行該啟動腳本使其生效: Bash shell: $ . ./.bash_profile Bourne or Korn shell: $ . ./.profile ------------------------------------------- [oracle@ora10g ~]$ vi .bash_profile [oracle@ora10g ~]$ . ./.bash_profile [oracle@ora10g ~]$ umask 0022 =========================================== 執行以下命令以確認 ORACLE_HOME 和 TNS_ADMIN 環境變量沒有被設置: $ unset ORACLE_HOME $ unset TNS_ADMIN =========================================== 注意:所有的環境變量都是在oracle用戶下設置的。 以上步驟完成后即可在oracle 10g r2的軟件安裝目錄下執行如下命令進行安裝: ./runInstaller 安裝的時候最好選擇custom方式的安裝,這樣可以看到很多環境變量里面自定義的參數被應用到了哪些地方。 ------------------------------------------- [oracle@ora10g database]$ ./runInstaller =========================================== 《全篇完》 Ref: 《Database Installation Guide for Linux x86》 - Preinstallation Tasks ===========================================