oracle 12c 安装部署
一、系统优化
1、操作系统
cat /etc/redhat-release
Red Hat Enterprise Linux Server release 7.9 (Maipo)
2、设置hostname
hostnamectl set-hostname 12c
cat >>/etc/hosts<<-"EOF"
172.16.71.13 12c
EOF
3、关闭防火墙
# 关闭防火墙
systemctl stop firewalld.service
systemctl disable firewalld.service
systemctl status firewalld.service
4、关闭selinux
sed -i 's/SELINUX=enforcing/SELINUX=disabled/' /etc/selinux/config
setenforce 0
二、oracle 相关优化与依赖安装
- 安装vnc
yum install -y vnc*
- 安装oracle依赖
yum install binutils -y
yum install compat-libcap1 -y
yum install compat-libstdc++-33 -y
yum install compat-libstdc++-33.i686 -y
yum install glibc -y
yum install glibc.i686 -y
yum install glibc-devel -y
yum install glibc-devel.i686 -y
yum install ksh -y
yum install libaio -y
yum install libaio.i686 -y
yum install libaio-devel -y
yum install libaio-devel.i686 -y
yum install libX11 -y
yum install libX11.i686 -y
yum install libXau -y
yum install libXau.i686 -y
yum install libXi -y
yum install libXi.i686 -y
yum install libXtst -y
yum install libXtst.i686 -y
yum install libgcc -y
yum install libgcc.i686 -y
yum install libstdc++ -y
yum install libstdc++.i686 -y
yum install libstdc++-devel -y
yum install libstdc++-devel.i686 -y
yum install libxcb -y
yum install libxcb.i686 -y
yum install make -y
yum install nfs-utils -y
yum install net-tools -y
yum install smartmontools -y
yum install sysstat -y
yum install unixODBC -y
yum install unixODBC-devel -y
yum localinstall compat-libstdc++-33-3.2.3-72.el7.x86_64.rpm
- 验证依赖
rpm -q 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
- 创建oinstall和dba组
groupadd -g 54321 oinstall
groupadd -g 54322 dba
groupadd -g 54323 oper
- 创建oracle用户
useradd -u 54321 -g oinstall -G dba,oper oracle
passwd oracle
输入密码
- 查看创建结果
id oracle
uid=54321(oracle) gid=54321(oinstall) groups=54321(oinstall),54322(dba),54323(oper)
- 配置ulimit参数
cat>/etc/security/limits.d/oracle-database-server-12cR2-preinstall.conf<<-"EOF"
oracle soft nofile 1024
oracle hard nofile 65536
oracle soft nproc 16384
oracle hard nproc 16384
oracle soft stack 10240
oracle hard stack 32768
oracle hard memlock 134217728
oracle soft memlock 134217728
EOF
- 配置内核参数
cat >/etc/sysctl.d/98-oracle.conf<<-"EOF"
fs.file-max = 6815744
kernel.sem = 250 32000 100 128
kernel.shmmni = 4096
kernel.shmall = 1073741824
kernel.shmmax = 4398046511104
kernel.panic_on_oops = 1
net.core.rmem_default = 262144
net.core.rmem_max = 4194304
net.core.wmem_default = 262144
net.core.wmem_max = 1048576
net.ipv4.conf.all.rp_filter = 2
net.ipv4.conf.default.rp_filter = 2
fs.aio-max-nr = 1048576
net.ipv4.ip_local_port_range = 9000 65500
EOF
/sbin/sysctl -p /etc/sysctl.d/98-oracle.conf
三、 安装oracle
- 创建oracle相关目录
mkdir -p /data/app/oracle/product/12.2.0.1/db_1
chown -R oracle:oinstall /data
chmod -R 775 /data
- 创建oracle环境变量
mkdir /home/oracle/scripts
cat > /home/oracle/scripts/setEnv.sh <<-"EOF"
export TMP=/tmp
export TMPDIR=$TMP
export ORACLE_HOSTNAME=12c
export ORACLE_UNQNAME=cdb1
export ORACLE_BASE=/data/app/oracle
export ORACLE_HOME=$ORACLE_BASE/product/12.2.0.1/db_1
export ORACLE_SID=smsSid
export PATH=/usr/sbin:/usr/local/bin:$PATH
export PATH=$ORACLE_HOME/bin:$PATH
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib
export CLASSPATH=$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib
export LANG=zh_CN.UTF-8
export NLS_LANG="AMERICAN_AMERICA".ZHS16GBK
export PATH LANG NLS_LANG ORACLE_BASE ORACLE_HOME ORACLE_SID
EOF
echo ". /home/oracle/scripts/setEnv.sh" >> /home/oracle/.bash_profile
# 执行命令使环境变量生效
source /home/oracle/.bash_profile
- 上传12c介质到/home/oracle/
- 解压介质
unzip database.zip -d /home/oracle/
chown -R oracle:oinstall /home/oracle/
- 图形界面登录服务切换到oracle 账号
su - oracle
cd /home/oracle/database/
./runInstaller
如果报Sid存在,可以查看/etc/oratab 文件内容
输入密码Test_1234
忽略swap交换空间
root 管理权限下执行
sh /data/app/oracle/product/12.2.0.1/db_1/root.sh
部署完成oracle用户下执行
lsnrctl status
到此oracle部署完成
四、oracle开机自启动设置
root下执行
vim /etc/oratab
smsSid:/data/app/oracle/product/12.2.0.1/db_1:N
改为
smsSid:/data/app/oracle/product/12.2.0.1/db_1:Y
cat >/etc/rc.d/init.d/oracle<<-"EOF"
#!/bin/bash
# chkconfig: 345 99 10
# description: Startup Script for Oracle Databases
# /etc/rc.d/init.d/oracle
source /home/oracle/scripts/setEnv.sh
ORA_OWNR="oracle"
# if the executables do not exist -- display error
if [ ! -f $ORACLE_HOME/bin/dbstart -o ! -d $ORACLE_HOME ]
then
echo "Oracle startup: cannot start"
exit 1
fi
# depending on parameter -- startup, shutdown, restart
# of the instance and listener or usage display
case "$1" in
start)
# Oracle listener and instance startup
echo -n "Starting Oracle: "
su - $ORA_OWNR -c "$ORACLE_HOME/bin/dbstart"
su - $ORA_OWNR -c "$ORACLE_HOME/bin/lsnrctl start"
touch /var/lock/Oracle
#su - $ORA_OWNR -c "$ORACLE_HOME/bin/isqlplusctrl start"
echo "OK"
;;
stop)
# Oracle listener and instance shutdown
echo -n "Shutdown Oracle: "
su - $ORA_OWNR -c "$ORACLE_HOME/bin/dbshut"
su - $ORA_OWNR -c "$ORACLE_HOME/bin/lsnrctl stop"
rm -f /var/lock/Oracle
echo "OK"
;;
reload|restart)
$0 stop
$0 start
;;
*)
echo "Usage: `basename $0` start|stop|restart|reload"
exit 1
esac
exit 0
EOF
chmod 755 /etc/rc.d/init.d/oracle
chkconfig oracle on
chkconfig --add oracle
标签:12c,部署,c++,i686,yum,install,oracle,devel
From: https://www.cnblogs.com/dbstack/p/17968030