Monday, October 15, 2018

Export from APEX 5.1 after you have upgraded to APEX 18.2

I just wrapped up an upgrade for one of the development environments from APEX 5.1 to APEX 18.2 when the phone rang:

I need to export some changes I was doing in APEX 5.1, an issue has suddenly changed from low priority to high priority. The work in only in DEV, and I don't have a recent export!!  Is APEX 18.2 backwardly compatible with APEX 5.1?
 I wouldn't like to try exporting from APEX 18.2 back to APEX 5.1 - that's fraught with danger.
But it is possible to do an export from an old APEX schema provided you haven't dropped the schema, here's how..

variable name     varchar2(255)
variable contents clob
    l_files apex_050100.wwv_flow_t_export_files;
    l_files   := apex_050100.wwv_flow_export_api.get_application(p_application_id => &APPLICATION_ID. );
    :name     := l_files(1).name;
    :contents := l_files(1).contents;
set feed off echo off head off flush off termout off trimspool on
set long 100000000 longchunksize 32767
col name new_val name
select :name name from sys.dual;
spool &name.
print contents
spool off
Surprisingly easy!!!
So now the developer imports the application into the TEST environment, which is still APEX 5.1, finalizes the change and make an emergency release to promote to UAT and PROD.

Monday, October 1, 2018

ORA-28014: cannot drop administrative users

Just so I don't forget :)

SQL> drop user apex_180100 cascade;

Error starting at line : 1 in command -
drop user apex_180100 cascade
Error report -
ORA-28014: cannot drop administrative users

SQL> alter session set "_oracle_script"=true;

Session altered.

SQL> drop user apex_180100 cascade;

User APEX_180100 dropped.