系統硬體需求
| 項目 | 最低需求 | 建議配置 |
| 記憶體 | 1 GB | 4 GB+ |
| Swap 空間 | 1.5x RAM | 2x RAM (大記憶體機器 1.5x 即可) |
| /tmp 空間 | 400 MB | 2 GB+ |
| 軟體安裝空間 | 3.5 GB | 10 GB+ |
| 資料檔空間 | 1.2 GB | 視資料量規劃 (ASM/檔案系統) |
軟體準備
- SUSE Linux Enterprise Server 10 (SLES 10) x86_64
- Oracle Database 10g Release 2 (10.2.0.1+) for Linux x86-64
orarun-1.8-109.15.x86_64.rpm (從 Novell/Oracle 合作倉庫下載)
安裝前置作業
1. 確認編譯工具鏈
# 檢查 gcc
gcc --version
# 若無,安裝 "C/C++ Compiler and Tools" 模組 (YaST → 軟體管理 → 模式)
2. 安裝 orarun 套件 (自動建立 oracle 用戶、群組、目錄結構)
rpm -ivh orarun-1.8-109.15.x86_64.rpm
# 自動建立:
# 用戶: oracle
# 群組: oinstall, dba
# 目錄: /opt/oracle (ORACLE_BASE)
# 環境腳本: /etc/profile.d/oracle.sh
3. 安裝必要系統庫
# 從 SLES 10 DVD/ISO 安裝
rpm -ivh libaio-0.3.104-*.x86_64.rpm
rpm -ivh libaio-devel-0.3.104-*.x86_64.rpm
# 10gR2 還需:
rpm -ivh compat-libstdc++-5.0.7-*.x86_64.rpm
rpm -ivh gcc-c++-4.1.2-*.x86_64.rpm
4. 核心參數調優 (/etc/sysctl.conf)
# 共享記憶體
kernel.shmmax = 68719476736 # 64GB (物理記憶體 80% 以上)
kernel.shmall = 4294967296 # 4GB pages
kernel.shmmni = 4096
kernel.sem = 250 32000 100 128
# 檔案描述符
fs.file-max = 6815744
# 網路
net.ipv4.ip_local_port_range = 9000 65500
net.core.rmem_default = 262144
net.core.rmem_max = 4194304
net.core.wmem_default = 262144
net.core.wmem_max = 1048576
# 生效
sysctl -p
5. 用戶限制 (/etc/security/limits.conf)
oracle soft nproc 2047
oracle hard nproc 16384
oracle soft nofile 1024
oracle hard nofile 65536
oracle soft stack 10240
oracle hard stack 32768
6. 啟用 oracle 用戶登入 Shell
# orarun 建立的用戶預設 shell 為 /bin/false
usermod -s /bin/bash oracle
# 設定密碼
passwd oracle
Oracle 環境變數配置
# 編輯 /etc/profile.d/oracle.sh (orarun 已建立基礎版本)
# 修改為完整配置:
export ORACLE_BASE=/opt/oracle
export ORACLE_HOME=$ORACLE_BASE/product/10.2.0/db_1
export ORACLE_SID=ORCL
export PATH=$ORACLE_HOME/bin:$PATH
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib
export TNS_ADMIN=$ORACLE_HOME/network/admin
export NLS_LANG="SIMPLIFIED CHINESE_CHINA.AL32UTF8"
export NLS_DATE_FORMAT="YYYY-MM-DD HH24:MI:SS"
# 登入 oracle 用戶驗證
su - oracle
env | grep ORACLE
Oracle 安裝執行
- 切換 oracle 用戶:
su - oracle
- 解壓安裝包:
unzip 10201_database_linux_x86_64.zip
- 啟動安裝器:
cd database; ./runInstaller
- 選擇 Advanced Installation → Enterprise Edition
- 指定 Oracle Home:
/opt/oracle/product/10.2.0/db_1
- Inventory 目錄:
/opt/oracle/oraInventory (群組 oinstall)
- 前置條件檢查:忽略套件版本警告 (SLES 10 套件較新)
- 資料庫配置:建立啟動資料庫、字元集 AL32UTF8、國家字元集 AL16UTF16
- 密碼管理:SYS/SYSTEM 設定強密碼
- 執行根腳本:
/opt/oracle/oraInventory/orainstRoot.sh、$ORACLE_HOME/root.sh
安裝後驗證與配置
# 1. 驗證資料庫啟動
sqlplus / as sysdba
SELECT INSTANCE_NAME, STATUS FROM V$INSTANCE;
# 2. 配置 Listener (netca)
netca
# 3. 設定自動啟動 (可選)
# 編輯 /etc/oratab: ORCL:/opt/oracle/product/10.2.0/db_1:Y
# 配置 dbstart/dbshut 腳本至 runlevel
SLES 10 特有注意事項
- YaST 防火牆需開放 1521 (Listener)、5500/5520 (EM Console)
- AppArmor 可能干擾 Oracle 程式,建議設定 complain 模式或停用
- SLES 10 內核 (2.6.16) 相容性良好,但 glibc 版本較新需確認 orarun 版本匹配
- 多路徑/存儲多路徑 (multipath) 環境需配置
/etc/multipath.conf 排除 Oracle 磁碟