暂无图片
暂无图片
1
暂无图片
暂无图片
暂无图片

Oracle 19c 之 RPM 包安装初体验(一)

JiekeXu之路 2020-06-18
2105

作者 | JiekeXu

来源 | JiekeXu之路(ID: JiekeXu_IT)

转载请联系授权 | (微信ID:xxq1426321293)

大家好,我是 JiekeXu,很高兴又和大家见面了,今天分享下 Oracle 19c 之 RPM 包安装初体验。本文首发于微信公众号【JiekeXu之路】,欢迎点击上方蓝字关注我吧!

Oracle 自18c 开始,便已经提供Linux 环境单机的 rpm 安装方式,不过仅支持单实例安装,不支持集群,也只有企业版,其他版本的没有发布,不过有2.5 G 大小。



昨天在墨天轮数说里,看到恩墨盖总发的 Oracle 数据库的产品支持生命周期又有更新了。大概是说Oracle 19c 的支持期继续延展了,这样相当于有七年的支持时间,可以获得技术支持和补丁支持,是目前最值得安装的版本。12c、18c、20c 这些都是过渡版本,生命周期比较短暂。Oracle 20c 原计划今年 6 月发布但也尚未浮出水面,估计因为疫情的影响,Oracle 20c 今年极有可能不做正式发布了,随着 OOW 大会的临近,Oracle 21c 的信息即将会展示出来,敬请期待吧。



原文 Release Schedule of Current Database Releases (Doc ID 742060.1) 于 2020.6.16 日更新了,有账号的伙伴可以去查看。



安装检查过程


下面根据官方文档一起看看安装过程和检查步骤

https://docs.oracle.com/en/database/oracle/oracle-database/19/ladbi/index.html

 

首先操作系统版本要求 Oracle Linux7.4、RedHat 7.5 或者 SUSE Linux Enterprise Server12 SP3以上版本,我这里的版本是 RedHat 7.4 勉强可以凑合安装,Linux 6 已经不在支持范围内了。



检查磁盘空间,Linux 企业版需要至少 7.2 G 的空间



更多环境检查步骤请查看上文官方文档链接即可,下面来看看软件下载。


软件下载


在 Oracle 官网上便可以轻松下载如下软件包,你只需要注册一个账号即可,如果你没有账号,不知道怎么下载,没关系,我这里下载好了,公众号[ID:JiekeXu_IT]后台回复【19cRPM包下载】即可获得。

https://www.oracle.com/database/technologies/oracle19c-linux-downloads.html


 

如果你的系统是Oracle Linux 平台,直接

    yum -y installoracle-database-preinstall-19c

    如果不是OracleLinux 平台,首先要下载对应平台的RPM,我这里用的是RedHat7.4,下载链接地址 https://oss.oracle.com/ol7/SRPMS-updates/  搜索 -19c 即可找到,下载最新的即可。也可使用如下地址 https://yum.oracle.com/repo/OracleLinux/OL7/latest/x86_64/index.html



    使用最新的即可,当然你也可以选择下载这里的 Oracle Linux 操作系统,注册Oracle 账号即可从如下网址下载软件。

    https://edelivery.oracle.com/osdc/faces/SoftwareDelivery


    检查基础环境配置



    然后将软件包一起上传至服务器 soft 目录。


      [root@localhost soft]# ll
      total 524244
      -rw-r--r-- 1 root root 271761408 Jun 1722:18 oracle-database-ee-19c-1.0-1.x86_64.rpm
      -rw-r--r-- 1 root root 19552 Jun 17 22:10oracle-database-preinstall-19c-1.0-2.el7.x86_64.rpm
      [root@localhost soft]#
      [root@localhost soft]# rpm -ivhoracle-database-preinstall-19c-1.0-2.el7.x86_64.rpm
      warning:oracle-database-preinstall-19c-1.0-2.el7.x86_64.rpm: Header V3 RSA/SHA256Signature, key ID ec551f03: NOKEY
      error: Failed dependencies:
      bc is needed by oracle-database-preinstall-19c-1.0-2.el7.x86_64
      bind-utils is needed by oracle-database-preinstall-19c-1.0-2.el7.x86_64
      compat-libcap1 is needed byoracle-database-preinstall-19c-1.0-2.el7.x86_64
      libaio-devel is needed by oracle-database-preinstall-19c-1.0-2.el7.x86_64
      libstdc++-devel is needed byoracle-database-preinstall-19c-1.0-2.el7.x86_64
      nfs-utils is needed by oracle-database-preinstall-19c-1.0-2.el7.x86_64
      psmisc is needed by oracle-database-preinstall-19c-1.0-2.el7.x86_64
      smartmontools is needed byoracle-database-preinstall-19c-1.0-2.el7.x86_64
      unzip is needed by oracle-database-preinstall-19c-1.0-2.el7.x86_64
      xorg-x11-utils is needed by oracle-database-preinstall-19c-1.0-2.el7.x86_64
      xorg-x11-xauth is needed byoracle-database-preinstall-19c-1.0-2.el7.x86_64
      [root@localhost soft]#


       

      如上使用 rpm 安装时需要很多依赖包,所以这里改用 yum 安装方式,首先配置 yum 源,我这里使用本地 yum 源的方式,将光盘传至本地 media 目录下,新建配置 etc/yum.repos.d/test.repo 文件如下,具体配置步骤就不用说了,前面有一篇文章专门介绍了可以点此查看[Linux 挂载光盘镜像配置本地 yum 源安装软件],大家可随意选择合适自己的安装方式即可。



      第一步:preinstall 包安装


        [root@localhost soft]# yum installoracle-database-preinstall-19c-1.0-2.el7.x86_64.rpm -y
        Loaded plugins: product-id,search-disabled-repos, subscription-manager
        This system is not registered with anentitlement server. You can use subscription-manager to register.
        Examiningoracle-database-preinstall-19c-1.0-2.el7.x86_64.rpm:oracle-database-preinstall-19c-1.0-2.el7.x86_64
        Marking oracle-database-preinstall-19c-1.0-2.el7.x86_64.rpmto be installed
        Resolving Dependencies
        ………………(省略安装信息)…………
        Installed:
        oracle-database-preinstall-19c.x86_64 0:1.0-2.el7


        Dependency Installed:
        bc.x86_64 0:1.06.95-13.el7 bind-libs.x86_64 32:9.9.4-50.el7 bind-utils.x86_64 32:9.9.4-50.el7 compat-libcap1.x86_64 0:1.10-7.el7
        gssproxy.x86_64 0:0.7.0-4.el7 keyutils.x86_64 0:1.5.8-3.el7 libXinerama.x86_64 0:1.1.3-2.1.el7 libXmu.x86_64 0:1.1.2-2.el7
        libXrandr.x86_64 0:1.5.1-2.el7 libXt.x86_64 0:1.1.5-3.el7 libXv.x86_64 0:1.0.11-1.el7 libXxf86dga.x86_64 0:1.1.4-2.1.el7
        libXxf86misc.x86_64 0:1.0.3-7.1.el7 libaio-devel.x86_64 0:0.3.109-13.el7 libbasicobjects.x86_64 0:0.1.1-27.el7 libcollection.x86_64 0:0.6.2-27.el7
        libdmx.x86_64 0:1.1.3-3.el7 libevent.x86_64 0:2.0.21-4.el7 libini_config.x86_64 0:1.3.0-27.el7 libnfsidmap.x86_64 0:0.25-17.el7
        libpath_utils.x86_64 0:0.2.1-27.el7 libref_array.x86_64 0:0.1.5-27.el7 libstdc++-devel.x86_64 0:4.8.5-16.el7 libtirpc.x86_64 0:0.2.4-0.10.el7
        libverto-libevent.x86_64 0:0.2.5-4.el7 mailx.x86_64 0:12.5-16.el7 nfs-utils.x86_64 1:1.3.0-0.48.el7 psmisc.x86_64 0:22.20-15.el7
        quota.x86_64 1:4.01-14.el7 quota-nls.noarch 1:4.01-14.el7 rpcbind.x86_64 0:0.2.0-42.el7 smartmontools.x86_64 1:6.2-8.el7
        tcp_wrappers.x86_64 0:7.6-77.el7 unzip.x86_64 0:6.0-16.el7 xorg-x11-utils.x86_640:7.5-22.el7 xorg-x11-xauth.x86_641:1.0.9-1.el7


        Complete!



        安装 19c 数据库软件


        然后直接使用 yum 命令安装 19c 数据库软件

         

        第二步:database 软件安装

          [root@localhost soft]# yum installoracle-database-ee-19c-1.0-1.x86_64.rpm
          Loaded plugins: product-id, search-disabled-repos,subscription-manager
          This system is not registered with anentitlement server. You can use subscription-manager to register.
          Examiningoracle-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.rpmto be installed
          Resolving Dependencies
          --> Running transaction check
          ---> Packageoracle-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


          Totalsize: 6.9 G
          Installedsize: 6.9 G
          Is this ok [y/d/N]: y
          Downloading packages:
          Running transaction check
          Running transaction test
          Transaction test succeeded
          Running transaction
          Installing : oracle-database-ee-19c-1.0-1.x86_64 1/1
          [INFO] Executing post installationscripts...
          [INFO] Oracle home installed successfully andready to be configured.
          To configure a sample Oracle Database youcan 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!


           

          [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

          如上信息,执行完脚本 Oracle home 配置安装完成,发现 oracle 用户也创建成功了, 然后便使用 etc/init.d/oracledb_ORCLCDB-19c 文件可以配置一个模板数据库。那么我们看一下这个文件内容都有啥?



          首先看到提示 RedHat or SuSE 需要配置 etc/sysconfig/oracledb_ORCLCDB-19c,继续看一下这个文件内容呢?

           

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


            # LISTENER_PORT: Database listener
            LISTENER_PORT=1521


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


            # EM_EXPRESS_PORT: Oracle EM Expresslistener
            EM_EXPRESS_PORT=5500

             

            可以看到这个文件就是配置监听端口、EM 端口号以及数据文件位置,默认为 /opt/oracle/oradata可按照自己机器实际情况修改,我这里将其修改为 /u01/app/oracle/oradata,然后建立目录赋权,如果上图中的实例名、数据库名均不需要改动的话,直接按照提示使用root 运行以下命令

            /etc/init.d/oracledb_ORCLCDB-19c configure

            配置实例即可,约 10 分钟左右即可完成。

             

              [root@localhost soft]# mkdir -p u01/app/oracle/oradata
              [root@localhost soft]# chown -Roracle:oinstall u01/app/oracle/oradata
              [root@localhost soft]# chmod -R 775 u01/app/oracle/oradata

               

               

              我这里在折腾一下修改数据库名和实例名试试,简单的将其 CDB 名修改为 JiekeCDB, PDB 名字修改为 JiekePDB,其他不做改变,如下所示:

               

                [root@localhost soft]# cp etc/init.d/oracledb_ORCLCDB-19cdb_ORCLCDB-19c_bak
                [root@localhost init.d]# ll oracle*
                -rwx------ 1 root root 1281 Mar 12 02:22oracle-database-preinstall-19c-firstboot
                -rwxr-xr-x 1 root root 10017 Apr 18 2019 oracledb_ORCLCDB-19c
                -rwxr-xr-x 1 root root 10017 Jun 18 00:43oracledb_ORCLCDB-19c_bak
                [root@localhostinit.d]# mv etc/init.d/oracledb_ORCLCDB-19c etc/init.d/oracledb_JiekeCDB-19c
                [root@localhostinit.d]# vi /etc/init.d/oracledb_JiekeCDB-19c



                配置数据库

                 

                注意:这里修改了 SID 导致找不到 /etc/sysconfig/下的配置文件,那么需要修改或配置对应的文件名 oracledb_JiekeCDB-19c.conf。然后配置数据库,查看这个脚本文件 oracledb_JiekeCDB-19c 中间部分,其实就是静默创建实例,需要耐心等待10 分钟左右。

                 


                  [root@localhost init.d]#/etc/init.d/oracledb_JiekeCDB-19c configure
                  The Oracle Database is not configured.Unable to read the configuration file'/etc/sysconfig/oracledb_JiekeCDB-19c.conf'
                  [root@localhost init.d]#
                  [root@localhost init.d]# cp /etc/sysconfig/oracledb_ORCLCDB-19c.conf /etc/sysconfig/oracledb_JiekeCDB-19c.conf

                  [root@localhost init.d]#/etc/init.d/oracledb_JiekeCDB-19c configure
                  Configuring Oracle Database JiekeCDB.
                  Prepare for db operation
                  8% complete
                  Copying database files
                  31% complete
                  Creating and starting Oracle instance
                  32% complete
                  36% complete
                  40% complete
                  43% complete
                  46% complete
                  Completing Database Creation
                  51% complete
                  54% complete
                  Creating Pluggable Databases
                  58% complete
                  77% complete
                  Executing Post Configuration Actions
                  100% complete
                  Database creation complete. For detailscheck the logfiles at:
                  /opt/oracle/cfgtoollogs/dbca/JiekeCDB.
                  Database Information:
                  Global Database Name:JiekeCDB
                  System Identifier(SID):JiekeCDB
                  Look at the log file"/opt/oracle/cfgtoollogs/dbca/JiekeCDB/JiekeCDB.log" for furtherdetails.

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



                  使用 oracle 用户登陆数据库,需要简单配置环境变量!

                   

                    export ORACLE_BASE=/u01/app/oracle/oradata
                    exportORACLE_HOME=/opt/oracle/product/19c/dbhome_1
                    export ORACLE_SID=JiekeCDB
                    exportPATH=$ORACLE_HOME/bin:$PATH:$HOME/.local/bin:$HOME/bin

                     

                    连接和简单应用


                      [oracle@localhost ~]$ source .bashrc
                      [oracle@localhost ~]$ echo $ORACLE_SID
                      JiekeCDB
                      [oracle@localhost ~]$ echo $ORACLE_HOME
                      /opt/oracle/product/19c/dbhome_1
                      [oracle@localhost ~]$ echo $ORACLE_BASE
                      /u01/app/oracle/oradata
                      [oracle@localhost ~]$ sqlplus / as sysdba

                      SQL*Plus: Release 19.0.0.0.0 - Productionon Thu Jun 18 14:58:53 2020
                      Version 19.3.0.0.0

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


                      Connected to:
                      Oracle Database 19c Enterprise EditionRelease 19.0.0.0.0 - Production
                      Version 19.3.0.0.0

                      SQL>
                      SQL> select inst_id,INSTANCE_NAME,statusfrom gv$instance;

                      INST_ID INSTANCE_NAME STATUS
                      ---------- ---------------- ------------
                      1 JiekeCDB OPEN
                      SQL> show pdbs

                      CON_ID CON_NAME OPEN MODE RESTRICTED
                      ---------- ---------------------------------------- ----------
                      2 PDB$SEED READ ONLY NO
                      3 JIEKEPDB READ WRITE NO
                      SQL> show con_id

                      CON_ID
                      ------------------------------
                      1
                      SQL>
                      SQL> alter session setcontainer=JIEKEPDB; --切换到PDB

                      Session altered.

                      SQL> show pdbs

                      CON_ID CON_NAME OPEN MODE RESTRICTED
                      ---------- ---------------------------------------- ----------
                      3 JIEKEPDB READ WRITE NO
                      SQL> sho con_id

                      CON_ID
                      ------------------------------
                      3


                        

                      配置 glogin 文件以及 TNS 修改 sys/system密码直接连接到 PDB。

                       

                        SYS@JiekeCDB>
                        SYS@JiekeCDB> alter user sys identifiedby oracle;

                        User altered.

                        SYS@JiekeCDB> alter user systemidentified by oracle;

                        User altered.

                        SYS@JiekeCDB> quit
                        [oracle@localhost JIEKECDB]$ sqlplussys/oracle@JIEKEPDB as sysdba

                        SQL*Plus: Release 19.0.0.0.0 - Productionon Thu Jun 18 21:25:49 2020
                        Version 19.3.0.0.0

                        Copyright (c) 1982, 2019, Oracle. All rights reserved.
                         
                        Connected to:
                        Oracle Database 19c Enterprise EditionRelease 19.0.0.0.0 - Production
                        Version 19.3.0.0.0
                        SYS@JIEKEPDB> show pdbs

                        CON_ID CON_NAME OPEN MODE RESTRICTED
                        ---------- ---------------------------------------- ----------
                        3 JIEKEPDB READ WRITE NO
                        SYS@JIEKEPDB> select name from v$datafile;

                        NAME
                        ------------------------------------------------------------------------------------------------------------------------
                        /u01/app/oracle/oradata/JIEKECDB/JiekePDB/system01.dbf
                        /u01/app/oracle/oradata/JIEKECDB/JiekePDB/sysaux01.dbf
                        /u01/app/oracle/oradata/JIEKECDB/JiekePDB/undotbs01.dbf
                        /u01/app/oracle/oradata/JIEKECDB/JiekePDB/users01.dbf

                        SYS@JIEKEPDB>

                         

                        其他应用及配置可参考以前一篇 12c 相关的文章[Oracle 12CR2 安装配置与基础学习],这里就不多说了,怎么样?RPM 包安装还是很方便吧,不用图形化、配置监听等,简单多了,和19c 倡导自治数据库不谋而和,基本上实现了一键安装.


                        参考链接

                        https://www.eygle.com/archives/2018/10/oracle_18c_orclcdb_install.html

                        https://docs.oracle.com/en/database/oracle/oracle-database/19/ladbi/operating-system-checklist-for-oracle-database-installation-on-linux.html#GUID-E5C0A90E-7750-45D9-A8BC-C7319ED934F0


                        好了,先告一段落吧,写作不易,此文如果对你有帮助,请支持点“在看”与转发,您的支持便是我不断写作的最大的动力,让我们一起努力做更好的自己!




                        三万字打造 91 道 MySQL 面试题【建议收藏】

                        Oracle 软件包及补丁包免费下载及简单说明

                        Oracle ASM 磁盘组基础知识整理(收藏版)

                        Oracle 12C 最新补丁下载与安装操作指北

                        关于 Oracle ACFS 相关知识的简单学习

                        Oracle 12CR2 安装配置与基础学习

                        Windows 环境下安装 Oracle 19C


                        点亮在看,你最好看!

                        最后修改时间:2020-06-19 17:36:55
                        文章转载自JiekeXu之路,如果涉嫌侵权,请发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。

                        评论