Linux静默安装Oracle12c详解
Linux静默安装Oracle12c详解
1.关闭防火墙,禁止防火墙开机自启
# 关闭防火墙
systemctl stop firewalld.service
# 禁止防火墙开机启动
systemctl disable firewalld.service
# 查看防火墙状态
systemctl status firewalld.service
2.关闭selinux
# 替换文本参数
sed -i 's/SELINUX=enforcing/SELINUX=disabled/' /etc/selinux/config
# 查文本状态
grep SELINUX=disabled /etc/selinux/config
#关闭当前SELINUX
setenforce 0
3.yum安装必要安装包
yum -y install binutils compat-libcap1 compat-libstdc++-33 compat-libstdc++-33.i686 gcc gcc-c++ glibc glibc.i686 glibc-devel glibc-devel.i686 ksh libgcc libgcc.i686 libstdc++ libstdc++.i686 libstdc++-devel libstdc++-devel.i686 libaio libaio.i686 libaio-devel libaio-devel.i686 libXext libXext.i686 libX11 libX11.i686 libxcb libxcb.i686 libXi libXi.i686 make sysstat
若执行一遍失败则继续执行第二遍(多次执行不会出现其他问题)
4、创建运行oracle数据库的用户组和系统用户
groupadd oinstall
groupadd dba
useradd -g oinstall -G dba -m oracle
passwd oracle
>>12345678
>>12345678 //输入两次密码,设置生效
5、修改内核参数,vi /etc/sysctl.conf,添加:
vi /etc/sysctl.conf
fs.aio-max-nr = 1048576
fs.file-max = 6815744
kernel.shmall = 2097152
kernel.shmmax = 4098955264
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
6、修改用户限制
vi /etc/security/limits.conf
oracle soft nproc 2047
oracle hard nproc 16384
oracle soft nofile 1024
oracle hard nofile 65536
oracle soft stack 10240
oracle hard stack 10240
vi /etc/pam.d/login
session required /lib64/security/pam_limits.so
session required pam_limits.so
7、修改环境变量
vi /etc/profile
if [ "$USER" = "oracle" ]; then
if [ "$SHELL" = "/bin/ksh" ]; then
ulimit -p 16384
ulimit -n 65536a
else
ulimit -u 16384 -n 65536
fi
fi
source /etc/profile
8、创建安装及数据目录
mkdir -p /usr/local/oraInventory
mkdir -p /usr/local/oracle/product/12.1.0/db_1
chown -R oracle:oinstall /usr/local/oracle
chown -R oracle:oinstall /usr/local/oraInventory
chmod -R 775 /usr/local/oracle
9、切换用户,修改配置文件
su - oracle
vi ~/.bash_profile
export ORACLE_BASE=/usr/local/oracle
export ORACLE_HOME=$ORACLE_BASE/product/12.1.0/db_1
export ORACLE_SID=orcl
export PATH=$ORACLE_HOME/bin:$PATH
source ~/.bash_profile
把文件里面export PATH这行删除,替换上面的语句
10、解压安装文件,并修改参数配置
unzip linuxx64_12201_database.zip
cp -R /home/oracle/database /usr/local/oracle/
cd /usr/local/oracle/database/response/
vim db_install.rsp
oracle.install.option=INSTALL_DB_SWONLY
UNIX_GROUP_NAME=oinstall
INVENTORY_LOCATION=/usr/local/oraInventory
ORACLE_HOME=/usr/local/oracle/product/12.1.0/db_1
ORACLE_BASE=/usr/local/oracle
oracle.install.db.InstallEdition=EE
oracle.install.db.OSDBA_GROUP=dba
oracle.install.db.OSOPER_GROUP=oinstall
oracle.install.db.OSBACKUPDBA_GROUP=oinstall
oracle.install.db.OSDGDBA_GROUP=oinstall
oracle.install.db.OSKMDBA_GROUP=oinstall
oracle.install.db.OSRACDBA_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.password.SYS=JLwg!2021
oracle.install.db.config.starterdb.password.SYSTEM=JLwg!2021
DECLINE_SECURITY_UPDATES=true
11
安装时无提示,等安装好后会出现Successfully Setup Software