在开始以前,先介绍下Oracle Application Express(APEX)。javascript
Oracle Application Express—APEX for short, or by its former name HTML DB — is adeclarative,Web-based RAD(Rapid Application development) tool. It is used to developnativeWeb-based,data centricapplications.It requires no software to install on the client.css
自2004年开始,Oracle已经开始这一款产品的开发,如今已升级到5.0。细心的人估计之前注意到,Oracle11g中自带了APEX开头的帐户,它们是APEX内置schema, 而且已经绑定到Oracle安装中。也就是说,在你买了Oracle数据库状况下,不要额外的License,就能够放心使用APEX。html
出了免费外,它的优点很明显,java
1,一切基于web, 架构在Oracle 数据库上, 独立于软硬件环境ios
2,快速开发,极大缩短开发周期,支持html,css, javascriptweb
2,相比OBIEE,SAPBO这样重量级BI报表工具,它更加灵活,能够做为轻量级的BI解决方案sql
说了那么多废话,开始干正事,准备安装!数据库
1,创建数据库环境, 建立两个表空间, 用于安装APEX, 以便往后的管理。apache
CREATE TABLESPACE APEX datafile‘/u01/app/oracle/oradata/APEX/apex.dbf’api
SIZE 500M
EXTENT MANAGEMENT LOCAL
SEGMENT SPACE MANAGEMENT AUTO;
CREATE TABLESPACE APEX_FILES datafile‘/u01/app/oracle/oradata/APEX/apex_files.dbf’
SIZE 500M
EXTENT MANAGEMENT LOCAL
SEGMENT SPACE MANAGEMENT AUTO;
2,下载解压APEX 安装包, 具体下载地址
http://www.oracle.com/technetwork/developer-tools/apex/overview/index.html
3, 解压完后, 切换到解压后的目录,并以sys登录数据库。 这一步目录切换很重要,在APEX安装过程当中, 路径用的是相对路径,若是开始没切换目录的话, 过程当中, 会报文件找不到的错误
4, 安装APEX, 命令以下
Full development environment. Runapexins.sql passingthe following four arguments in the order shown:
@apexins.sqltablespace_apex tablespace_files tablespace_tempimages
Where:
tablespace_apexis the name of the tablespace for the Oracle Application Express application user.
tablespace_filesis the name of the tablespace for the Oracle Application Express files user.
tablespace_tempis the name of the temporary tablespace or tablespace group.
imagesis the virtual directory for Oracle Application Express images. To support future Oracle Application Express upgrades, define the virtual image directory as /i/.
我采用的是开发环境的安装, 固然,在产品环境,能够选择Runtime environment 模式安装, sql 脚本换成 @apxrtins.sql
以前建立的两个表空间将tablespace_apex, tablespace_files 替换以下:
@apexins.sqlAPEX APEX_FILESTEMP /i/
这一步会花一段时间安装完若是一切安装顺利的话, 就会出现和截图同样
当安装完后, 一下三个schema 会被建立,有空的话,能够查看验证下
■ APEX_050000 - The account that owns the Oracle Application Express schema and
metadata.
■ FLOWS_FILES - The account that owns the Oracle Application Express uploaded
files.
■ APEX_PUBLIC_USER - The minimally privileged account is used for Oracle
Application Express configuration with Oracle REST Data Services or Oracle
HTTP Server and mod_plsql.
5, 运行apxchpwd.sql, 它的做用以下, 就是设置APEX的超级管理员。 运行完后, 重启数据库。
Running the apxchpwd.sql script enables your to create or update your Instance
Administrator account. You must run the apxchpwd.sql script in the following
scenarios:
■ New Oracle Application Express installations - Run apxchpwd.sql to create an
Instance Administrator account and password.
■ Converting of a runtime environment to a development environment - Run
apxchpwd.sql to change the Instance Administrator account password.
■ Changing Your Instance Administrator Password -Run apxchpwd.sql to change
the password for an existing Instance Administrator account.
■ Unlocking Your Instance Administrator Account - Run apxchpwd.sql to unlock
an existing Instance Administrator account.
6, 设置APEX_PUBLIC_USER, 为了下面配置ORDS 用
解锁
SQL>ALTER USER APEX_PUBLIC_USER ACCOUNT UNLOCK
重置密码
SQL>alter user apex_public_user identified by apex_public_user
7, 安装配置Oracle Rest Data Services(ORDS)
下载地址:http://www.oracle.com/technetwork/developer-tools/rest-data-services/downloads/
index.html
下载完后, 解压指定好的安装目录。 解压完后, 你能够发现ORDS这个就是个war包
7.1 Disabling Oracle XML DB Protocol Server
SQL>EXEC DBMS_XDB.SETHTTPPORT(0);
SQL> 7.2 configure RESTful Services in Oracle Application Express
SQL>@apex_rest_config.sql
When configuring RESTful Services in OracleApplication Express, it creates two
new database accounts.
■ APEX_LISTENER - The account used to query RESTfulServices definitions
stored in Oracle Application Express.
■ APEX_REST_PUBLIC_USER - The account used whencalling RESTful Services
definitions stored in Oracle Application Express.
SQL>@apex_rest_config.sql
Entera password for the APEX_LISTENER user []
Entera password for the APEX_REST_PUBLIC_USER user []
...createAPEX_LISTENER user
...createAPEX_REST_PUBLIC_USER user
SQL>
SQL>
7.3 Granting Connect Privileges, 这一步是赋链接的权限给web 主机, 使它能可以与ORDS进行链接
SQL>
SQL>DECLARE
2 ACL_PATH VARCHAR2(4000);
3 BEGIN
4 --Look for the ACL currently assigned to '*' and give APEX_050000
5 --the "connect" privilege if APEX_050000 does not have the privilegeyet.
6 SELECT ACL INTO ACL_PATH FROM DBA_NETWORK_ACLS
7 WHERE HOST = '*' AND LOWER_PORT IS NULL AND UPPER_PORT IS NULL;
8 IFDBMS_NETWORK_ACL_ADMIN.CHECK_PRIVILEGE(ACL_PATH, 'APEX_050000',
9 'connect') IS NULL THEN
10 DBMS_NETWORK_ACL_ADMIN.ADD_PRIVILEGE(ACL_PATH,
11 'APEX_050000', TRUE, 'connect');
12 ENDIF;
13 EXCEPTION
14 --When no ACL has been assigned to '*'.
15 WHENNO_DATA_FOUND THEN
16 DBMS_NETWORK_ACL_ADMIN.CREATE_ACL('power_users.xml',
17 'ACLthat lets power users to connect to everywhere',
18 'APEX_050000', TRUE, 'connect');
19 DBMS_NETWORK_ACL_ADMIN.ASSIGN_ACL('power_users.xml','*');
20 END;
21 /
COMMIT;
SQL>SQL>
7.3 Configuring Oracle Application Express Images
Copy the contents ofthe /images folder to /webapps/i/.
Where:
– is the directory location of the Oracle Application Expressdistribution.
– is the folder where Apache Tomcat is installed.
7.4 Configuring Oracle REST Data Services
a, copyords.warfrom ordspackage to tomcat webapps directory.
b, configure REST DATA Services
cd ..//webapps
drwxrwxrwx 14 oracleoinstall 4096 Mar 27 14:04 docs
drwxrwxrwx 7 oracle oinstall 4096 Mar 27 14:04 examples
drwxrwxrwx 5 oracle oinstall 4096 Mar 27 14:04 host-manager
drwxrwxrwx 33 oracleoinstall 40960 May 11 02:56 i
drwxrwxrwx 5 oracle oinstall 4096 Mar 27 14:04 manager
-rw-r--r-- 1 oracle oinstall 28491706 May 11 20:17ords.war
drwxrwxrwx 3 oracle oinstall 4096 Mar 27 14:04 ROOT
7.5 配置ORDS链接
[oracle@localhostwebapps]$ java -jar ords.war setup
Jun 09, 201512:26:03 AM oracle.dbtools.common.config.file.ConfigurationFolderlogConfigFolder
INFO: Usingconfiguration folder: /tmp/apex
Enter the name ofthe database server [localhost]:
Enter the databaselisten port [1521]:
Enter 1 to specifythe database service name, or 2 to specify the database SID [1]:2
Enter the databaseSID [xe]:yang01
Enter the databaseuser name [APEX_PUBLIC_USER]:apex_public_user
Enter the databasepassword for apex_public_user:
Confirm password:
Enter 1 to enterpasswords for the RESTful Services database users(APEX_LISTENER,APEX_REST_PUBLIC_USER), 2 to use the same password as used forapex_public_user or, 3 to skip this step [1]:
Enter the databasepassword for APEX_LISTENER:
Confirm password:
Enter the databasepassword for APEX_REST_PUBLIC_USER:
Confirm password:
Jun 09, 201512:27:19 AM oracle.dbtools.common.config.file.ConfigurationFiles update
INFO: Updatedconfigurations: defaults, apex, apex_al, apex_rt
[oracle@localhostwebapps]$
启用Tomcat,访问报错,已经检查过,apex那3个数据帐号并无问题。
查了很久,注意到了页面这一行字,此实例使用……,与上面配置默认给的路径
INFO: Using configuration folder: /tmp/apex,并非一个路径。
既然这样,只能指定一个路径专门放配置信息
[oracle@localhostwebapps]$ java -jar ords.war configdir
Jun 09, 201512:55:30 AM oracle.dbtools.common.config.cmds.ConfigDir execute
INFO: The config.dirsetting is not set
[oracle@localhostwebapps]$ java -jar ords.war configdir/u01/app/apache-tomcat-7.0.61/webapps/ordsconfig
Jun 09, 2015 1:01:57AM oracle.dbtools.common.config.cmds.ConfigDir execute
INFO: Set config.dirto /u01/app/apache-tomcat-7.0.61/webapps/ordsconfig in:/u01/app/apache-tomcat-7.0.61/webapps/ords.war
配置完路径后,从新配置ORDS
[oracle@localhostwebapps]$ java -jar ords.war setup
Jun 09, 2015 1:03:05AM oracle.dbtools.common.config.file.ConfigurationFolder logConfigFolder
INFO: Usingconfiguration folder: /u01/app/apache-tomcat-7.0.61/webapps/ordsconfig/ords
Enter the name ofthe database server [localhost]:
Enter the databaselisten port [1521]:
Enter 1 to specifythe database service name, or 2 to specify the database SID [1]:2
Enter the databaseSID [xe]:yang01
Enter the databaseuser name [APEX_PUBLIC_USER]:apex_public_user
Enter the databasepassword for apex_public_user:
Confirm password:
Enter 1 to enterpasswords for the RESTful Services database users(APEX_LISTENER,APEX_REST_PUBLIC_USER), 2 to use the same password as used forapex_public_user or, 3 to skip this step [1]:
Enter the databasepassword for APEX_LISTENER:
Confirm password:
Enter the databasepassword for APEX_REST_PUBLIC_USER:
Confirm password:
Jun 09, 2015 1:03:59AM oracle.dbtools.common.config.file.ConfigurationFiles update
INFO: Updatedconfigurations: defaults, apex, apex_al, apex_rt
[oracle@localhostwebapps]$ ll
total 27924
drwxrwxrwx 14 oracleoinstall 4096 Mar 27 14:04 docs
drwxrwxrwx 7 oracle oinstall 4096 Mar 27 14:04 examples
drwxrwxrwx 5 oracle oinstall 4096 Mar 27 14:04 host-manager
drwxrwxrwx 33 oracleoinstall 40960 May 11 02:56 i
drwxrwxrwx 5 oracle oinstall 4096 Mar 27 14:04 manager
drwxr-xr-x 6 oracle oinstall 4096 Jun 9 01:02 ords
drwxr-xr-x 3 oracle oinstall 4096 Jun 9 01:02 ordsconfig
-rw-r--r-- 1 oracle oinstall 28491732 Jun 9 01:02 ords.war
drwxrwxrwx 3 oracle oinstall 4096 Mar 27 14:04 ROOT
重启tomcat,大功告成!
倒腾了这么久, 给你们展现下界面,以及它的一个示例应用。 真心推荐你们研究并使用这个工具,很不错~