Oracle APEX初体验

Oracle APEX是一个低代码开发平台。在主页中的介绍如下:

Oracle APEX 是 Oracle 数据库完全支持的一项免费功能。这意味着,如果您拥有 Oracle 数据库,那么也就拥有了 Oracle APEX!您只需下载 Oracle APEX 并在现有 Oracle 数据库中安装即可!Oracle APEX 的显著优势之一是您可以在本机访问 Oracle 数据库的所有功能。了解由 Oracle 提供支持的含义,并浏览您可以获得的所有功能与优势。

也就是说,APEX是数据库的一项功能,需要额外安装。但数据库不必是企业版,也可以是免费的XE版。本文介绍了通过Oracle在GitHub上的Vagrant安装APEX的过程。

首先从Oracle GitHub上克隆项目:
git clone https://github.com/oracle/vagrant-boxes

然后进入OracleAPEX目录,下载以下软件,并存入此目录:

  1. Oracle Database 18c XE,文件名oracle-database-xe-18c-1.0-1.x86_64.rpm,约2.4G。
  2. Oracle APEX,文件名apex_19.1.zip,约150M。
  3. Oracle Rest Data Services (ORDS),文件名ords-19.2.0.199.1647.zip,约62M。

运行vagrant box:
vagrant up
输出如下,整个过程接近1小时:

D:\vagrant-boxes\OracleAPEX>vagrant up
getting Proxy Configuration from Host...
Bringing machine 'oracle-18c-apex' up with 'virtualbox' provider...
==> oracle-18c-apex: Importing base box 'ol7-latest'...
==> oracle-18c-apex: Matching MAC address for NAT networking...
==> oracle-18c-apex: Setting the name of the VM: oracle-18c-apex
==> oracle-18c-apex: Clearing any previously set network interfaces...
==> oracle-18c-apex: Preparing network interfaces based on configuration...
    oracle-18c-apex: Adapter 1: nat
==> oracle-18c-apex: Forwarding ports...
    oracle-18c-apex: 1521 (guest) => 1521 (host) (adapter 1)
    oracle-18c-apex: 5500 (guest) => 5500 (host) (adapter 1)
    oracle-18c-apex: 8080 (guest) => 8080 (host) (adapter 1)
    oracle-18c-apex: 22 (guest) => 2222 (host) (adapter 1)
==> oracle-18c-apex: Running 'pre-boot' VM customizations...
==> oracle-18c-apex: Booting VM...
==> oracle-18c-apex: Waiting for machine to boot. This may take a few minutes...
    oracle-18c-apex: SSH address: 127.0.0.1:2222
    oracle-18c-apex: SSH username: vagrant
    oracle-18c-apex: SSH auth method: private key
    oracle-18c-apex:
    oracle-18c-apex: Vagrant insecure key detected. Vagrant will automatically replace
    oracle-18c-apex: this with a newly generated keypair for better security.
    oracle-18c-apex:
    oracle-18c-apex: Inserting generated public key within guest...
    oracle-18c-apex: Removing insecure key from the guest if it's present...
    oracle-18c-apex: Key inserted! Disconnecting and reconnecting using new SSH key...
==> oracle-18c-apex: Machine booted and ready!
==> oracle-18c-apex: Checking for guest additions in VM...
==> oracle-18c-apex: Setting hostname...
==> oracle-18c-apex: Configuring proxy environment variables...
==> oracle-18c-apex: Configuring proxy for Yum...
==> oracle-18c-apex: Mounting shared folders...
    oracle-18c-apex: /vagrant => D:/vagrant-boxes/OracleAPEX
==> oracle-18c-apex: Running provisioner: shell...
    oracle-18c-apex: Running: C:/Users/yyxiao/AppData/Local/Temp/vagrant-shell20190925-14196-16gcbar.sh
    oracle-18c-apex: INSTALLER: Started up
    oracle-18c-apex: Resolving Dependencies
    oracle-18c-apex: --> Running transaction check
    oracle-18c-apex: ---> Package GeoIP.x86_64 0:1.5.0-13.el7 will be updated
    oracle-18c-apex: ---> Package GeoIP.x86_64 0:1.5.0-14.el7 will be an update
    oracle-18c-apex: --> Processing Dependency: geoipupdate for package: GeoIP-1.5.0-14.el7.x86_64
    oracle-18c-apex: ---> Package audit-libs.x86_64 0:2.8.4-4.el7 will be updated
    oracle-18c-apex: ---> Package audit-libs.x86_64 0:2.8.5-4.el7 will be an update
    ...
    ==> oracle-18c-apex: Running provisioner: shell...
    oracle-18c-apex: Running: C:/Users/yyxiao/AppData/Local/Temp/vagrant-shell20190926-15504-1aocj8c.sh
    oracle-18c-apex: INSTALLER: Timezone updated
    oracle-18c-apex: INSTALLER: Environment variables set
    oracle-18c-apex: INSTALLER: Oracle Database Installation Started up
    oracle-18c-apex: Examining /vagrant/oracle-database-xe-18c-1.0-1.x86_64.rpm: oracle-database-xe-18c-1.0-1.x86_64
    oracle-18c-apex: Marking /vagrant/oracle-database-xe-18c-1.0-1.x86_64.rpm to be installed
    oracle-18c-apex: Resolving Dependencies
    oracle-18c-apex: --> Running transaction check
    oracle-18c-apex: ---> Package oracle-database-xe-18c.x86_64 0:1.0-1 will be installed
    oracle-18c-apex: --> Finished Dependency Resolution
    oracle-18c-apex:
    oracle-18c-apex: Dependencies Resolved
    oracle-18c-apex:
    oracle-18c-apex: ================================================================================
    oracle-18c-apex:  Package                Arch   Version
    oracle-18c-apex:                                      Repository                            Size
    oracle-18c-apex: ================================================================================
    oracle-18c-apex: Installing:
    oracle-18c-apex:  oracle-database-xe-18c x86_64 1.0-1 /oracle-database-xe-18c-1.0-1.x86_64 5.2 G
    oracle-18c-apex:
    oracle-18c-apex: Transaction Summary
    oracle-18c-apex: ================================================================================
    oracle-18c-apex: Install  1 Package
    oracle-18c-apex: Total size: 5.2 G
    oracle-18c-apex: Installed size: 5.2 G
    oracle-18c-apex: Downloading packages:
    oracle-18c-apex: Running transaction check
    oracle-18c-apex: Running transaction test
    oracle-18c-apex: Transaction test succeeded
    oracle-18c-apex: Running transaction
    oracle-18c-apex:   Installing : oracle-database-xe-18c-1.0-1.x86_64                          1/1
    oracle-18c-apex:
    oracle-18c-apex: [INFO] Executing post installation scripts...
    oracle-18c-apex: [INFO] Oracle home installed successfully and ready to be configured.
    oracle-18c-apex: To configure Oracle Database XE, optionally modify the parameters in '/etc/sysconfig/oracle-xe-18c.conf' and then execute '/etc/init.d/oracle-xe-18c configure' as root.
    oracle-18c-apex:   Verifying  : oracle-database-xe-18c-1.0-1.x86_64                          1/1
    oracle-18c-apex:
    oracle-18c-apex:
    oracle-18c-apex: Installed:
    oracle-18c-apex:   oracle-database-xe-18c.x86_64 0:1.0-1
    oracle-18c-apex: Complete!
    oracle-18c-apex: INSTALLER: Oracle software installed
    oracle-18c-apex: Configuring Oracle Listener.
    oracle-18c-apex: Listener configuration succeeded.
    oracle-18c-apex: Configuring Oracle Database XE.
    oracle-18c-apex: Enter SYS user password:
    oracle-18c-apex: *************
    oracle-18c-apex:
    oracle-18c-apex: *
    oracle-18c-apex: Enter SYSTEM user password:
    oracle-18c-apex: *****
    oracle-18c-apex: ***
    oracle-18c-apex: *****
    oracle-18c-apex:
    oracle-18c-apex: **
    oracle-18c-apex: Enter PDBADMIN User Password:
    oracle-18c-apex: ****
    oracle-18c-apex: **
    oracle-18c-apex: *******
    oracle-18c-apex:
    oracle-18c-apex: *
    oracle-18c-apex: Prepare for db operation
    oracle-18c-apex: 7% complete
    oracle-18c-apex: Copying database files
    oracle-18c-apex: 29% complete
    oracle-18c-apex: Creating and starting Oracle instance
    oracle-18c-apex: 30% complete
    oracle-18c-apex: 31% complete
    oracle-18c-apex: 34% complete
    oracle-18c-apex: 38% complete
    oracle-18c-apex: 41% complete
    oracle-18c-apex: 43% complete
    oracle-18c-apex: Completing Database Creation
    oracle-18c-apex: 47% complete
    ...
        oracle-18c-apex: INSTALLER: Oracle Rest Data Services extracted to ORACLE_BASE
    oracle-18c-apex: Sep 26, 2019 9:36:20 AM
    oracle-18c-apex: INFO: Set config.dir to /opt/oracle/ords/config in: /opt/oracle/ords/ords.war
    oracle-18c-apex:
    oracle-18c-apex: SQL*Plus: Release 18.0.0.0.0 - Production on Thu Sep 26 09:36:27 2019
    oracle-18c-apex: Version 18.4.0.0.0
    oracle-18c-apex:
    oracle-18c-apex: Copyright (c) 1982, 2018, Oracle.  All rights reserved.
    oracle-18c-apex:
    oracle-18c-apex: Connected to:
    oracle-18c-apex: Oracle Database 18c Express Edition Release 18.0.0.0.0 - Production
    oracle-18c-apex: Version 18.4.0.0.0
    oracle-18c-apex:
    oracle-18c-apex: SQL>
    oracle-18c-apex:
    oracle-18c-apex: Session altered.
    oracle-18c-apex:
    oracle-18c-apex: SQL>
    oracle-18c-apex:
    oracle-18c-apex: User altered.
    oracle-18c-apex:
    oracle-18c-apex: SQL>
    oracle-18c-apex:
    oracle-18c-apex: User altered.
    oracle-18c-apex: SQL>
    oracle-18c-apex: Disconnected from Oracle Database 18c Express Edition Release 18.0.0.0.0 - Production
    oracle-18c-apex: Version 18.4.0.0.0
    oracle-18c-apex: INSTALLER: Oracle Rest Data Services configuration created
    oracle-18c-apex: Sep 26, 2019 9:36:38 AM
    oracle-18c-apex: INFO: reloaded pools: []
    oracle-18c-apex: Sep 26, 2019 9:36:38 AM oracle.dbtools.installer.InstallerBase log
    oracle-18c-apex: INFO: Installing Oracle REST Data Services version 19.2.0.r1991647
    oracle-18c-apex: Sep 26, 2019 9:36:38 AM oracle.dbtools.installer.Runner log
    oracle-18c-apex: INFO: ... Log file written to /home/oracle/ords_install_core_2019-09-26_093638_00879.log
    oracle-18c-apex: Sep 26, 2019 9:36:44 AM oracle.dbtools.installer.Runner log
    oracle-18c-apex: INFO: ... Verified database prerequisites
    oracle-18c-apex: Sep 26, 2019 9:36:45 AM oracle.dbtools.installer.Runner log
    oracle-18c-apex: INFO: ... Created Oracle REST Data Services proxy user
    oracle-18c-apex: Sep 26, 2019 9:36:46 AM oracle.dbtools.installer.Runner log
    oracle-18c-apex: INFO: ... Created Oracle REST Data Services schema
    oracle-18c-apex: Sep 26, 2019 9:36:49 AM oracle.dbtools.installer.Runner log
    oracle-18c-apex: INFO: ... Granted privileges to Oracle REST Data Services
    oracle-18c-apex: Sep 26, 2019 9:36:54 AM oracle.dbtools.installer.Runner log
    oracle-18c-apex: INFO: ... Created Oracle REST Data Services database objects
    oracle-18c-apex: Sep 26, 2019 9:37:15 AM oracle.dbtools.installer.Runner log
    oracle-18c-apex: INFO: ... Log file written to /home/oracle/ords_install_datamodel_2019-09-26_093715_00609.log
    oracle-18c-apex: Sep 26, 2019 9:37:17 AM oracle.dbtools.installer.Runner log
    oracle-18c-apex: INFO: ... Log file written to /home/oracle/ords_install_apex_2019-09-26_093717_00981.log
    oracle-18c-apex: Sep 26, 2019 9:37:20 AM oracle.dbtools.installer.InstallerBase log
    oracle-18c-apex: INFO: Completed installation for Oracle REST Data Services version 19.2.0.r1991647. Elapsed time: 00:00:41.213
    oracle-18c-apex: INSTALLER: Oracle Rest Data Services installation completed
    oracle-18c-apex: Last login: Thu Sep 26 09:36:27 +08 2019
    oracle-18c-apex: INSTALLER: Oracle Rest Data Services started
    oracle-18c-apex:
    oracle-18c-apex: INSTALLER: APEX/ORDS Installation Completed
    oracle-18c-apex: INSTALLER: You can access APEX by your Host Operating System at following URL:
    oracle-18c-apex: INSTALLER: http://localhost:8080/ords/
    oracle-18c-apex: INSTALLER: Access granted with:
    oracle-18c-apex: INSTALLER: Workspace: internal
    oracle-18c-apex: INSTALLER: Username:  admin
    oracle-18c-apex: INSTALLER: Password:  h6FJOI8sL4E=1


Days              : 0
Hours             : 0
Minutes           : 58
Seconds           : 59
Milliseconds      : 738
Ticks             : 35397382104
TotalDays         : 0.04096919225
TotalHours        : 0.983260614
TotalMinutes      : 58.99563684
TotalSeconds      : 3539.7382104
TotalMilliseconds : 3539738.2104

这里一定要注意,在最后部分有密码,密码,密码!!!(我改成了Y2xrBZK/[W;d9`n")
上例是安装在外挂U盘,如果安装在本地盘,会快很多,例如:

...
    oracle-18c-apex: INSTALLER: APEX/ORDS Installation Completed
    oracle-18c-apex: INSTALLER: You can access APEX by your Host Operating System at following URL:
    oracle-18c-apex: INSTALLER: http://localhost:8080/ords/
    oracle-18c-apex: INSTALLER: Access granted with:
    oracle-18c-apex: INSTALLER: Workspace: internal
    oracle-18c-apex: INSTALLER: Username:  admin
    oracle-18c-apex: INSTALLER: Password:  ET0YUcE64uE=1


Days              : 0
Hours             : 0
Minutes           : 37
Seconds           : 31
Milliseconds      : 730
Ticks             : 22517306893
TotalDays         : 0.0260616977928241
TotalHours        : 0.625480747027778
TotalMinutes      : 37.5288448216667
TotalSeconds      : 2251.7306893
TotalMilliseconds : 2251730.6893

虽然还不太懂原理,但整个过程是走下来了。
详细的安装步骤可参见Oracle Application Express Release 19.1文档。

Oracle Application Express is installed and enabled in Oracle Autonomous Database
services such as Oracle Autonomous Transaction Processing and Oracle Autonomous
Data Warehouse.
Oracle Application Express is available in Exadata Cloud Service and Database Cloud
Service in Oracle Cloud Infrastructure. However, you need to manually customize your
databases to install and enable Oracle Application Express by following on-premises
installation process or using cloud tooling such as Terraform.

APEX的运行依赖于Web listener,可以选择Oracle REST Data Services(ORDS),
Oracle HTTP Server或 Embedded PL/SQL gateway。本例选择了ORDS,这也是Oracle推荐的,另两个都认为是过时了。

APEX的架构描述:

Oracle Application Express uses a simple architecture where pages are dynamically
generated using metadata stored within the Oracle Database. There is no code generation
or file based compilation. Once fully installed, a Uniform Resource Locator (URL)
is defined for both developers and end users to access Oracle Application Express.
Users require only a Web browser and the required URL. No additional client software
is required.

Oracle APEX初体验_第1张图片
上图中的Web Listener就是我们安装的ORDS,其实就是jetty,也可以部署在WebLogic和Tomcat上:

$ ps -ef|grep -i ords
oracle   28354     1  1 08:54 ?        00:00:27 /opt/oracle/product/18c/dbhomeXE/jdk/bin/java -jar /opt/oracle/ords/ords.war

再回顾一下,本例安装的APEX版本为19.1,支持的数据库版本为11.2.0.4或以上。APEX的开发环境需要XML DB,但运行环境不需要,但XML DB默认都安装了。

然后就可以使用APEX了:
Oracle APEX初体验_第2张图片

你可能感兴趣的:(APEX)