从Oracle 12.2开始,默认APEX不会被安装,虽然仍然可以在ORACLE_HOME/apex下找到安装文件,但是仅仅是放在那里而已,没有安装。这样做的好处是在创建PDB时不用再担心要先卸载APEX。
当然,如果要使用APEX的话就需要手动安装了。不建议安装默认的版本,最好重新下载最新版的APEX。需要注意的是,在安装时应该将APEX安装在PDB中,而不是root容器。
下载后,先解压:
- [oracle@orcl apex]$ ls
- apex apex_5.1.4.zip
- [oracle@orcl apex]$ pwd
- /home/oracle/apex
- [oracle@orcl apex]$ cd apex/
- [oracle@orcl apex]$ ls
- apex_epg_config_cdb.sql apex_rest_config_nocdb.sql apxe102.sql apxremov_cdb.sql core
- apex_epg_config_core.sql apex_rest_config.sql apxe111.sql apxremov_nocdb.sql coreins2.sql
- apex_epg_config_nocdb.sql appins.sql apxe112.sql apxremov.sql coreins3.sql
- apex_epg_config.sql apxchpwd.sql apxe121.sql apxrtins_cdb.sql coreins4.sql
- apexins1.sql apxconf.sql apxexit.sql apxrtins_cdb_upg.sql coreins5.sql
- apexins2.sql apxdbmig.sql apxldimg_core.sql apxrtins_nocdb.sql coreins.sql
- apexins3.sql apxdevrm_cdb.sql apxldimg.sql apxrtins.sql devins.sql
- apexins_cdb.sql apxdevrm_nocdb.sql apxpatch.sql apxsdoins.sql endins.sql
- apexins_cdb_upg.sql apxdevrm.sql apxpreins.sql apxsqler.sql gen_adm_pwd.sql
- apexins_nocdb.sql apxdvins_cdb.sql apxprereq.sql apxupgrd.sql images
- apexins.sql apxdvins_nocdb.sql apxrelod.sql apxxemig.sql load_trans.sql
- apex_rest_config_cdb.sql apxdvins.sql apxremov1.sql builder utilities
- apex_rest_config_core.sql apxe101.sql apxremov2.sql catapx.sql
- [oracle@orcl apex]$
在解压后的apex目录下,以DBA用户登录到数据库中:
- [oracle@orcl apex]$ sqlplus / as sysdba
- SQL*Plus: Release 12.2.0.1.0 Production on Fri Mar 30 16:51:48 2018
- Copyright (c) 1982, 2016, Oracle. All rights reserved.
- Connected to:
- Oracle Database 12c Enterprise Edition Release 12.2.0.1.0 - 64bit Production
- SQL>
在PDB中,为APEX创建专用的表空间:
- SQL> CREATE TABLESPACE apex DATAFILE '/u01/app/oracle/oradata/orcl/apex_tbs.dbf' SIZE 300M AUTOEXTEND ON NEXT 10M;
- Tablespace created.
开始安装:
- SQL> @apexins.sql APEX APEX TEMP /i/
经过几十分钟,会看到:
- ...
- Thank you for installing Oracle Application Express 5.1.4.00.08
- 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:03:24.18
- timing for: Complete Installation
- Elapsed: 00:25:38.64
- PL/SQL procedure successfully completed.
- 1 row selected.
- ...null1.sql
- SYS>
修改密码,注意密码必须包含大写字母,数字,以及特殊符号,比如Welcome1#:
- SQL> @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]
- Enter ADMIN's password []
- Created instance administrator ADMIN.
- SQL>
继续配置REST API的用户密码,为方便起见,都设置为Welcome1#:
- SQL> @apex_rest_config.sql
- Enter a password for the APEX_LISTENER user []
- Enter a password for the APEX_REST_PUBLIC_USER user []
- ...create APEX_LISTENER and APEX_REST_PUBLIC_USER users
- SQL>
加载图片资源:
- SQL> @apex_epg_config.sql /home/oracle/apex/
- . Loading images directory: /home/oracle/apex//apex/images
- timing for: Load Images
- Elapsed: 00:02:10.24
查询,配置端口以及设置用户权限:
- SQL> SELECT DBMS_XDB.gethttpport FROM DUAL;
- GETHTTPPORT
- -----------
- 0
- SQL> EXEC DBMS_XDB.sethttpport(8080);
- SQL> SELECT DBMS_XDB.gethttpport FROM DUAL;
- GETHTTPPORT
- -----------
- 8080
- SQL> ALTER USER APEX_PUBLIC_USER ACCOUNT UNLOCK;
- SQL> ALTER USER ANONYMOUS ACCOUNT UNLOCK;
- SQL> ALTER USER XDB ACCOUNT UNLOCK;
- SQL> ALTER USER FLOWS_FILES ACCOUNT UNLOCK;
- SQL> ALTER USER APEX_INSTANCE_ADMIN_USER ACCOUNT UNLOCK;
- SQL>
这时就可以通过http://localhost:8080/apex/apex_admin来访问APEX的管理页面,用户名密码为 ADMIN/Welcome1#.