APEX install

1. Скачать apex_5.0.zip. Распоковать в D:\apex
2. Создать новый tablespace
CREATE TABLESPACE APEX DATAFILE 'D:\app\oradata\apex\apex01.dbf' SIZE 64M AUTOEXTEND ON NEXT 10M;
3. @apexins APEX APEX TEMP /i/
4. @apxchpwd
5. @apex_epg_config D:\app
6. При обновление сущесутвующего apex: @apxldimg D:\app
7. Разблокировать пользователей
ALTER USER ANONYMOUS ACCOUNT UNLOCK;
ALTER USER APEX_PUBLIC_USER ACCOUNT UNLOCK;
8. EXEC dbms_xdb.sethttpport(8080);
9. EXEC dbms_xdb.setListenerLocalAccess(l_access => FALSE);
-- если TRUE - только localhost, если FALSE - все адреса
10. Для Oracle 11g выполнить
DECLARE
  ACL_PATH  VARCHAR2(4000);
BEGIN
  -- Look for the ACL currently assigned to '*' and give APEX_050000
  -- the "connect" privilege if APEX_050000 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_050000','connect') IS NULL THEN
      DBMS_NETWORK_ACL_ADMIN.ADD_PRIVILEGE(ACL_PATH,'APEX_050000', TRUE, 'connect');
  END IF;
 
EXCEPTION
  -- When no ACL has been assigned to '*'.
  WHEN NO_DATA_FOUND THEN
  DBMS_NETWORK_ACL_ADMIN.CREATE_ACL('power_users.xml',
    'ACL that lets power users to connect to everywhere',
    'APEX_050000', TRUE, 'connect');
  DBMS_NETWORK_ACL_ADMIN.ASSIGN_ACL('power_users.xml','*');
END;
/
COMMIT;

http://hostname:port/apex
Workspace: INTERNAL
Username: ADMIN
Password: *****

-- APEX верии 3.2 можно удалить 
DROP USER APEX_030200 CASCADE;

-- Выключить XMLDB HTTP сервер
EXEC DBMS_XDB.SETHTTPPORT(0);
SELECT DBMS_XDB.GETHTTPPORT FROM DUAL;

-------------------------------------
Installing APEX and Configuring ORDS
-------------------------------------
--https://docs.oracle.com/cd/E59726_01/install.50/e39144/listener.htm

@apexins.sql SYSAUX SYSAUX TEMP /i/
@apxchpwd.sql
ALTER USER APEX_PUBLIC_USER ACCOUNT UNLOCK;
ALTER USER APEX_PUBLIC_USER IDENTIFIED BY APEX_PUBLIC_USER;
EXEC DBMS_XDB.SETHTTPPORT(0);
@apex_rest_config.sql

DECLARE
  ACL_PATH  VARCHAR2(4000);
BEGIN
  -- Look for the ACL currently assigned to '*' and give APEX_050100
  -- the "connect" privilege if APEX_050100 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_050100',
     'connect') IS NULL THEN
      DBMS_NETWORK_ACL_ADMIN.ADD_PRIVILEGE(ACL_PATH,
     'APEX_050100', TRUE, 'connect');
  END IF;
 
EXCEPTION
  -- When no ACL has been assigned to '*'.
  WHEN NO_DATA_FOUND THEN
  DBMS_NETWORK_ACL_ADMIN.CREATE_ACL('power_users.xml',
    'ACL that lets power users to connect to everywhere',
    'APEX_050100', TRUE, 'connect');
  DBMS_NETWORK_ACL_ADMIN.ASSIGN_ACL('power_users.xml','*');
END;
/
COMMIT;

----------------------------
Upgrade from Apex 5.0 to 5.1
----------------------------
--https://svenweller.wordpress.com/2017/02/01/how-to-upgrade-from-apex-5-0-to-5-1/

select owner as schema,
       tablespace_name as data_tbs,
       nvl(segment_type, ' - total -') segment_type,
       round(sum(bytes) / 1024 / 1024, 2) size_in_MB
  from dba_extents
 where regexp_like(owner, '^(APEX_|ORDS_)')
 group by owner, tablespace_name, rollup(segment_type);
 
@apexins1.sql APEX APEX TEMP /i/
@apexins2.sql APEX APEX TEMP /i/
--stop ORDS
@apexins3.sql APEX APEX TEMP /i/

@apxldimg.sql C:  -- for C:\apex
DROP USER APEX_050000 CASCADE;

----------------------------
-- Узнать версию
SELECT VERSION_NO FROM APEX_RELEASE;
----------------------------