安装Oracle APEX(Application Express)5.1

安装Oracle APEX(Application Express)5.1

Oracle APEX 的最新版本是5.1,这个版本引入了一些新特性,比如Oracle JET Chart,包含了很多新的数据可视化的图表组件,可以让开发者很方便地开发交互性很强的图表应用,但是目前随着Oracle Database一起提供的APEX 是12.2 DB带的5.0.4版本,所以,要想体验新功能,只能安装APEX standalone 5.1。

clip_image001

APEX简单说就是安装在Oracle数据库中一系列PL/SQL程序包及其他支持对象+PL/SQL gateway,PL/SQL Gateway和web服务器集成在一起,将用户的web请求转换成对PL/SQL包的调用,被调用的PL/SQL程序包(也就是APEX的程序),负责响应请求,并用PL/SQL语法生成web内容,返回给客户,最早它也叫PSP(PL/SQL Server Page),和JSP(Java Server Page)对照着看,大家就明白它的本质了。

安装APEX的过程主要分两部分,第一部分是安装APEX程序,包括一列PL/SQL程序包和其他支持对象,第二部分是选择并配置web server。

数据库安装

本次以Oracle Linux 7.1 上安装的Oracle 12.2.0.1.0为例,安装过程省略。

安装APEX程序

以12.2为例,一般是把APEX安装在CDB,这样所有PDB使用的APEX都是同一版本,典型的例子就是Oracle Cloud Service里面的数据库,APEX也可以安装在PDB,可以让同一CBD下的不同PDB用不通的版本的APEX。(我们会把APEX安装在CDB,将APEX安装在PDB的方法,以后在其他文章介绍)

APEX 5.1 下载地址:http://www.oracle.com/technetwork/developer-tools/apex/downloads/index.html

将现在的zip解压缩,进入解压后的目录,比如/home/oracle/apex

使用sys用户登录数据库:

执行SQL脚本:

@apexins.sql <tablespace_apex> <tablespace_files> <tablespace_temp> <images>

1) tablespace_apex 是指安装apex程序的表空间

2) tablespace_file是指apex 文件存放的表空间(图片,ccs等web内容)

3) tablespace_temp是指apex程序运行时所使用临时表空间

4) image是指图片对应虚拟目录,值一般使用”/i/”

实际执行的例子:SQL> @apexins.sql SYSAUX SYSAUX TEMP /i/

脚本安装正常的结束应该类似这样:

Thank you for installing Oracle Application Express 5.1.0.00.45

Oracle Application Express is installed in the APEX_050100 schema.

The structure of the link to the Application Express administration services is as follows:

http://host:port/pls/apex/apex_admin (Oracle HTTP Server with mod_plsql)

http://host:port/apex/apex_admin (Oracle XML DB HTTP listener with the embedded PL/SQL gateway)

http://host:port/apex/apex_admin (Oracle REST Data Services)

The structure of the link to the Application Express development interface is as follows:

http://host:port/pls/apex (Oracle HTTP Server with mod_plsql)

http://host:port/apex (Oracle XML DB HTTP listener with the embedded PL/SQL gateway)

http://host:port/apex (Oracle REST Data Services)

timing for: Phase 3 (Switch)

Elapsed: 00:02:01.85

timing for: Complete Installation

Elapsed: 00:13:52.44

PL/SQL procedure successfully completed.

1 row selected.

...null1.sql

SYS&gt;

创建及更新APEX管理员口令

进入apex解压目录,以sys用户身份登陆,运行 apxchpwd.sql 脚本,

SYS> @apxchpwd.sql

================================================================================

This script can be used to change the password of an Application Express

instance administrator. If the user does not yet exist, a user record will be

created.

================================================================================

Enter the administrator's username [ADMIN]

User "ADMIN" does not yet exist and will be created.

Enter ADMIN's email [ADMIN] raobing@163.com

Enter ADMIN's password []

Created instance administrator ADMIN.

注意,设置的口令要符合复杂度规则,有大写及小写字符,有数字和特殊符号,至少8位长。

Unlock APEX_PUBLIC_USER , change password

SQL> ALTER USER APEX_PUBLIC_USER ACCOUNT UNLOCK

SQL> ALTER USER APEX_PUBLIC_USER IDENTIFIED BY new_password

记住新设置的口令,后面的web server配置会用到。

选择web listener

可选择的web listener有三种:

1) Oracle REST Data Services (ORDS)

2) Oracle HTTP Server with mod_plsql

3) Embedded PL/SQL Gateway

ORDS的前身时APEX Listener,简单说,它既可以单独使用,构成web listener + PL/SQL Gateway的完整功能,也可以当作一个应用,发布到WebLogic上,让WebLogic负责web listener的职责,ORDS只负责做PL/SQL Gateway方面的工作。

Oracle HTTP Server大家都知道,就是Oracle定制的Apache web server,而mod_plsql就是时限PL/SQL Gateway功能的组件,这个也包含在Oracle HTTP Server软件的发布包里面。

Embedded PL/SQL Gateway顾名思义,就是内嵌在数据库种的PL/SQL Gateway,这个功能从11g开始出现,这是最简单,易于搭建的web listener实现方式,但是也有很多限制,三者具体的差异,见下表:

Capabilities Oracle REST Data Services Oracle HTTP Server with mod_plsql Embedded PL/SQL Gateway
Image location File system File system Within the database
Configuration options GUI interface (Release 2.0.3 or later); Administration pages Database Access Descriptor (DAD) Database initialization parameters
Connection Pool settings JDBC parameters Min/MaxSpareServers; MaxClients SHARED_SERVERS; MAX_SHARED_SERVERS
Emit RESTful Web Services Yes (Release 2.0.3 or later) No No
Support multi-databases Yes, including Oracle RAC Yes, including Oracle RAC No
Virus scan files Yes, with integration of ICAP server No No
PDF printing Yes, included FOP support No No
Environment recommendations All All Development only

这次我们主要介绍ORDS搭配WebLogic的配置方法。

安装JDK,WebLogic

我选用的JDK 是1.8.0_101, weblogic版本是12.1,安装过程略。

Configuring RESTful Services & Static File Support

这两个事都是使用sys用户,执行apex_rest_config.sql(APEX解压目录下)就可以了,会创建两个用户,要求用户给出口令,按照提示输入就可以了,口令要记住,后面配置时会用到。

配置ORDS

首先要使用命令行,进行配置,配置过程会创建几个数据库用户,安装必要的对象,并将配置信息保存在params/ords_params.properties文件中。

执行:java -jar ords.war install advanced,并按照提示输入信息。

[oracle@ol71vm3 ords]$ java -jar ords.war install advanced

This Oracle REST Data Services instance has not yet been configured.

Please complete the following prompts

Enter the location to store configuration data:/home/oracle/ords

Enter the name of the database server [localhost]:

Enter the database listen port [1521]:

Enter 1 to specify the database service name, or 2 to specify the database SID [1]:

Enter the database service name:orcl.hthorizon.com

Enter 1 if you want to verify/install Oracle REST Data Services schema or 2 to skip this step [1]:

Enter the database password for ORDS_PUBLIC_USER:

Confirm password:

Please login with SYSDBA privileges to verify Oracle REST Data Services schema.

Enter the username with SYSDBA privileges to verify the installation [SYS]:

Enter the database password for SYS:

Confirm password:

Passwords do not match, try again

Enter the database password for SYS:

Confirm password:

Enter the default tablespace for ORDS_METADATA [SYSAUX]:

Enter the temporary tablespace for ORDS_METADATA [TEMP]:

Enter the default tablespace for ORDS_PUBLIC_USER [USERS]:

Enter the temporary tablespace for ORDS_PUBLIC_USER [TEMP]:

Enter 1 if you want to use PL/SQL Gateway or 2 to skip this step.

If using Oracle Application Express or migrating from mod_plsql then you must enter 1 [1]:

Enter the PL/SQL Gateway database user name [APEX_PUBLIC_USER]:

Enter the database password for APEX_PUBLIC_USER:

Confirm password:

Enter 1 to specify passwords for Application Express RESTful Services database users (APEX_LISTENER, APEX_REST_PUBLIC_USER) or 2 to skip this step [1]:

Enter the database password for APEX_LISTENER:

Confirm password:

Enter the database password for APEX_REST_PUBLIC_USER:

Confirm password:

Mar 14, 2017 5:29:40 PM

INFO: Updated configurations: defaults, apex, apex_pu, apex_al, apex_rt

Installing Oracle REST Data Services version 3.0.9.348.07.16

... Log file written to /home/oracle/ords/logs/ords_install_core_2017-03-14_172940_00481.log

... Verified database prerequisites

... Created Oracle REST Data Services schema

... Created Oracle REST Data Services proxy user

... Granted privileges to Oracle REST Data Services

... Created Oracle REST Data Services database objects

... Log file written to /home/oracle/ords/logs/ords_install_datamodel_2017-03-14_172958_00872.log

Completed installation for Oracle REST Data Services version 3.0.9.348.07.16. Elapsed time: 00:00:20.182

Enter 1 if you wish to start in standalone mode or 2 to exit [1]:2

部署到weblogic上

首先生成图片资源war包:

java -jar ords.war static <apex directory>\images

$ java –jar ords.war static /home/oracle/apex/images

这个命令会在当前目录生成i.war包,命令也会提示,要保证/home/oracle/apex/images一直存在。

然后部署ords.war和i.war到weblogic server上,用缺省配置创建一个base_domain,直接部署这两个应用到admin server上。

注意,其他都用缺省值,只有“安全”,选第二项,如下图:

clip_image003

i.war也是一样,只有安全选项选第二项,然后“激活更改”,启动两个应用:

clip_image005

重启WebLogic,测试APEX

访问地址:http://<host>:<port>/ords/

clip_image007

使用前面设置的admin账户登录,进入管理界面时,workspace要写internal

clip_image009

第一件事是创建一个workspace:

clip_image011

我这里reuse SOE这个用户:

clip_image013

输入管理员信息:

clip_image015

下一步,确认创建workspace。然后推出登录,重新登录test workspace

clip_image016

进入workspace,安装一个packaged application,比如sample chart,看看现在Oracle JET Chart有啥新东西:

clip_image018

Comments are closed.