- Oracle 23c 免费开发者版本可以使用 RPM 在 Oracle Linux 8 上安装。本文介绍了Oracle数据库23c免费64位在Oracle Linux 8 (OL8)64位上的RPM安装方法。本文基于服务器安装,至少有2G的交换空间,安全Linux设置为permissive。这种类型的Linux安装的例子可以在这里看到。
- 主机文件(host file)
- Oracle安装
- 创建数据库
- 使用
- 思考
- Vagrant实例(虚拟化管理软件)
主机文件
"/etc/hosts"必须包含一个完全格式的服务器名称
<IP-address> <fully-qualified-machine-name> <machine-name>
例子
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
192.168.56.107 ol8-23.localdomain ol8-23
设置正确的主机名,编辑/etc/hostname
ol8-23.localdomain
Oracle安装
下载RPM安装包
https://www.oracle.com/database/technologies/free-downloads.html
- oracle-database-free-23c-1.0-1.el8.x86_64.rpm
下载完安装包后,我们使用root用户安装oracle的相关依赖
dnf install -y oraclelinux-developer-release-el8
dnf install -y oracle-database-preinstall-23c
我们现在可以安装23c软件,假定23c的软件位于/tmp目录下
dnf -y localinstall /tmp/oracle-database-free-23c-1.0-1.el8.x86_64.rpm
软件的ORACLE_HOME路径为
"/opt/oracle/product/23c/dbhomeFree".
创建数据库
除了软件安装之外,rpm还提供了一个脚本创建一个叫“FREE”的演示数据库,并有一个名为”FREEPDB1”的可插拔数据库。在下面的例子中,我们设置了DB_PASSWORD环境变量,这样我们就可以使用脚本静默创建
# export DB_PASSWORD=SysPassword1
# (echo "${DB_PASSWORD}"; echo "${DB_PASSWORD}";) | /etc/init.d/oracle-free-23c configure
Specify a password to be used for database accounts. Oracle recommends that the password entered should be at least 8 characters in length, contain at least 1 uppercase character, 1 lower case character and 1 digit [0-9]. Note that the same password will be used for SYS, SYSTEM and PDBADMIN accounts:
Confirm the password:
Configuring Oracle Listener.
Listener configuration succeeded.
Configuring Oracle Database FREE.
Enter SYS user password:
*************
Enter SYSTEM user password:
**************
Enter PDBADMIN User Password:
************
Prepare for db operation
7% complete
Copying database files
29% complete
Creating and starting Oracle instance
30% complete
33% complete
36% complete
39% complete
43% complete
Completing Database Creation
47% complete
49% complete
50% complete
Creating Pluggable Databases
54% complete
71% complete
Executing Post Configuration Actions
93% complete
Running Custom Scripts
100% complete
Database creation complete. For details check the logfiles at:
/opt/oracle/cfgtoollogs/dbca/FREE.
Database Information:
Global Database Name:FREE
System Identifier(SID):FREE
Look at the log file "/opt/oracle/cfgtoollogs/dbca/FREE/FREE.log" for further details.
Connect to Oracle Database using one of the connect strings:
Pluggable database: localhost.localdomain/FREEPDB1
Multitenant container database: localhost.localdomain
[root@localhost yum.repos.d]#
我们当然也可以使用DBCA正常的创建数据库,不需要使用这个脚本We can
使用
在用户下,我们可以如下使用
export ORACLE_HOME=/opt/oracle/product/23c/dbhomeFree
export PATH=$ORACLE_HOME/bin:$PATH
-- Root container
sqlplus sys/SysPassword1@//localhost:1521/free as sysdba
-- Pluggable database
sqlplus sys/SysPassword1@//localhost:1521/freepdb1 as sysdba
我们可以用以下命令,在root用户下启停服务
/etc/init.d/oracle-free-23c stop
/etc/init.d/oracle-free-23c start
思考
下面是关于这种安装方法的一些思考
- 这个机制不是为了oracle的纯软件安装设计的。它不能一个命令就让oracle运行。所以感觉没比静默安装简单多少。不过初学者可能不同意我的观点。
- RPM安装形式仅可用于安装软件,不能用于更新,属于一次性解决方案
- 我们不能控制它的安装设置。如果你的安装有企业标准,这个解决方案不适合你。记住软件的ORACLE_HOME路径为"/opt/oracle/product/23c/dbhomeFree"
- 即使你有ULN订阅(oracle版的RHEL订阅),你也不可能为了每次安装去拉这个下载。你需要创建一个本地yum源进行使用
- 这是个有趣的练习,不过我不会考虑在演示之外进行这种安装。Vagrant Example
如果你想看看它的运行情况,你可能想尝试一下这些Vagrant构建。vagrant/database/ol8_23_free at master · oraclebase/vagrant · GitHub
译者的小碎念:这个安装机制在18c的时候就有,另用rpm -e来删除并不好使,还是老实去调deinstall