centos7靜默安裝oracle11g
阿新 • • 發佈:2018-12-19
親自測試,安裝過多臺,均未發現問題
參考官網文件:
https://docs.oracle.com/cd/E11882_01/install.112/e24326/toc.htm#BHCFACHG
安裝基礎依賴包
yum install binutils compat-libcap1 compat-libstdc++-33 gcc gcc-c++ glibc glibc-devel ksh libaio libaio-devel libgcc libstdc++ libstdc++-devel libXi libXtst make sysstat unixODBC unixODBC-devel
新增使用者
groupadd -g 200 oinstall
groupadd -g 201 dba
groupadd -g 202 oper
useradd -g oinstall -u 440 -G dba oracle
修改核心引數
vim /etc/sysctl.conf # sysctl settings are defined through files in # /usr/lib/sysctl.d/, /run/sysctl.d/, and /etc/sysctl.d/. # # Vendors settings live in /usr/lib/sysctl.d/. # To override a whole file, create a new file with the same in # /etc/sysctl.d/ and put new settings there. To override # only specific settings, add a file with a lexically later # name in /etc/sysctl.d/ and put new settings there. # # For more information, see sysctl.conf(5) and sysctl.d(5). fs.aio-max-nr = 1048576 fs.file-max = 6815744 kernel.shmall = 2097152 kernel.shmmax = 536870912 kernel.shmmni = 4096 kernel.sem = 250 32000 100 128 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
重新載入核心引數
/sbin/sysctl -p
建立安裝目錄
mkdir -p /opt/oracle
chown -R oracle.oinstall /opt/oracle
chmod -R 755 /opt/oracle
修改登陸限制
vi /etc/pam.d/login
...
# oracle
session required /lib64/security/pam_limits.so
session required pam_limits.so
修改使用者環境變數
vi /home/oracle/.bash_profile # User specific environment and startup programs ORACLE_BASE=/opt/oracle ORACLE_HOME=$ORACLE_BASE/product/11.2.0/db ORACLE_SID=orcl PATH=$PATH:$ORACLE_HOME/bin:$HOME/.local/bin:$HOME/bin export ORACLE_BASE ORACLE_HOME ORACLE_SID export PATH
解壓oracle安裝包
yum install zip unzip
#按順序解壓1和2
unzip linux*.zip
移動安裝包到oracle家目錄下
mv database /home/oracle/
chown -R oracle.oinstall /home/oracle
修改配置檔案的以下配置項 database/response/db_install.rsp
oracle.install.responseFileVersion=/oracle/install/rspfmt_dbinstall_response_schema_v11_2_0
oracle.install.option=INSTALL_DB_SWONLY
###這個hostname自己看下自己機器的
ORACLE_HOSTNAME=ORACLE_HOSTNAME
UNIX_GROUP_NAME=oinstall
INVENTORY_LOCATION=/opt/oracle/oraInventory
SELECTED_LANGUAGES=en,zh_CN
ORACLE_HOME=/opt/oracle/product/11.2.0/db
ORACLE_BASE=/opt/oracle
oracle.install.db.InstallEdition=EE
oracle.install.db.isCustomInstall=false
oracle.install.db.customComponents=oracle.server:11.2.0.1.0,oracle.sysman.ccr:10.2.7.0.0,oracle.xdk:11.2.0.1.0,oracle.rdbms.oci:11.2.0.1.0,oracle.network:11.2.0.1.0,oracle.network.listener:11.2.0.1.0,oracle.rdbms:11.2.0.1.0,oracle.options:11.2.0.1.0,oracle.rdbms.partitioning:11.2.0.1.0,oracle.oraolap:11.2.0.1.0,oracle.rdbms.dm:11.2.0.1.0,oracle.rdbms.dv:11.2.0.1.0,orcle.rdbms.lbac:11.2.0.1.0,oracle.rdbms.rat:11.2.0.1.0
oracle.install.db.DBA_GROUP=dba
oracle.install.db.OPER_GROUP=oinstall
oracle.install.db.config.starterdb.type=GENERAL_PURPOSE
oracle.install.db.config.starterdb.globalDBName=orcl
oracle.install.db.config.starterdb.SID=orcl
###這個配置是解決中文亂碼
oracle.install.db.config.starterdb.characterSet=AL32UTF8
oracle.install.db.config.starterdb.memoryOption=true
oracle.install.db.config.starterdb.installExampleSchemas=false
oracle.install.db.config.starterdb.enableSecuritySettings=true
oracle.install.db.config.starterdb.password.ALL=work
oracle.install.db.config.starterdb.control=DB_CONTROL
oracle.install.db.config.starterdb.dbcontrol.enableEmailNotification=false
oracle.install.db.config.starterdb.automatedBackup.enable=false
靜默安裝。這裡需要切換到oracle賬戶下進行
su - oracle
/home/oracle/database/runInstaller -silent -ignorePrereq -ignoreSysPrereqs -responseFile /home/oracle/database/response/db_install.rsp
初始化指令碼,這裡要切換回root使用者
/opt/oracle/oraInventory/orainstRoot.sh
/opt/oracle/product/11.2.0/db/root.sh
安裝監聽,這裡也需要切到oracle賬戶
su - oracle
/opt/oracle/product/11.2.0/db/bin/netca /silent /responseFile /home/oracle/database/response/netca.rsp
修改dbca.rsp(需要在配置中設定密碼,否則安裝會出現清屏狀況,影響操作)
SYSPASSWORD = "oracle"
SYSTEMPASSWORD = "oracle"
SYSMANPASSWORD = "oracle"
DBSNMPPASSWORD = "oracle"
dbca.rsp其他配置項:
RESPONSEFILE_VERSION = "11.2.0"
OPERATION_TYPE = "createDatabase"
GDBNAME = "orcl"
SID = "orcl"
TEMPLATENAME = "General_Purpose.dbc"
NATIONALCHARACTERSET= "UTF8"
SOURCEDB = "myhost:1521:orcl"
SOURCEDB = "orcl"
SOURCEDB = "orcl"
DB_UNIQUE_NAME = "orcl"
INSTANCENAME = "orcl"
SYSDBAUSERNAME = "sys"
靜默安裝資料庫
/opt/oracle/product/11.2.0/db/bin/dbca -silent -responseFile /home/oracle/database/response/dbca.rsp
安裝完成,最後測試即可