语言
<< 返回文章列表

Oracle 18.3 新特性:使用 RPM 安装包在 Linux 上快速部署数据库

2018年10月21日
盖国强
3617

自 Oracle 18c 开始,Oracle开始支持 Linux 上的 Oracle 数据库 RPM 安装方式,虽然刚刚发布还有一些限制,但是这无疑开始改变,目前的限制包括:

  • 仅支持单实例安装,不支持集群;

  • 仅支持企业版,专业版要到 19c 支持;

  • 支持 Server 端和 Instant Client 的 RPM 安装;

 

虽然这个安装 RPM 包容量高达 3.3 GB,我还是体验了一下,把这个简化的过程和大家分享一下。

RPM 安装包可以在 OTN 下载:

Oracle Database 18c (18.3) for Linux x86-64 (RPM) 

Download oracle-database-ee-18c-1.0-1.x86_64.rpm (3,586,257,564)

 

使用RMP方式,安装Oracle数据库,使得一切都变得简单。整个安装过程仅仅需要两个 rpm 包,分别是:

oracle-database-preinstall-18c-1.0-1.el7.x86_64.rpm

oracle-database-ee-18c-1.0-1.x86_64.rpm


安装又分为两个分支:全自动 和 半自动

如果你使用的是 OEL (Oracle Linux)并且注册了 ULN 帐号( Unbreakable Linux Network ),那么使用 root 用户安装就是一个命令:

yum -y install oracle-database-ee-18c

 

我们接下来看看手工方式,同样需要以 root 身份登录。

第一步骤,安装 preinstall 包:

OEL 可以使用 yum 一步安装:

# yum -y install oracle-database-preinstall-18c

其他版本平台手工达人,可以下载安装:

# curl -o oracle-database-preinstall-18c-1.0-1.el7.x86_64.rpm https://yum.oracle.com/repo/OracleLinux/OL7/latest/x86_64/getPackage/oracle-database-preinstall-18c-1.0-1.el7.x86_64.rpm

# yum -y localinstall oracle-database-preinstall-18c-1.0-1.el7.x86_64.rpm


第二个步骤,进入下载目录,安装数据库软件,:

# yum -y localinstall oracle-database-ee-18c-1.0-1.x86_64.rpm

 

然后等上几分钟,就结束了。数据库软件就安装完毕。最后会提示你,通过配置来创建一个数据库,仍然是一个命令:

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


这个命令以静默方式创建一个多租户数据库。如果一切顺利,That's All。如果以前有一些同学、初学者,被安装数据库搞得晕头转向,那么现在,一切都过去了,你和数据库之间的距离只有一条命令之遥。




还是看看我的测试过程,当然操作系统是前提,我找了一个虚拟机,因为之前安装过数据库,所以一些基本的 Package 应当是健全的,如果你的 Linux 有问题,还是需要看看安装手册的基础需求。

 

我的系统信息如下:

[root@sdb0 opt]# cat /etc/redhat-release 

CentOS release 6.8 (Final)

[root@sdb0 opt]# uname -a

Linux sdb0 2.6.32-642.6.2.el6.x86_64 #1 SMP Wed Oct 26 06:52:09 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux


如果缺少 preinstall 包会提示依赖错误:

[root@sdb0 u01]# rpm -ivh oracle-database-ee-18c-1.0-1.x86_64.rpm 

error: Failed dependencies:

oracle-database-preinstall-18c is needed by oracle-database-ee-18c-1.0-1.x86_64

[root@sdb0 u01]# curl -o oracle-database-preinstall-18c-1.0-1.el7.x86_64.rpm https://yum.oracle.com/repo/OracleLinux/OL7/latest/x86_64/getPackage/oracle-database-preinstall-18c-1.0-1.el7.x86_64.rpm

 

[root@sdb0 u01]# yum -y localinstall oracle-database-preinstall-18c-1.0-1.el7.x86_64.rpm

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

Complete!


安装的缺省目录在 /opt ,要确保有超过 7.8 G 的空间,否则安装会失败:

[root@sdb0 u01]# yum -y localinstall oracle-database-ee-18c-1.0-1.x86_64.rpm


Total size: 7.8 G

Installed size: 7.8 G

Downloading Packages:

Running rpm_check_debug

Running Transaction Test

 

Transaction Check Error:

  installing package oracle-database-ee-18c-1.0-1.x86_64 needs 6804MB on the / filesystem

 

Error Summary

-------------

Disk Requirements:

  At least 6804MB more space needed on the / filesystem.


安装目录 /opt ,要确保将权限授予 oracle 用户(所以,用户和用户组应该是预先自己建立的):

[root@sdb0 opt]# chown oracle:oinstall /opt

 

然后执行安装,一条命令下去,根据存储性能大约10分钟以内完成软件解压部署:

[root@sdb0 opt]# yum -y localinstall oracle-database-ee-18c-1.0-1.x86_64.rpm

Loaded plugins: fastestmirror, refresh-packagekit, security

Setting up Local Package Process

Examining oracle-database-ee-18c-1.0-1.x86_64.rpm: oracle-database-ee-18c-1.0-1.x86_64

。。。

Install       1 Package(s)


Total size: 7.8 G

Installed size: 7.8 G

Downloading Packages:

Running rpm_check_debug

Running Transaction Test

Transaction Test Succeeded

Running Transaction

Warning: RPMDB altered outside of yum.

  Installing : oracle-database-ee-18c-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-18c configure

  Verifying  : oracle-database-ee-18c-1.0-1.x86_64                          1/1 


Installed:

  oracle-database-ee-18c.x86_64 0:1.0-1                                         


Complete!


注意,以上只是完成了软件的安装部署,接下来如果要创建数据库,还需要用 root 身份执行一个脚本进行配置:

To configure a sample Oracle Database you can execute the following service configuration script as root: /etc/init.d/oracledb_ORCLCDB-18c configure

 

注意,当我们执行 

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

命令时,后台实际上就自动进行了一个静默的数据库创建,我把这段命令拿出来了,但是你可以不用关注:

/bin/su -s /bin/bash oracle -c /opt/oracle/product/18c/dbhome_1/bin/dbca -silent -createDatabase -gdbName ORCLCDB -templateName General_Purpose.dbc -characterSet AL32UTF8 -createAsContainerDatabase true -numberOfPDBs 1 -pdbName ORCLPDB1 -createListener LISTENER:1521 -datafileDestination /opt/oracle/oradata -sid ORCLCDB -autoGeneratePasswords -emConfiguration DBEXPRESS -emExpressPort 5500

 

数据库创建的执行过程如下:

[root@sdb0 opt]# /etc/init.d/oracledb_ORCLCDB-18c configure
Configuring Oracle Database ORCLCDB.
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 details check the logfiles at:
/opt/oracle/cfgtoollogs/dbca/ORCLCDB.
Database Information:
Global Database Name:ORCLCDB
System Identifier(SID):ORCLCDB
Look at the log file "/opt/oracle/cfgtoollogs/dbca/ORCLCDB/ORCLCDB.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 用户,适当的配置环境变量,登入数据库,看,我们第一个RPM方式部署的多租户,18.3 版本的数据库已经就绪。

[oracle@sdb0 ~]$ sqlplus / as sysdba


SQL*Plus: Release 18.0.0.0.0 - Production on Sat Oct 20 23:29:57 2018

Version 18.3.0.0.0


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



Connected to:

Oracle Database 18c Enterprise Edition Release 18.0.0.0.0 - Production

Version 18.3.0.0.0


SQL> select name from v$datafile;


NAME

--------------------------------------------------------------------------------

/opt/oracle/oradata/ORCLCDB/system01.dbf

/opt/oracle/oradata/ORCLCDB/sysaux01.dbf

/opt/oracle/oradata/ORCLCDB/undotbs01.dbf

/opt/oracle/oradata/ORCLCDB/pdbseed/system01.dbf

/opt/oracle/oradata/ORCLCDB/pdbseed/sysaux01.dbf

/opt/oracle/oradata/ORCLCDB/users01.dbf

/opt/oracle/oradata/ORCLCDB/pdbseed/undotbs01.dbf

/opt/oracle/oradata/ORCLCDB/ORCLPDB1/system01.dbf

/opt/oracle/oradata/ORCLCDB/ORCLPDB1/sysaux01.dbf

/opt/oracle/oradata/ORCLCDB/ORCLPDB1/undotbs01.dbf

/opt/oracle/oradata/ORCLCDB/ORCLPDB1/users01.dbf


11 rows selected.

在我的环境中,全程非常流畅,我不得不说,虽然RPM很巨大,但这真的是一个有益的改变。


参考链接

https://www.oracle.com/technetwork/database/enterprise-edition/downloads/index.html

https://www.oracle.com/technetwork/database/enterprise-edition/databaseappdev-vm-161299.html