一、安装步骤简述
本文章以19c版本安装为案例,其它oracle 12/19c版本安装都类似
1、安装操作系统
2、关闭防火墙和selinux安全设置
3、配置yum源
4、安装依赖包(oracle软件安装时必须使用到的)
5、创建用户和组(用于安装oracle数据库软件)
6、配置操作系统参数和内核限制
7、规划Oracle数据库软件和Oracle数据库安装目录
8、Oracle用户环境变量设置
9、上传和检验Oracle软件安装包
10、解压安装包
11、安装数据库软件
12、安装补丁(可选项,安装数据库前将补丁安装,后续不需要运行数据字典升级脚本了)
13、安装数据库
本文中,使用oracle-database-preinstall-19c预安装rmp软件包进行安装前准备工作。预安装rmp软件包会自动完成创建用户和组、配置操作系统参数和内核限制这两个工作。详见后续步骤
二、详细安装步骤
1、关闭防火墙和selinux安全设置
systemctl status firewalld.service
systemctl stop firewalld.service
systemctl disable firewalld.service
systemctl list-unit-files|grep firewalld
2、关闭selinux安全限制
方法一
cat >/etc/sysconfig/selinux <<EOF
SELINUX=disabled
SELINUXTYPE=targeted
EOF
cat /etc/sysconfig/selinux
方法二
sed -i 's/SELINUX=enforcing/SELINUX=disabled/g' /etc/selinux/config
cat /etc/selinux/config
3、配置yum源
#挂载本地ios镜像,注意linux8版本的本地yum配置与以前版本有区别
mkdir /mnt/cdrom
mount /dev/sr0 /mnt/cdrom
df -h | tail -n 1
cd /mnt/cdrom && ls
mkdir /etc/yum.repos.d/backup && mv /etc/yum.repos.d/*.repo /etc/yum.repos.d/backup/
cat >/etc/yum.repos.d/dvd.repo<<EOF
[BaseOS]
name=CentOS8-BaseOS
baseurl=file:///mnt/cdrom/BaseOS
enabled=1
gpgcheck=0
[AppStream]
name=CentOS8-AppStream
baseurl=file:///mnt/cdrom/AppStream
enabled=1
gpgcheck=0
EOF
yum clean all
yum makecache
#测试yum安装是否成功,下面这些包也是经常需要使用的
yum install tree -y
yum install net-tools lrzsz -y
yum install wget -y
yum install lrzsz -y
yum install unzip -y
yum install vim -y
4、安装依赖包(oracle软件安装时必须使用到的)
安装依赖包(oracle软件安装时必须使用到的)
yum install bc gcc gcc-c++ binutils make nfs-utils smartmontools sysstat xorg-x11-utils xorg-x11-xauth fontconfig-devel glibc glibc-devel ksh libaio libaio-devel bind-utils libnsl -y
compat-libstdc++-33和compat-libcap1两个rpm包单独下载安装
rpm -ivh compat-libstdc++-33-3.2.3-72.el7.x86_64.rpm
rpm -ivh compat-libcap1-1.10-7.el7.x86_64.rpm
备注:linux7版本需要单独安装上面这两个rpm包,否则在安装检查依赖包阶段时会提示缺失这个rmp包
最后安装预安装rmp包
rpm -ivh oracle-database-preinstall-19c-1.0-3.el7.x86_64.rpm
或者
yum localinstall oracle-database-preinstall-19c-1.0-3.el7.x86_64.rpm -y
[root@host01 ~]# rpm -ivh oracle-database-preinstall-19c-1.0-3.el7.x86_64.rpmwarning: oracle-database-preinstall-19c-1.0-3.el7.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID ec551f03: NOKEY
Verifying... ################################# [100%]
Preparing... ################################# [100%]
Updating / installing...
1:oracle-database-preinstall-19c-1.################################# [100%]
尽量按顺序安装,如果直接安装oracle-database-preinstall-19c包会提示如下:
rpm -ivh oracle-database-preinstall-19c-1.0-3.el7.x86_64.rpm
warning: oracle-database-preinstall-19c-1.0-3.el7.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID ec551f03: NOKEY
error: Failed dependencies:
bc is needed by oracle-database-preinstall-19c-1.0-3.el7.x86_64
bind-utils is needed by oracle-database-preinstall-19c-1.0-3.el7.x86_64
binutils is needed by oracle-database-preinstall-19c-1.0-3.el7.x86_64
compat-libcap1 is needed by oracle-database-preinstall-19c-1.0-3.el7.x86_64
glibc-devel is needed by oracle-database-preinstall-19c-1.0-3.el7.x86_64
ksh is needed by oracle-database-preinstall-19c-1.0-3.el7.x86_64
libaio-devel is needed by oracle-database-preinstall-19c-1.0-3.el7.x86_64
libstdc++-devel is needed by oracle-database-preinstall-19c-1.0-3.el7.x86_64
make is needed by oracle-database-preinstall-19c-1.0-3.el7.x86_64
is needed by oracle-database-preinstall-19c-1.0-3.el7.x86_64
smartmontools is needed by oracle-database-preinstall-19c-1.0-3.el7.x86_64
sysstat is needed by oracle-database-preinstall-19c-1.0-3.el7.x86_64
xorg-x11-utils is needed by oracle-database-preinstall-19c-1.0-3.el7.x86_64
xorg-x11-xauth is needed by oracle-database-preinstall-19c-1.0-3.el7.x86_64
5、可选项(知识整理),oracle-database-preinstall-19c 预安装rmp包,可以完成的工作
oracle-database-preinstall-19c 预安装rmp包,可以完成如下工作:
1、创建用户和组(用于安装oracle数据库软件)
2、配置操作系统参数和内核限制
3、为oracle用户创建相关的软硬资源限制
4、关闭透明大页
5、在Linux x86_64机器的内核中设置numa=off.
检查:
su - root
id oracle
cat /etc/sysctl.conf
cat /etc/security/limits.d/oracle-database-preinstall-19c.conf
cat /etc/default/grub
[root@host01 ~]# id oracle
uid=54321(oracle) gid=54321(oinstall) groups=54321(oinstall),54322(dba),54323(oper),54324(backupdba),54325(dgdba),54326(kmdba),54330(racdba)
cat /etc/sysctl.conf
# sysctl settings are defined through files in
# /usr/lib/sysctl.d/, /run/sysctl.d/, and /etc/sysctl.d/.
#
# Vendors settings live in /usr/lib/sysctl.d/.
# To override a whole file, create a new file with the same in
# /etc/sysctl.d/ and put new settings there. To override
# only specific settings, add a file with a lexically later
# name in /etc/sysctl.d/ and put new settings there.
#
# For more information, see sysctl.conf(5) and sysctl.d(5).
# oracle-database-preinstall-19c setting for fs.file-max is 6815744
fs.file-max = 6815744
# oracle-database-preinstall-19c setting for kernel.sem is '250 32000 100 128'
kernel.sem = 250 32000 100 128
# oracle-database-preinstall-19c setting for kernel.shmmni is 4096
kernel.shmmni = 4096
# oracle-database-preinstall-19c setting for kernel.shmall is 1073741824 on x86_64
kernel.shmall = 1073741824
# oracle-database-preinstall-19c setting for kernel.shmmax is 4398046511104 on x86_64
kernel.shmmax = 4398046511104
# oracle-database-preinstall-19c setting for kernel.panic_on_oops is 1 per Orabug 19212317
kernel.panic_on_oops = 1
# oracle-database-preinstall-19c setting for net.core.rmem_default is 262144
net.core.rmem_default = 262144
# oracle-database-preinstall-19c setting for net.core.rmem_max is 4194304
net.core.rmem_max = 4194304
# oracle-database-preinstall-19c setting for net.core.wmem_default is 262144
net.core.wmem_default = 262144
# oracle-database-preinstall-19c setting for net.core.wmem_max is 1048576
net.core.wmem_max = 1048576
# oracle-database-preinstall-19c setting for net.ipv4.conf.all.rp_filter is 2
net.ipv4.conf.all.rp_filter = 2
# oracle-database-preinstall-19c setting for net.ipv4.conf.default.rp_filter is 2
net.ipv4.conf.default.rp_filter = 2
# oracle-database-preinstall-19c setting for fs.aio-max-nr is 1048576
fs.aio-max-nr = 1048576
# oracle-database-preinstall-19c setting for net.ipv4.ip_local_port_range is 9000 65500
net.ipv4.ip_local_port_range = 9000 65500
cat /etc/security/limits.d/oracle-database-preinstall-19c.conf
# oracle-database-preinstall-19c setting for nofile soft limit is 1024
oracle soft nofile 1024
# oracle-database-preinstall-19c setting for nofile hard limit is 65536
oracle hard nofile 65536
# oracle-database-preinstall-19c setting for nproc soft limit is 16384
# refer orabug15971421 for more info.
oracle soft nproc 16384
# oracle-database-preinstall-19c setting for nproc hard limit is 16384
oracle hard nproc 16384
# oracle-database-preinstall-19c setting for stack soft limit is 10240KB
oracle soft stack 10240
# oracle-database-preinstall-19c setting for stack hard limit is 32768KB
oracle hard stack 32768
# oracle-database-preinstall-19c setting for memlock hard limit is maximum of 128GB on x86_64 or 3GB on x86 OR 90 % of RAM
oracle hard memlock 134217728
# oracle-database-preinstall-19c setting for memlock soft limit is maximum of 128GB on x86_64 or 3GB on x86 OR 90% of RAM
oracle soft memlock 134217728
# oracle-database-preinstall-19c setting for data soft limit is 'unlimited'
oracle soft data unlimited
# oracle-database-preinstall-19c setting for data hard limit is 'unlimited'
oracle hard data unlimited
[root@host01 ~]# cat /etc/default/grub|grep GRUB_CMDLINE_LINUX
GRUB_CMDLINE_LINUX="crashkernel=auto resume=/dev/mapper/rhel-swap rd.lvm.lv=rhel/root rd.lvm.lv=rhel/swap rhgb quiet numa=off transparent_hugepage=never"
6、主机名和/etc/hosts文件修改
1)备份原有文件
cp /etc/hostname /etc/hostname_$(date +%F)
cp /etc/hosts /etc/hosts_$(date +%F)
2)修改主机名
hostnamectl set-hostname host01
3)修改/etc/hosts文件
[root@host01 cdrom]# cat /etc/hosts
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.11.21 host01
7、规划Oracle数据库软件和Oracle数据库
安装目录
mkdir -p /u01/app/oracle/product/19.3.0/db_1
mkdir -p /u01/soft
mkdir -p /u01/psu
mkdir -p /oradata
chown -R oracle:oinstall /u01
chown -R oracle:oinstall /oradata
chmod -R 775 /u01/
备注:
默认已经完成存储划分和挂载
/u01/app/oracle目录用于安装Oracle数据库软件
/u01/soft用于存放Oracle软件包等其它软件
/u01/psu用于存放psu等补丁包
8、Oracle用户环境变量设置
在oracle用户下的.bash_profile中设置如下环境变量
TMP=/tmp; export TMP
TMPDIR=$TMP; export TMPDIR
export ORACLE_SID=orcl
#export ORACLE_UNQNAME=orcl 如果计划安装EM时,必须先设置ORACLE_UNQNAME环境变量,不计划则可以不设置
#export CV_ASSUME_DISTID=OEL7.9 如果是Oracle Linux 版本需要添加改变量,其它操作系统不需要
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=$ORACLE_BASE/product/19.3.0/db_1
export NLS_DATE_FORMAT="YYYY:MM:DDHH24:MI:SS"
export ORACLE_TERM=xterm
export PATH=$ORACLE_HOME/bin:/usr/sbin:$ORACLE_HOME/OPatch:$PATH
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:$ORACLE_HOME/rdbms/lib:$ORACLE_HOME/network/lib:/lib:/usr/lib
export CLASSPATH=$ORACLE_HOME/JRE:$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib:$ORACLE_HOME/network/jlib
export EDITOR=vim
export LANG=en_US.UTF-8
export NLS_LANG=AMERICAN_AMERICA.ZHS16GBK
stty erase ^H
具体步骤
su - oracle
cp .bash_profile .bash_profile_$(date +%F)
vi .bash_profile
source ~/.bash_profile
后续所有的操作都在oracle用户下完成
su - oracle
9、上传和检验Oracle软件安装包,安装包上传至/u01/soft目录下
cd /u01/soft
md5sum LINUX.X64_193000_db_home.zip
验证结果如下为正确,表示未被植入病毒木马,可以放心使用
[oracle@host01 soft]$ md5sum LINUX.X64_193000_db_home.zip
1858bd0d281c60f4ddabd87b1c214a4f LINUX.X64_193000_db_home.zip
10、解压安装包
19c后要求解压至oracle home目录才能安装
19c后要求解压至oraclehome目录才能安装
unzip -q LINUX.X64_193000_db_home.zip -d $ORACLE_HOME
备注,解压至其它目录也可以安装,但是直接将那个解压目录作为ORACLE_HOME目录了,会导致一系列问题
11、安装数据库软件
安装数据库软件
export DISPLAY=192.168.11.1:0.0
备注:
需要根据实际环境修改IP地址,将图形界面投射出来(可以使用xclock命令测试,检查时钟界面图形能不能投射出来)
常用的图形投射工具:xmanager的"Xmanager - Passive"工具,或者使用vnc工具。
具体执行安装
cd $ORACLE_HOME
./runInstaller
12、安装补丁(可选项,安装数据库前将补丁安装,后续不需要运行数据字典升级脚本了)
13、Oracle数据库
dbca
备注:详细的图形界面安装步骤详见后面部分
三、图形界面详细安装步骤
(1)安装Oracle数据库软件的图形界面步骤:
具体图形界面安装详细步骤,可以参考我的文章《Oracle 19c 单机安装总结_linux7》,里面有详细的截图和说明。
(2)安装Oracle数据库
图形界面安装oracle数据库
su - oracle
dbca
具体图形界面安装详细步骤,可以参考我的文章《Oracle 19c 单机安装总结_linux7》,里面有详细的截图和说明。
四、安装总结
问题总结:
一、
compat-libstdc++-33和compat-libcap1两个rpm包单独下载安装
备注:linux7版本需要单独安装上面这两个rpm包,网上下载即可,否则在安装检查依赖包阶段时会提示缺失这个rmp包
compat-libstdc++-33和compat-libcap1两个rpm包单独下载安装
[root@host01 ~]# rpm -ivh compat-libstdc++-33-3.2.3-72.el7.x86_64.rpm
warning: compat-libstdc++-33-3.2.3-72.el7.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID ec551f03: NOKEY
Verifying... ################################# [100%]
Preparing... ################################# [100%]
Updating / installing...
1:compat-libstdc++-33-3.2.3-72.el7 ################################# [100%]
[root@host01 ~]# rpm -ivh compat-libcap1-1.10-7.el7.x86_64.rpm
warning: compat-libcap1-1.10-7.el7.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID f4a80eb5: NOKEY
Verifying... ################################# [100%]
Preparing... ################################# [100%]
Updating / installing...
1:compat-libcap1-1.10-7.el7 ################################# [100%]
[root@host01 ~]#
二、在 RedHat Enterprise Linux 8 版本安装 Oracle 数据库软件时,提示缺少 libnsl.so.1
[oracle@host01 db_1]$ ./runInstaller
/u01/app/oracle/product/19.3.0/db_1/perl/bin/perl: error while loading shared libraries: libnsl.so.1: cannot open shared object file: No such file or directory
解决办法:
安装libnsl包解决
yum install libnsl
三、 INS-08101警告
[WARNING] [INS-08101] Unexpected error while executing the action at state: 'supportedOSCheck'
解决办法:
设置环境变量 CV_ASSUME_DISTID,可以绕过操作系统版本检查。
示例:
# 针对 grid 用户
export CV_ASSUME_DISTID=OL7
/gridSetup.sh
# 针对 oracle 用户
export CV_ASSUME_DISTID=OL7
/runInstaller