BlueXIII's Blog

热爱技术,持续学习

0%

CentOS7下Oracle11g静默安装

添加组和用户

1
2
3
4
groupadd oinstall
groupadd dba
useradd -g oinstall -G dba oracle
passwd oracle

下载安装介质

下载并解压到/home/oracle/database

修改hosts

1
2
/etc/hosts
172.172.172.97 wfzj97

关闭selinux

1
2
3
4
5
vi /etc/selinux/config
SELINUX=disabled

setenforce 0
getenforce

关闭firewalld

1
2
systemctl stop firewalld
systemctl disable firewalld

修改内核参数

1
2
3
4
5
6
7
8
9
10
11
12
13
14
vi /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

修改/etc/security/limits.conf

1
2
3
4
5
oracle           soft    nproc           2047
oracle hard nproc 16384
oracle soft nofile 1024
oracle hard nofile 65536
oracle soft stack 10240

修改/etc/pam.d/login文件

1
2
session  required   /lib64/security/pam_limits.so
session required pam_limits.so

修改/etc/profile

1
2
3
4
5
6
7
8
if [ $USER = "oracle" ]; then
if [ $SHELL = "/bin/ksh" ]; then
ulimit -p 16384
ulimit -n 65536
else
ulimit -u 16384 -n 65536
fi
fi

创建安装目录

1
2
3
4
5
6
mkdir -p /app/oracle/product/11.2.0
mkdir /app/oracle/oradata
mkdir /app/oracle/inventory
mkdir /app/oracle/fast_recovery_area
chown -R oracle:oinstall /app/oracle
chmod -R 775 /app/oracle

安装依赖

1
yum -y install gcc make binutils gcc-c++ compat-libstdc++-33 elfutils-libelf-devel elfutils-libelf-devel-static elfutils-libelf-devel ksh libaio libaio-devel numactl-devel sysstat unixODBC unixODBC-devel pcre-devel

设置Oracle用户环境变量

1
2
3
4
5
6
7
8
9
su - oracle
vim .bash_profile

添加:
ORACLE_BASE=/app/oracle
ORACLE_HOME=$ORACLE_BASE/product/11.2.0
ORACLE_SID=orcl
PATH=$PATH:$ORACLE_HOME/bin
export ORACLE_BASE ORACLE_HOME ORACLE_SID PATH

编辑静默安装响应文件

1
2
3
4
5
6
7
8
9
10
11
12
13
vi /home/oracle/database/response/db_install.rsp

oracle.install.option=INSTALL_DB_SWONLY
ORACLE_HOSTNAME=gongxm
UNIX_GROUP_NAME=oinstall
INVENTORY_LOCATION=/app/oracle/inventory
SELECTED_LANGUAGES=en,zh_CN
ORACLE_HOME=/app/oracle/product/11.2.0
ORACLE_BASE=/app/oracle
oracle.install.db.InstallEdition=EE
oracle.install.db.DBA_GROUP=dba
oracle.install.db.OPER_GROUP=dba
DECLINE_SECURITY_UPDATES=true

静默安装oracle

1
./runInstaller -silent -ignorePrereq -ignoreSysPrereqs -responseFile /home/oracle/database/response/db_install.rsp

执行root用户脚本

切回root

1
2
sh /app/oracle/inventory/orainstRoot.sh
sh /app/oracle/product/11.2.0/root.sh

配置监听

su - oracle
netca -silent -responseFile /home/oracle/database/response/netca.rsp

修改dbca静默安装配置

1
2
3
4
5
6
7
8
9
10
11
12
vi /home/oracle/database/response/dbca.rsp

GDBNAME = "orcl"
SID = "orcl"
SYSPASSWORD = "oracle"
SYSTEMPASSWORD = "oracle"
SYSMANPASSWORD = "oracle"
DBSNMPPASSWORD = "oracle"
DATAFILEDESTINATION =/app/oracle/oradata
RECOVERYAREADESTINATION=/app/oracle/fast_recovery_area
CHARACTERSET = "ZHS16GBK"
TOTALMEMORY = "1638"

静默配置dbca

1
dbca -silent -responseFile /home/oracle/database/response/dbca.rsp

安装完成检查

lsnrctl status
sqlplus / as sysdba