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

CentOS 5.10 上 Oracle 11.2.0.3 靜默安裝完整實戰手冊

     編輯:Oracle 教學

環境準備

1. 系統安裝選包

  • Base: Administration Tools, Base, Legacy Software Support (compat-libstdc++, compat-db), System Tools (sysstat)
  • Desktop: GNOME Desktop Environment
  • Development: Development Libraries (libstdc++-devel), Development Tools (gcc), Legacy Software Development
  • Languages: Chinese Support
  • Servers: FTP Server, Legacy Network Server (rsh-server, telnet-server), Printing Support

2. 圖形界面遠程訪問

CentOS 5.10 配置 GDM/XDMCP:

# 編輯 /usr/share/gdm/defaults.conf
[xdmcp]
Enable=true
DisplaysPerHost=5
Port=177

[security]
AllowRemoteRoot=true

# 重啟服務
service gpm restart; chkconfig gpm on
/usr/sbin/gdm-restart

3. Yum 源配置

cd /etc/yum.repos.d
mv CentOS-Base.repo CentOS-Base.repo.old
wget https://mirrors.163.com/.help/CentOS6-Base-163.repo  # 注意:CentOS 5 應用對應 5 的 repo
yum makecache
yum -y groupinstall 'Development Libraries'

核心依赖包安裝

# 掛載光盤或使用 yum
rpm -Uvh binutils-2.* compat-libstdc++-33* elfutils-libelf* gcc-4.* gcc-c++-4.* \
glibc-2.* glibc-common-2.* glibc-devel-2.* glibc-headers-2.* ksh* \
libaio-0.* libaio-devel-0.* libgomp-4.* libgcc-4.* libstdc++-4.* \
libstdc++-devel-4.* make-3.* sysstat-7.* numactl-devel-* \
unixODBC-2.* unixODBC-devel-2.* pdksh

# yum 方式補充
yum install unixODBC elfutils-libelf-devel pdksh

內核參數與用戶環境

/etc/sysctl.conf 關鍵參數

fs.suid_dumpable = 1
fs.aio-max-nr = 1048576
fs.file-max = 6815744
kernel.shmall = 2097152
kernel.shmmax = 2532755456  # 物理內存 50% 以上
kernel.shmmni = 4096
kernel.sem = 250 32000 100 128
net.ipv4.ip_local_port_range = 9000 65500
net.core.rmem_default = 4194304
net.core.rmem_max = 4194304
net.core.wmem_default = 262144
net.core.wmem_max = 1048586

執行 /sbin/sysctl -p 生效。

/etc/security/limits.conf

oracle soft nproc 2047
oracle hard nproc 16384
oracle soft nofile 1024
oracle hard nofile 65536
oracle hard stack 10240

創建用戶組與目錄

groupadd oinstall
groupadd dba
groupadd oper
useradd -g oinstall -G dba,oper -d /home/oracle oracle
passwd oracle

mkdir -p /u01/app/oracle/product/11.2.0/db_1
chown -R oracle:oinstall /u01
chmod -R 775 /u01

Oracle 用戶環境變量 (~/.bash_profile)

export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=$ORACLE_BASE/product/11.2.0/db_1
export ORACLE_SID=orcl
export PATH=$ORACLE_HOME/bin:/usr/sbin:$PATH
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib
export NLS_LANG="SIMPLIFIED CHINESE"_CHINA.AL32UTF8
export NLS_DATE_FORMAT="yyyy-mm-dd HH24:MI:SS"
# ulimit 設置...

靜默安裝數據庫軟件

方式一:命令行參數

cd /soft/database
./runInstaller -silent -debug -force \
FROM_LOCATION=/soft/database/stage/products.xml \
oracle.install.option=INSTALL_DB_SWONLY \
ORACLE_HOSTNAME=ocpyang.sz.com \
UNIX_GROUP_NAME=oinstall \
INVENTORY_LOCATION=/u01/app/oraInventory \
SELECTED_LANGUAGES=en,zh_CN \
ORACLE_HOME=/u01/app/oracle/product/11.2.0/db_1 \
ORACLE_BASE=/u01/app/oracle \
oracle.install.db.InstallEdition=EE \
oracle.install.db.DBA_GROUP=dba \
oracle.install.db.OPER_GROUP=oper \
oracle.install.db.config.starterdb.type=GENERAL_PURPOSE \
oracle.install.db.config.starterdb.memoryOption=false \
oracle.install.db.config.starterdb.installExampleSchemas=false \
oracle.install.db.config.starterdb.enableSecuritySettings=true \
oracle.install.db.config.starterdb.control=DB_CONTROL \
SECURITY_UPDATES_VIA_MYORACLESUPPORT=false \
DECLINE_SECURITY_UPDATES=true \
oracle.installer.autoupdates.option=SKIP_UPDATES

方式二:響應文件

vi /home/oracle/ocp.rsp
# 內容見原文,關鍵參數同上
./runInstaller -ignoreSysPrereqs -force -silent -responseFile /home/oracle/response/ocp.rsp

安裝結束後以 root 執行 orainstRoot.sh 和 root.sh。

靜默建庫與配置監聽

建庫響應文件 (createdb.rsp)

[GENERAL]
RESPONSEFILE_VERSION = "11.2.0"
OPERATION_TYPE = "createDatabase"

[CREATEDATABASE]
GDBNAME = "orcl"
SID = "orcl"
TEMPLATENAME = "General_Purpose.dbc"
SYSPASSWORD = "password"
SYSTEMPASSWORD = "password"
SYSMANPASSWORD = "password"
DBSNMPPASSWORD = "password"
DATAFILEDESTINATION = "/u01/app/oracle/oradata"
STORAGETYPE = FS
CHARACTERSET = "ZHS16GBK"
DATABASETYPE = "MULTIPURPOSE"
AUTOMATICMEMORYMANAGEMENT = "FALSE"
dbca -silent -responseFile /home/oracle/response/createdb.rsp

配置監聽

$ORACLE_HOME/bin/netca /silent /responsefile /home/oracle/response/netca.rsp
lsnrctl status

安裝後配置與自啟動

  1. 編輯 /etc/oratab:orcl:/u01/app/oracle/product/11.2.0/db_1:Y
  2. 修改 $ORACLE_HOME/bin/dbstart 中 ORACLE_HOME_LISTNER=$ORACLE_HOME
  3. 創建 /etc/init.d/oracle11gr2 服務腳本,chkconfig --add oracle11gr2
  4. 常用管理命令:dbstart/dbshut, lsnrctl start/stop, emctl start/stop dbconsole

SQL*Plus 全局登錄腳本

編輯 $ORACLE_HOME/sqlplus/admin/glogin.sql 統一會話設置(日期格式、編輯器、輸出寬度、提示符等)。

  1. 上一篇文章:
  2. 下一篇文章:
Copyright © 程式碼之家 All Rights Reserved