作者 | jiekexu
来源 | jiekexu之路(id: jiekexu_it)
转载请联系授权 | (微信id:xxq1426321293)
大家好,我是 jiekexu,很高兴又和大家见面了,今天分享下 oracle 19c 之 rpm 包安装初体验。本文首发于微信公众号【jiekexu之路】,欢迎点击上方蓝字关注我吧!
oracle 自18c 开始,便已经提供linux 环境单机的 rpm 安装方式,不过仅支持单实例安装,不支持集群,也只有企业版,其他版本的没有发布,不过有2.5 g 大小。
昨天在墨天轮数说里,看到恩墨盖总发的 oracle 数据库的产品支持生命周期又有更新了。大概是说oracle 19c 的支持期继续延展了,这样相当于有七年的支持时间,可以获得m6米乐安卓版下载的技术支持和补丁支持,是目前最值得安装的版本。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 m6米乐安卓版下载官网上便可以轻松下载如下软件包,你只需要注册一个账号即可,如果你没有账号,不知道怎么下载,没关系,我这里下载好了,公众号[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 文件如下,具体配置步骤就不用说了,前面有一篇文章专门介绍了可以点此查看[],大家可随意选择合适自己的安装方式即可。
第一步: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
米乐app官网下载 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
米乐app官网下载 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 相关的文章[],这里就不多说了,怎么样?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
好了,先告一段落吧,写作不易,此文如果对你有帮助,请支持点“在看”与转发,您的支持便是我不断写作的最大的动力,让我们一起努力做更好的自己!
点亮在看,你最好看!