暂无图片
暂无图片
2
暂无图片
暂无图片
暂无图片

Oracle---安装部署二(通过Oracle Database Preinstallation RPM安装Oracle 19.3.0.0)

原创 周波 云和恩墨 2022-09-22
1431

1.安装操作系统依赖包

方式一:手动安装:

yum install -y bc binutils compat-libcap1 compat-libstdc++-33 elfutils-libelf elfutils-libelf-devel fontconfig-devel glibc glibc-devel ksh libaio libaio-devel libX11 libXau libXi libXtst libXrender libXrender-devel libgcc libstdc++ libstdc++-devel libxcb make smartmontools sysstat
复制

方式二:自动配置:
Oracle数据库预安装RPM安装过程如下:
(1)自动下载和安装Oracle Grid Infrastructure和Oracle Database所需的任何附加RPM包,并解决任何依赖关系
(2)创建一个oracle用户,并为该用户创建oraInventory (oinstall)和OSDBA (dba)组
(3)请根据需要,根据Oracle数据库预安装RPM程序的建议,将“sysctl.conf”配置、系统启动参数和驱动参数设置为相应的值
(4)设置硬资源和软资源限制
(5)设置其他推荐参数
(6)在Linux x86_64机器的内核中设置numa=off.

curl -o oracle-database-preinstall-19c-1.0-1.el7.x86_64.rpm https://yum.oracle.com/repo/OracleLinux/OL7/latest/x86_64/getPackage/oracle-database-preinstall-19c-1.0-1.el7.x86_64.rpm
yum -y localinstall oracle-database-preinstall-19c-1.0-1.el7.x86_64.rpm
复制

  安装这个包之后,会下载下载相关依赖包、创建用户和组、为oracle用户创建相关的软硬资源限制以及关闭透明大页:

# 自动创建的用户和组信息
id oracle
uid=54321(oracle) gid=54321(oinstall) groups=54321(oinstall),54322(dba),54323(oper),54324(backupdba),54325(dgdba),54326(kmdba),54330(racdba)
# 自动配置的内核参数信息
[root@oracle1 ~]# 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
# 需要根据自己的内存大小设置这个值,可以设置为比内存的一办大:2.5G(2684354560)
kernel.shmmax = 2684354560

# 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

# 自动为oracle用户配置的资源软硬限制的信息:
[root@oracle1 ~]# 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,下面单位为KB
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
复制

2.检查内核版本和参数配置

#查看操作系统版本
cat /etc/redhat-release
# 或者
yum install -y redhat-lsb-core
lsb_release -id
cat /etc/os-release
# 查看内核版本
uname -r
复制

内核参数配置(手动的方式):

vim /etc/sysctl.conf
net.ipv4.ip_local_port_range = 9000 65500
net.ipv4.tcp_rmem = 4096 87380 4194304
net.ipv4.tcp_wmem = 4096 16384 4194304
fs.aio-max-nr = 1048576
fs.file-max = 6815744
kernel.shmall = 2097152
kernel.shmmax = 2684354560
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
复制

为oracle用户配置软硬资源限制(手动方式):

vim /etc/security/limits.conf
oracle soft nofile 1024
oracle hard nofile 65536
oracle soft nproc 2047
oracle hard nproc 16384
oracle soft stack 10240
oracle hard stack 32768
复制

3.关闭透明大页(手动方式)

echo never > /sys/kernel/mm/transparent_hugepage/enabled
# 在引导命令行中添加参数transparent_hugepage=never
[root@oracle1 ~]# vim /etc/default/grub
GRUB_TIMEOUT=5
GRUB_DISTRIBUTOR="$(sed 's, release .*$,,g' /etc/system-release)"
GRUB_DEFAULT=saved
GRUB_DISABLE_SUBMENU=true
GRUB_TERMINAL_OUTPUT="console"
GRUB_CMDLINE_LINUX="rd.lvm.lv=centos_oracle1/root rd.lvm.lv=centos_oracle1/swap rhgb quiet numa=off transparent_hugepage=never"
GRUB_DISABLE_RECOVERY="true"

# 重新生成配置文件
grub2-mkconfig -o /boot/grub2/grub.cfg
复制

4.配置用户及组,目录

创建组(手动方式):

groupadd -g 54321 oinstall # 必须
groupadd -g 54322 dba # 必须
groupadd -g 54323 oper
groupadd -g 54324 backupdba
groupadd -g 54325 dgdba
groupadd -g 54326 kmdba
groupadd -g 54330 racdba
groupadd -g 54331 asmdba # 必须
复制

创建用户(手动方式):

useradd -u 54321 -g oinstall -G dba,asmdba,backupdba,dgdba,kmdba,racdba,oper oracle
# 设置oracle用户密码:
echo “oracle123”|passwd --stdin oracle
复制

创建目录并授权:

mkdir -p /u01/app
chown -R oracle:oinstall /u01/app
chmod -R 775 /u01/app
mkdir -p /u01/app/oraInventory
chown -R oracle:oinstall /u01/app/oraInventory
chmod -R 775 /u01/app/oraInventory
mkdir -p  /u01/app/oracle/cfgtoollogs
mkdir -p /u01/app/oracle/product/19.3.0/dbhome_1
chown -R oracle:oinstall  /u01/app/oracle
chmod -R 775  /u01/app/oracle
复制

5.关闭selinux服务:

setenforce 0
vim /etc/selinux/config
SELINUX=disabled
复制

6.配置oracle用户环境变量

su - oracle
vim .bash_profile
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=$ORACLE_BASE/product/19.3.0/dbhome_1
export ORACLE_SID=prod
export PATH=$ORACLE_HOME/bin:$PATH
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:$LD_LIBRARY_PATH

source .bash_profile
复制

7.上传安装包并解压

# 创建存放安装包的路径
mkdir /software
cd /software
chown -R oracle.oinstall /software
su - oracle
unzip /software/LINUX.X64_193000_db_home.zip -d $ORACLE_HOME/
复制

上传文件使用rz命令,安装包也不大,也就是2.8G左右:

8.执行安装

su - oracle 
# 设置DISPLAY变量 
export DISPLAY=10.0.0.1:0.0 
cd $ORACLE_HOME ./runInstaller
复制

进入安装程序引导界面,依次选择(不做截图了):

只安装软件——单实例安装——安装企业版——相关目录和组的识别——开启自动执行脚本——

预检查(完毕之后可以保存响应文件)——开始安装

9.建库

[oracle@oracle1 ~]$ dbca
复制

(1)创建一个数据库

(2)选择高级配置

(3)保持默认,下一步:

(4)取消勾选创建CDB,设置全局数据库名和SID:

(5)保持默认,下一步:

这个过程会创建并启动数据库实例。

点击关闭。

10.查看进程

ps -ef | grep ora 
#登录 
[oracle@oracle1 ~]$ sqlplus / as sysdba 
SQL*Plus: Release 19.0.0.0.0 
- Production on Thu Sep 1 12:53:35 2022 Version 19.3.0.0.0 Copyright (c) 1982, 2019, Oracle. All rights reserved. Connected to: Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 
Production Version 19.3.0.0.0 
SQL> 
# 查看内存 
free -h 
      total used free shared buff/cache available 
Mem:  3.8G  652M 674M 953M   2.5G       2.0G 
Swap: 4.0G  24M  4.0G 
# 统计oracle安装目录总大小 
du -sh /u01/app 
9.4G /u01/app
复制

通过oracle数据库预安装RPM包的方式完成Oracle 19c的部署到此结束。

「喜欢这篇文章,您的关注和赞赏是给作者最好的鼓励」
关注作者
1人已赞赏
【版权声明】本文为墨天轮用户原创内容,转载时必须标注文章的来源(墨天轮),文章链接,文章作者等基本信息,否则作者和墨天轮有权追究责任。如果您发现墨天轮中有涉嫌抄袭或者侵权的内容,欢迎发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。

评论

目录
  • 1.安装操作系统依赖包
  • 2.检查内核版本和参数配置
  • 3.关闭透明大页(手动方式)
  • 4.配置用户及组,目录
  • 5.关闭selinux服务:
  • 6.配置oracle用户环境变量
  • 7.上传安装包并解压
  • 8.执行安装
  • 9.建库
    • (1)创建一个数据库
    • (2)选择高级配置
    • (3)保持默认,下一步:
    • (4)取消勾选创建CDB,设置全局数据库名和SID:
    • (5)保持默认,下一步:
  • 10.查看进程