linux CentOS7下快速静默安装Oracle11GR2数据库并创建实例
本文章适合已经熟悉安装过程,需要快速操作安装部署使用。
多行在一起的命令可以复制一起执行;
初学者建议分步学习:https://edu.51cto.com/course/15530.html

linux.x64_11gR2_database_1of2.zip (oracle官网下载)
linux.x64_11gR2_database_2of2.zip (oracle官网下载)
rlwrap-0.42.tar.gz (51CTO下载里搜)
三个安装包;
操作系统环境:最小化安装 centos7

一、创建目录、更新补丁、安装依赖包与创建用户

mkdir -p /data/u01/software
yum -y install lrzsz vim unzip
groupadd oinstall
groupadd dba
useradd -g oinstall -G dba oracle
echo "Oracle20190728" | passwd --stdin oracle
mkdir -p /data/u01/app/oracle/product/11.2.0/dbhome_1
mkdir /data/u01/app/oracle/{oradata,inventory,fast_recovery_area}
chown -R oracle:oinstall /data/u01/app/oracle
chmod -R 775 /data/u01/app/oracle
yum -y install gcc gcc-c++ make binutils compat-libstdc++-33 elfutils-libelf elfutils-libelf-devel elfutils-libelf-devel-static glibc glibc-common glibc-devel ksh libaio libaio-devel libgcc libstdc++ libstdc++-devel numactl-devel sysstat unixODBC unixODBC-devel kernelheaders pdksh pcre-devel readline*
yum -y update
cd /data/u01/software
ls

二、新会话:上传安装包

cd /data/u01/software
ls
上传三个包

三、新会话修改配置文件、安装sqlplus

echo "#"$(date) "quick install oracle11GR2 add vim /etc/sysctl.conf">> /etc/sysctl.conf
echo "fs.aio-max-nr = 1048576" >> /etc/sysctl.conf
echo "fs.file-max = 6815744" >> /etc/sysctl.conf
echo "kernel.shmall = 2097152" >> /etc/sysctl.conf
echo "kernel.shmmax = 1073741824" >> /etc/sysctl.conf
echo "kernel.shmmni = 4096" >> /etc/sysctl.conf
echo "kernel.sem = 250 32000 100 128" >> /etc/sysctl.conf
echo "net.ipv4.ip_local_port_range = 9000 65500" >> /etc/sysctl.conf
echo "net.core.rmem_default = 262144" >> /etc/sysctl.conf
echo "net.core.rmem_max = 4194304" >> /etc/sysctl.conf
echo "net.core.wmem_default = 262144" >> /etc/sysctl.conf
echo "net.core.wmem_max = 1048576" >> /etc/sysctl.conf
sysctl -p
echo "#"$(date) "quick install oracle11GR2 add vim /etc/security/limits.conf">>/etc/security/limits.conf
echo "oracle soft nproc 2047" >>/etc/security/limits.conf
echo "oracle hard nproc 16384" >>/etc/security/limits.conf
echo "oracle soft nofile 1024" >>/etc/security/limits.conf
echo "oracle hard nofile 65536" >>/etc/security/limits.conf
echo "oracle soft stack 10240" >>/etc/security/limits.conf
echo "#"$(date) "quick install oracle11GR2 add vim /etc/pam.d/login">>/etc/pam.d/login
echo "session required /lib64/security/pam_limits.so">>/etc/pam.d/login
echo "session required pam_limits.so">>/etc/pam.d/login

echo "#"$(date) "quick install oracle11GR2 add vim /etc/profile">>/etc/profile
echo 'if [ $USER = "oracle" ]; then'>>/etc/profile
echo 'if [ $SHELL = "/bin/ksh" ]; then'>>/etc/profile
echo "ulimit -p 16384">>/etc/profile
echo "ulimit -n 65536">>/etc/profile
echo "else">>/etc/profile
echo "ulimit -u 16384 -n 65536">>/etc/profile
echo "fi">>/etc/profile
echo "fi">>/etc/profile

cd /data/u01/software
tar -xvf rlwrap-0.42.tar.gz
cd rlwrap-0.42
./configure
make
make install

需要等上传完成;

unzip linux.x64_11gR2_database_1of2.zip
unzip linux.x64_11gR2_database_2of2.zip

su - oracle
echo "#"$(date) "quick install oracle11GR2 add vim .bash_profile">>.bash_profile
echo "export ORACLE_BASE=/data/u01/app/oracle">>.bash_profile
echo "export ORACLE_HOME=/data/u01/app/oracle/product/11.2.0/dbhome_1">>.bash_profile
echo "export ORACLE_SID=orcl">>.bash_profile
echo 'export ORACLE_UNQNAME=$ORACLE_SID'>>.bash_profile
echo 'export PATH=$ORACLE_HOME/bin:$PATH'>>.bash_profile
echo "export NLS_LANG=american_america.AL32UTF8">>.bash_profile
echo "alias sqlplus='rlwrap sqlplus'">>.bash_profile
echo "alias rman='rlwrap rman'">>.bash_profile
source .bash_profile
ls

四、修改静默响应文件并执行安装

拷贝备份一份响应文件:
cp -R /data/u01/software/database/response/ .
cd response/
vim db_install.rsp

修改内容:
oracle.install.option=INSTALL_DB_SWONLY
ORACLE_HOSTNAME=localhost.localdomain
UNIX_GROUP_NAME=oinstall
INVENTORY_LOCATION=/data/u01/app/oracle/inventory
SELECTED_LANGUAGES=en,zh_CN
ORACLE_HOME=/data/u01/app/oracle/product/11.2.0/dbhome_1
ORACLE_BASE=/data/u01/app/oracle
oracle.install.db.InstallEdition=EE
oracle.install.db.DBA_GROUP=dba
oracle.install.db.OPER_GROUP=dba
DECLINE_SECURITY_UPDATES=true

切换到解压的安装包目录执行安装:
cd /data/u01/software/database/
./runInstaller -silent -responseFile /home/oracle/response/db_install.rsp -ignorePrereq
sqlplus / as sysdba

linux CentOS7下快速静默安装Oracle11GR2数据库并创建实例

五、切换一个会话开始配置实例响应文件

配置响应文件:
vim /home/oracle/response/dbca.rsp
修改内容(注意修改选项前面的#要删除):
GDBNAME = "orcl"
SID = "orcl"
SYSPASSWORD = "输入密码"
SYSTEMPASSWORD = "输入密码"
SYSMANPASSWORD = "输入密码"
DBSNMPPASSWORD = "输入密码"
DATAFILEDESTINATION =/data/u01/app/oracle/oradata
RECOVERYAREADESTINATION=/data/u01/app/oracle/fast_recovery_area
CHARACTERSET = "AL32UTF8"
TOTALMEMORY = "2048"

egrep -v "(^#|^$)" /home/oracle/response/dbca.rsp

安装创建(等第六步成功后执行):
cd ~
dbca -silent -responseFile /home/oracle/response/dbca.rsp
linux CentOS7下快速静默安装Oracle11GR2数据库并创建实例

lsnrctl start
启动监听器

lsnrctl stop
停止监听器命令.

lsnrctl status
查看监听状态.

linux CentOS7下快速静默安装Oracle11GR2数据库并创建实例

实测30分钟内可完成以上操作;
最快17分钟完成以上操作;

运维、网管必会技能:linux centos7命令行静默安装oracle11GR2视频课程视频教程:http://edu.51cto.com/course/15530.html

linux CentOS7最小化安装环境静默安装Oracle11GR2数据库(静默创建实例)
linux CentOS7下快速静默安装Oracle11GR2数据库并创建实例