APEX基本上是基于MVC模式的,M是item,V是html,C是调用的程序包,下面演示了如何在12C上安装APEX,前提是在winddows上安装了ORACLE 12.1 数据库。 一般生产环境安装的中间件为Oracle的融合中间件weblogic,也用用OHS的,如果并发量不是很高的话。本文是在PDB上安装apex。
SQL> show parameter pfile;
NAME TYPE
------------------------------------ ---------------------------------
VALUE
------------------------------
spfile string
C:\APP\ORACLE\ORACLE\PRODUCT\1
2.1.0\DBHOME_1\DATABASE\SPFILE
ORCL.ORA
SQL> SHOW PARAMETER SHARED_POOL_SIZE
NAME TYPE
------------------------------------ ---------------------------------
VALUE
------------------------------
shared_pool_size big integer
0
SQL> ALTER SYSTEM SET SHARED_POOL_SIZE='100M' SCOPE=spfile;
System altered.
SQL> shutdown
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup
ORACLE instance started.
Total System Global Area 1677721600 bytes
Fixed Size 3046368 bytes
Variable Size 939525152 bytes
Database Buffers 721420288 bytes
Redo Buffers 13729792 bytes
Database mounted.
Database opened.
SQL>
■ Microsoft Internet Explorer 7.0 or later
■ Mozilla Firefox 14 or later
■ Google Chrome 21 or later
■ Apple Safari 5.0 or later
这个有个1G就可以。
这个只要是用dbca建立的库都默认已经安装,检查方法:
@apex_epg_config C:\app\oracle\oracle\product\12.1.0\dbhome_1
C:\app\oracle\oracle\product\12.1.0\dbhome_1\apex>sqlplus "/ as sysdba"
SQL*Plus: Release 12.1.0.2.0 Production on Wed Aug 17 01:01:06 2016
Copyright (c) 1982, 2014, Oracle. All rights reserved.
Connected to:
Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production
With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options
SQL> alter session set container = pdborcl;
Session altered.
SQL> @apex_epg_config C:\app\oracle\oracle\product\12.1.0\dbhome_1
PL/SQL procedure successfully completed.
PL/SQL procedure successfully completed.
. Loading images directory: C:\app\oracle\oracle\product\12.1.0\dbhome_1/apex/images
Directory created.
PL/SQL procedure successfully completed.
PL/SQL procedure successfully completed.
PL/SQL procedure successfully completed.
Commit complete.
Directory dropped.
timing for: Load Images
Elapsed: 00:01:50.67
PL/SQL procedure successfully completed.
Commit complete.
--配置端口和管理员密码
SQL> @apxconf
PORT
----------
8080
Enter values below for the XDB HTTP listener port and the password for the Application Express ADMIN user.
Default values are in brackets [ ].
Press Enter to accept the default value.
Enter a value below for the password for the Application Express ADMIN user.
Enter a password for the ADMIN user []
Session altered.
...changing password for ADMIN
PL/SQL procedure successfully completed.
Enter a port for the XDB HTTP listener [ 8080]
...changing HTTP Port
PL/SQL procedure successfully completed.
SQL>
解锁用户,pdb和cdb下的匿名用户都要解锁啊,因为cdb下的anonymous没有解锁,导致apex的静态页面出不来,只是一个中间件的验证窗口要求登录,看日志也没有看出个鸟来,最后检查发现是匿名用户没有解锁导致,官方文档的意思是pdb和cdb都有解锁:
SQL> ALTER SESSION SET CONTAINER = CDB$ROOT;
Session altered.
SQL> ALTER SESSION SET CONTAINER = CDB$ROOT;
Session altered.
SQL> ALTER USER ANONYMOUS ACCOUNT UNLOCK;
User altered.
SQL> commit
2 ;
Commit complete.
SQL> SELECT DBMS_XDB.GETHTTPPORT FROM DUAL;
GETHTTPPORT
-----------
0
SQL> alter session set container = pdborcl;
Session altered.
SQL> SELECT DBMS_XDB.GETHTTPPORT FROM DUAL;
GETHTTPPORT
-----------
8080
SQL> ALTER USER ANONYMOUS ACCOUNT UNLOCK;
User altered.
SQL> commit
2 ;
Commit complete.
SQL>
最大权限:
DECLARE
acl_path VARCHAR2(4000);
BEGIN
-- Look for the ACL currently assigned to '*' and give APEX_040200 -- the "connect" privilege if APEX_040200 does not have the privilege yet.
SELECT acl
INTO acl_path
FROM dba_network_acls
WHERE host = '*'
AND lower_port IS NULL
AND upper_port IS NULL;
IF dbms_network_acl_admin.check_privilege(acl_path,
'APEX_040200',
'connect') IS NULL THEN
dbms_network_acl_admin.add_privilege(acl_path,
'APEX_040200',
TRUE,
'connect');
END IF;
EXCEPTION
WHEN no_data_found THEN
dbms_network_acl_admin.create_acl('power_users.xml',
'ACL that lets power users to connect to everywhere',
'APEX_040200',
TRUE,
'connect');
dbms_network_acl_admin.assign_acl('power_users.xml', '*');
END;
/
commit;
此时登录http://localhost:8080/apex/apex_admin 已经可以访问了。
输入admin密码是初始配置时的密码
进入到apex\builder\zh-cn
C:\app\oracle\oracle\product\12.1.0\dbhome_1\apex\builder\zh-cn>set NLS_LANG=American_America.AL32UTF8
C:\app\oracle\oracle\product\12.1.0\dbhome_1\apex\builder\zh-cn>sqlplus "/ as sysdba"
SQL*Plus: Release 12.1.0.2.0 Production on Wed Aug 17 01:01:06 2016
Copyright (c) 1982, 2014, Oracle. All rights reserved.
Connected to:
Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production
With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options
SQL> alter session set container = pdborcl;
Session altered.
SQL>ALTER SESSION SET CURRENT_SCHEMA = APEX_040200;
Session altered.
SQL> @load_zh-cn.sql
--然后进入了漫长的等待...一二十分钟后就可以汉化好了。
SQL> SELECT VALUE FROM v$parameter WHERE NAME = 'job_queue_processes'
2 ;
VALUE
--------------------------------------------------------------------------------
1000
1 row selected.
SQL> show parameter shared
NAME TYPE
------------------------------------ ---------------------------------
VALUE
------------------------------
hi_shared_memory_address integer
0
max_shared_servers integer
shared_memory_address integer
0
shared_pool_reserved_size big integer
5872025
shared_pool_size big integer
NAME TYPE
------------------------------------ ---------------------------------
VALUE
------------------------------
112M
shared_server_sessions integer
shared_servers integer
1
SQL> ALTER SYSTEM SET SHARED_SERVERS = 5 SCOPE=BOTH;
System altered.
SQL> commit;
Commit complete.
SQL>