首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
您现在的位置: 程式碼之家 >> 數據庫知識 >  >> Oracle 資料庫 >> Oracle 資料庫基礎

Oracle 10g 靜默安裝全流程實戰:從OS前置到DBCA建庫的Response File最佳實踐

     編輯:Oracle 資料庫基礎

適用場景

無圖形介面的Linux/Unix伺服器、自動化部署腳本、需記錄每步操作以便審計的環境。平台:RHEL 4.5 / Oracle 10.2.0.1。

階段一:OS層面前置作業(root執行)

1. 解壓軟體


cd /home
unzip 10201_database_linux32.zip

2. 建立用戶群組


groupadd oinstall
groupadd dba
useradd -g oinstall -G dba oracle
passwd oracle

3. 核心參數 /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

sysctl -p 生效。

4. 用戶資源限制


# /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
if [ $USER = "oracle" ]; then
  if [ $SHELL = "/bin/bash" ]; then ulimit -p 16384; ulimit -n 65536;
  else ulimit -u 16384 -n 65536; fi
fi

# /etc/selinux/config
SELINUX=disabled

修改SELinux需重啟OS。

5. ORACLE_BASE 目錄


mkdir -p /opt/oracle
chown -R oracle:oinstall /opt/oracle
chmod -R 775 /opt/oracle

6. oracle用戶 .bash_profile


umask 022
export ORACLE_BASE=/opt/oracle
export ORACLE_HOME=/opt/oracle/product/10.2.0/db_1
export ORACLE_SID=WENDING
export PATH=$ORACLE_HOME/bin:$PATH

階段二:Inventory 與 Response File 準備

1. /etc/oraInst.loc (root)


inventory_loc=/opt/oracle/oraInventory
inst_group=oinstall

chmod 664 /etc/oraInst.loc

2. 複製並編輯 enterprise.rsp (oracle用戶)


cd /home/database/response
cp enterprise.rsp enterprise_temp.rsp
vi enterprise_temp.rsp

必填參數:


UNIX_GROUP_NAME="oinstall"
ORACLE_HOME="/opt/oracle/product/10.2.0/db_1"
ORACLE_HOME_NAME="OraDb10g_home1"
s_nameForDBAGrp="dba"
s_nameForOPERGrp="dba"
n_configurationOption=3   # 3=僅安裝軟體,不建庫

階段三:靜默安裝軟體


cd /home/database
./runInstaller -silent -noconfig -responseFile /home/database/response/enterprise_temp.rsp

安裝結束後,root執行:


/opt/oracle/product/10.2.0/db_1/root.sh

階段四:NetCA 靜默建立 Listener


cd /home/database/response
cp netca.rsp netca_temp.rsp
# 如需自訂Listener名/端口編輯 netca_temp.rsp
$ORACLE_HOME/bin/netca /silent /responsefile /home/database/response/netca_temp.rsp

執行完成即Listener已啟動(預設LISTENER:1521)。

階段五:DBCA 靜默建庫(可選)


cp dbca.rsp dbca_temp.rsp
# 編輯關鍵參數:GDBNAME, SID, TEMPLATENAME, SYSPASSWORD, SYSTEMPASSWORD, 
# DATAFILEDESTINATION, CHARACTERSET=AL32UTF8, TOTALMEMORY
$ORACLE_HOME/bin/dbca -silent -responseFile /home/database/response/dbca_temp.rsp

驗證清單

  • sqlplus / as sysdba 連線成功
  • lsnrctl status Listener READY
  • select instance_name, status from v$instance; 顯示OPEN
  1. 上一篇文章:
  2. 下一篇文章:
Copyright © 程式碼之家 All Rights Reserved