当前位置: 首页 > Oracle, Oracle 12c, Oracle 19c > 正文

在Linux 6.5通过rpm方式安装Oracle 19c

Oracle 19C已经正式发布了,在Oracle的官网就可用下载,初始版本是19.3.0.0.0,19C相当于12.2.0.3版本,是12C的最终版本,2020年发布的20C就不再属于12C的范畴啦。

说来也巧,10gR2从10.2.0.1一直到10.2.0.5一共有5个版本,11gR2从11.2.0.1一直到11.2.0.4一共有4个版本,12cR2只有12.2.0.1、18C、19C这3个版本,貌似从10g开始,每个大版本的版本数都比上一个版本少1个,是不是20cR2只有两个版本了?

19C要求至少在7.4及以上版本的Liunx系统上安装(18C要求至少在6.5以上版本的Liunx系统上安装),6版本的Linux安装19C会遇到几处莫名其妙的问题,虽然处理之后也能成功安装19C,但不建议在生产环境使用。

从18C开始,Oracle就推出了RPM包的方式安装Oracle数据库,并提供下载独立RPM安装包,可用去官网下载。这种RPM方式安装数据库目前只支持单实例数据库安装,RAC还需要使用传统的安装方式安装。这种RPM包的安装方式,不依赖图形界面,同时也极大的简化了安装过程,就是个性化支持的差了一点。

本文主要记载在OEL 6.5版本的linux操作系统上通过RPM的方式安装Oracle 19C数据库。

使用OEL操作系统安装Oracle数据库,很多人都会依赖OEL自带的oracle-database-preinstall或者oracle-rdbms-preinstall这个rpm包,安装这个rpm包,会自动创建操作系统用户oracle,自动配置内核参数以及limit资源限制,还会安装一些安装Oracle所需的rpm包,基本上算是把操作系统层的前期准备工作一步到位了。

不同版本的OEL,自带的这个preinstall包支持的数据库版本也不同,比如本文使用的OEL6.5,自带的是11gR2的包,OEL6.10带的是12cR2的包,OEL7.5带的也是12cR2的包,OEL7.6带的是18cR2的包。所以要使用preinstall包的话,需要去下载支持19cR2的preinstall包,下载地址https://yum.oracle.com/repo/OracleLinux/OL7/latest/x86_64/getPackage/oracle-database-preinstall-19c-1.0-1.el7.x86_64.rpm

[root@ora19c u01]# yum install oracle-database-preinstall-19c-1.0-1.el7.x86_64.rpm 
Loaded plugins: refresh-packagekit, security
Setting up Install Process
Examining oracle-database-preinstall-19c-1.0-1.el7.x86_64.rpm: oracle-database-preinstall-19c-1.0-1.el7.x86_64
Marking oracle-database-preinstall-19c-1.0-1.el7.x86_64.rpm to be installed
Resolving Dependencies
--> Running transaction check
---> Package oracle-database-preinstall-19c.x86_64 0:1.0-1.el7 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

=================================================================================================================
 Package                           Arch    Version      Repository                                         Size
=================================================================================================================
Installing:
 oracle-database-preinstall-19c   x86_64   1.0-1.el7    /oracle-database-preinstall-19c-1.0-1.el7.x86_64    55 k

Transaction Summary
=================================================================================================================
Install       1 Package(s)

Total size: 55 k
Installed size: 55 k
Is this ok [y/N]: y
Downloading Packages:
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing : oracle-database-preinstall-19c-1.0-1.el7.x86_64                                               1/1 
  Verifying  : oracle-database-preinstall-19c-1.0-1.el7.x86_64                                               1/1 

Installed:
  oracle-database-preinstall-19c.x86_64 0:1.0-1.el7                                                              

Complete!

安装完这个包之后,会自动创建oracle用户和相应的组,就不需要再去创建oracle用户和所需的组了,只需要设置oracle用户的密码即可。

[root@ora19c ~]# id oracle
uid=54321(oracle) gid=54321(oinstall) groups=54321(oinstall),54322(dba),54323(oper),54324(backupdba),54325(dgdba),54326(kmdba),54330(racdba)
[root@ora19c ~]# passwd oracle
Changing password for user oracle.
New password: 
Retype new password: 
passwd: all authentication tokens updated successfully.

另外,内核参数和limit也会自动设置,不需要再去配置了。

[root@ora19c ~]# 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

值得一提的是,Linux 7的limit配置已经不在是/etc/security/limits.conf了,而是在/etc/security/limits.d目录下面。

[root@ora19c ~]# 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.conf文件是安装preinstall包自动生成的,如果不通过安装preinstall包的方式,需要在/etc/security/limits.d/目录 下面创建.conf结尾的文件,添加相应的配置信息。

Selinux需要去关闭一下,hosts文件也需要去配置一下。

[root@ora19c ~]# cat /etc/selinux/config 

# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
#     enforcing - SELinux security policy is enforced.
#     permissive - SELinux prints warnings instead of enforcing.
#     disabled - No SELinux policy is loaded.
SELINUX=disabled
# SELINUXTYPE= can take one of three two values:
#     targeted - Targeted processes are protected,
#     minimum - Modification of targeted policy. Only selected processes are protected. 
#     mls - Multi Level Security protection.
SELINUXTYPE=targeted 
[root@ora19c ~]# cat /etc/hosts
127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6

10.9.15.20      ora19c

这样,前期的准备工作基本就完成了,可用安装数据库软件了。使用RPM的方式安装数据库软件,软件是安装在/opt目录下,要确保/opt目录有足够的空间,这个路径貌似是不能更改的。

[root@ora19c u01]# yum install oracle-database-ee-19c-1.0-1.x86_64.rpm 
Loaded plugins: refresh-packagekit, security
Setting up Install Process
Examining oracle-database-ee-19c-1.0-1.x86_64.rpm: oracle-database-ee-19c-1.0-1.x86_64
Marking oracle-database-ee-19c-1.0-1.x86_64.rpm to be installed
Resolving Dependencies
--> Running transaction check
---> Package oracle-database-ee-19c.x86_64 0:1.0-1 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

=================================================================================================================
 Package                     Arch      Version                  Repository                               Size
=================================================================================================================
Installing:
 oracle-database-ee-19c     x86_64    1.0-1                     /oracle-database-ee-19c-1.0-1.x86_64     6.9 G

Transaction Summary
=================================================================================================================
Install       1 Package(s)

Total size: 6.9 G
Installed size: 6.9 G
Is this ok [y/N]: y
Downloading Packages:
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing : oracle-database-ee-19c-1.0-1.x86_64                                                      1/1 
[INFO] Executing post installation scripts...
[INFO] Oracle home installed successfully and ready to be configured.
To configure a sample Oracle Database you can execute the following service configuration script as root: /etc/init.d/oracledb_ORCLCDB-19c configure
  Verifying  : oracle-database-ee-19c-1.0-1.x86_64                                                      1/1 

Installed:
  oracle-database-ee-19c.x86_64 0:1.0-1                                                                       
Complete!

因为之前安装了oracle-database-preinstall-19c-1.0-1.el7.x86_64.rpm包,会把安装oracle软件需要的其他rpm包都装好,这里也可用使用rpm –ivh命令去安装oracle-database-ee-19c-1.0-1.x86_64.rpm数据库软件,我使用的是yum安装的,效果是一样的。这里的日志输出,提示To configure a sample Oracle Database you can execute the following service configuration script as root: /etc/init.d/oracledb_ORCLCDB-19c configure,也就是可用通过/etc/init.d/oracledb_ORCLCDB-19c configure命令来创建数据库,下文会用到。

在使用RPM的方式安装完数据库软件之后,会在/etc/sysconfig目录下面生成一个oracledb_ORCLCDB-19c.conf文件,里面记录监听和数据文件所在路径和EM的端口等信息,在这种安装模式下,会自动创建监听器,不需要额外创建了,这个文件默认是不需要修改,当然也可用按照需求去进行设置,我这里没有修改。

[root@ora19c sysconfig]# cat oracledb_ORCLCDB-19c.conf 
#This is a configuration file to setup the Oracle Database. 
#It is used when running '/etc/init.d/oracledb_ORCLCDB configure'.
#Please use this file to modify the default listener port and the
#Oracle data location.

# LISTENER_PORT: Database listener
LISTENER_PORT=1521

# ORACLE_DATA_LOCATION: Database oradata location
ORACLE_DATA_LOCATION=/opt/oracle/oradata

# EM_EXPRESS_PORT: Oracle EM Express listener
EM_EXPRESS_PORT=5500

在/etc/init.d目录下也会生成一个同样名字但没有.conf后缀的文件oracledb_ORCLCDB-19c,这个文件是有必要修改的,当然也可以不修改之间使用。

[root@ora19c init.d]# vi oracledb_ORCLCDB-19c 

#!/bin/bash
#
# chkconfig: 2345 80 05
# Description: This script is responsible for taking care of configuring the Oracle Database and its associated services.
#
# processname: oracledb_ORCLCDB-19c
# Red Hat or SuSE config: /etc/sysconfig/oracledb_ORCLCDB-19c
#

# Set path if path not set
case $PATH in
        "") PATH=/bin:/usr/bin:/sbin:/etc
                 export PATH ;;
esac

# Check if the root user is running this script
if [ $(id -u) != "0" ]
then
        echo "You must be root user to run the configurations script. Login as root user and try again."
        exit 1
fi

# Setting the required environment variables
export ORACLE_HOME=/opt/oracle/product/19c/dbhome_1

export ORACLE_VERSION=19c
export ORACLE_SID=DBDREAM
export TEMPLATE_NAME=General_Purpose.dbc
export CHARSET=AL32UTF8
export PDB_NAME=PDB
export LISTENER_NAME=LISTENER
export NUMBER_OF_PDBS=1
export CREATE_AS_CDB=false

文件比较长,正常情况下,我们只需要关注这些环境变量即可。这里我修改了ORACLE_SID和CREATE_AS_CDB这两个变量,CREATE_AS_CDB默认是true,也就是常见CDB,并且会根据NUMBER_OF_PDBS和PDB_NAME变量的设置创建相应的PDB,我这里设置的是false,也就是不使用CDB模式,创建常规的数据库模式。

[root@ora19c sysconfig]# /etc/init.d/oracledb_ORCLCDB-19c.conf configure
Configuring Oracle Database DBDREAM.
[FATAL] [INS-00001] Unknown irrecoverable error
   CAUSE: No additional information available.
   ACTION: Refer to the logs or contact Oracle Support Services
   SUMMARY:
       - [DBT-00006] The logging directory could not be created.
       - [DBT-00006] The logging directory could not be created.

Database configuration failed.

这里遇到了DBT-00006错误,这个错误并不是因为路径不能创建导致的,具体原因是因为glibc版本太低了,19C要求glibc的版本至少是2.14,我所使用的6.5版本的linux,glibc的版本是2.12,使用sqlplus登录数据库会有直观的错误提示。

[root@ora19c Packages]# rpm -qa glibc
glibc-2.12-1.132.el6.x86_64
[root@ora19c Packages]# cat /etc/oracle-release 
Oracle Linux Server release 6.5
[root@ora19c ~]# su - oracle
[oracle@ora19c ~]$ sqlplus / as sysdba
sqlplus: /lib64/libc.so.6: version `GLIBC_2.14' not found (required by /opt/oracle/product/19c/dbhome_1/lib/libclntsh.so.19.1)
sqlplus: /lib64/libc.so.6: version `GLIBC_2.14' not found (required by /opt/oracle/product/19c/dbhome_1/lib/libclntshcore.so.19.1)
sqlplus: /lib64/libc.so.6: version `GLIBC_2.14' not found (required by /opt/oracle/product/19c/dbhome_1/lib/libnnz19.so)

下面是2.14版本的glibc的下载地址。

ftp://ftp.pbone.net/mirror/archive.fedoraproject.org/fedora/linux/updates/15/x86_64/glibc-2.14.1-6.x86_64.rpm
ftp://ftp.pbone.net/mirror/archive.fedoraproject.org/fedora/linux/updates/15/x86_64/glibc-common-2.14.1-6.x86_64.rpm
ftp://ftp.pbone.net/mirror/archive.fedoraproject.org/fedora/linux/updates/15/x86_64/glibc-devel-2.14.1-6.x86_64.rpm
ftp://ftp.pbone.net/mirror/archive.fedoraproject.org/fedora/linux/updates/15/x86_64/glibc-headers-2.14.1-6.x86_64.rpm
[root@ora19c glibc]# rpm -Fhv glibc*
warning: glibc-2.14.1-6.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID 069c8460: NOKEY
Preparing...                ########################################### [100%]
   1:glibc-common           ########################################### [ 25%]
   2:glibc                  ########################################### [ 50%]
   3:glibc-headers          ########################################### [ 75%]
   4:glibc-devel            ########################################### [100%]
[root@ora19c glibc]# rpm -qa glibc
glibc-2.14.1-6.x86_64

升级完glibc之后,上面的DBT-00006错误就可用解决,通过sqlplus已经可用登录。

[root@ora19c ~]# su - oracle
[oracle@ora19c ~]$ sqlplus / as sysdba

SQL*Plus: Release 19.0.0.0.0 - Production on Mon May 13 16:45:01 2019
Version 19.3.0.0.0

Copyright (c) 1982, 2019, Oracle.  All rights reserved.

Connected to an idle instance.

SQL> exit
Disconnected

然后再次建库,又遇到了DBT-50000错误。

[root@ora19c glibc]# /etc/init.d/oracledb_ORCLCDB-19c configure
Configuring Oracle Database DBDREAM.
[FATAL] [DBT-50000] Unable to check for available memory.
[FATAL] [DBT-50001] Unable to check the value of kernel parameter {0}

Database configuration failed.

这个DBT-50000错误提示信息也是不准确的,这也是操作系统版本太低导致的,需要通过-J-Doracle.assistants.dbca.validate.ConfigurationParams=false参数跳过。编辑/etc/init.d/oracledb_ORCLCDB-19c文件,找到下面这行,增加这个参数。

[root@ora19c ~]# vi /etc/init.d/oracledb_ORCLCDB-19c.conf 
 $SU -s /bin/bash  $ORACLE_OWNER -c "$DBCA -silent -createDatabase -gdbName $ORACLE_SID -templateName $TEMPLATE_NAME -characterSet $CHARSET -createAsContainerDatabase $CREATE_AS_CDB -numberOfPDBs $NUMBER_OF_PDBS -pdbName $PDB_NAME -J-Doracle.assistants.dbca.validate.ConfigurationParams=false -createListener $LISTENER_NAME:$LISTENER_PORT -datafileDestination $ORACLE_DATA_LOCATION -sid $ORACLE_SID -autoGeneratePasswords -emConfiguration DBEXPRESS -emExpressPort $EM_EXPRESS_PORT"

修改上面的配置文件后,成功建库。

[root@ora19c ~]# /etc/init.d/oracledb_ORCLCDB-19c configure
Configuring Oracle Database DBDREAM.
Prepare for db operation
10% complete
Copying database files
40% complete
Creating and starting Oracle instance
42% complete
46% complete
50% complete
54% complete
60% complete
Completing Database Creation
66% complete
70% complete
Executing Post Configuration Actions
100% complete
Database creation complete. For details check the logfiles at:
 /opt/oracle/cfgtoollogs/dbca/DBDREAM.
Database Information:
Global Database Name:DBDREAM
System Identifier(SID):DBDREAM
Look at the log file "/opt/oracle/cfgtoollogs/dbca/DBDREAM/DBDREAM.log" for further details.

Database configuration completed successfully. The passwords were auto generated, you must change them by connecting to the database using 'sqlplus / as sysdba' as the oracle user.

通过上面的命令建库,会自动配置监听器信息。

[oracle@ora19c ~]$ cat /opt/oracle/product/19c/dbhome_1/network/admin/listener.ora 
# listener.ora Network Configuration File: /opt/oracle/product/19c/dbhome_1/network/admin/listener.ora
# Generated by Oracle configuration tools.

LISTENER =
  (DESCRIPTION_LIST =
    (DESCRIPTION =
      (ADDRESS = (PROTOCOL = TCP)(HOST = ora19c)(PORT = 1521))
      (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
    )
  )

但是oracle用户的环境变量,还是需要配置的。

[oracle@ora19c ~]$ sqlplus / as sysdba

SQL*Plus: Release 19.0.0.0.0 - Production on Tue May 14 21:34:15 2019
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> select cdb from v$database;

CDB
---
NO
SQL> create user dbdream identified by dbdream;

User created.
SQL> grant connect to dbdream;

Grant succeeded.
SQL> conn dbdream/dbdream
Connected.

这种rpm安装方式,极大的简化了安装过程,还不依赖图形界面,也不需要像静默安装那样修改很多的配置参数,真的很方便。

本文固定链接: https://www.dbdream.com.cn/2019/05/%e5%9c%a8linux-6-5%e9%80%9a%e8%bf%87rpm%e6%96%b9%e5%bc%8f%e5%ae%89%e8%a3%85oracle-19c/ | 信春哥,系统稳,闭眼上线不回滚!

该日志由 dbdream 于2019年05月17日发表在 Oracle, Oracle 12c, Oracle 19c 分类下, 你可以发表评论,并在保留原文地址及作者的情况下引用到你的网站或博客。
原创文章转载请注明: 在Linux 6.5通过rpm方式安装Oracle 19c | 信春哥,系统稳,闭眼上线不回滚!
关键字: , , , , ,

在Linux 6.5通过rpm方式安装Oracle 19c:等您坐沙发呢!

发表评论

快捷键:Ctrl+Enter