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下载里搜)
三个安装包;
一、上传安装包
mkdir -p /data/u01/software
之后传到这个目录即可;
更新补丁
yum -y update
二、安装依赖包与创建用户
yum -y install vim unzip lrzsz 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*
三、创建用户。
groupadd oinstall
groupadd dba
useradd -g oinstall -G dba oracle
echo "123456" | 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
四、安装sqlplus
cd /data/u01/software
tar -xvf rlwrap-0.42.tar.gz
cd rlwrap-0.42
./configure
make
make install
cd /data/u01/software
unzip linux.x64_11gR2_database_1of2.zip
unzip linux.x64_11gR2_database_2of2.zip
五、修改配置文件
修改内核文件: vim /etc/sysctl.conf
#添加内容:
fs.aio-max-nr = 1048576
fs.file-max = 6815744
kernel.shmall = 2097152
kernel.shmmax = 1073741824
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
执行:sysctl -p
修改用户限制:vim /etc/security/limits.conf
按一次 "i"进入编辑模式
找到合适的位置
#添加内容:
oracle soft nproc 2047
oracle hard nproc 16384
oracle soft nofile 1024
oracle hard nofile 65536
oracle soft stack 10240
修改/etc/pam.d/login 文件:vim /etc/pam.d/login
#添加内容:
session required /lib64/security/pam_limits.so
session required pam_limits.so
修改/etc/profile 文件:vim /etc/profile
#添加内容:
if [ $USER = "oracle" ]; then
if [ $SHELL = "/bin/ksh" ]; then
ulimit -p 16384
ulimit -n 65536
else
ulimit -u 16384 -n 65536
fi
fi
设置oracle 用户环境变量
先切换到oracle用户:su - oracle
编辑:vim .bash_profile
#添加内容:
export ORACLE_BASE=/data/u01/app/oracle
export ORACLE_HOME=/data/u01/app/oracle/product/11.2.0/dbhome_1
export ORACLE_SID=orcl
export ORACLE_UNQNAME=$ORACLE_SID
export PATH=$ORACLE_HOME/bin:$PATH
export NLS_LANG=american_america.AL32UTF8
alias sqlplus='rlwrap sqlplus'
alias rman='rlwrap rman'
执行:source .bash_profile
六、修改静默相应文件并执行安装
拷贝备份一份响应文件:
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
七、切换新窗口开始配置实例响应文件
配置响应文件:
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
安装创建:
dbca -silent -responseFile /home/oracle/response/dbca.rsp