8i | 9i | 10g | 11g | 12c | 13c | 18c | 19c | Misc | PL/SQL | SQL | RAC | WebLogic | Linux

Home » Articles » Misc » Here

APEX Tips : Remove EPG Configuration

Once you've run the APEX Embedded PL/SQL Gateway (EPG) configuration, there isn't a script provided that will remove it, other than doing the full uninstall of APEX. As pointed out by Joel Kallman, the code to remove the APEX EPG configuration is in the "apxremov2.sql" script, so here I'll describe how to do it.

Related articles.

Find the Code

When you open the "apxremov2.sql" script you will find a section that looks like this.

-- XDB Cleanup
declare
    cfg XMLType;
    l_dad_list dbms_epg.varchar2_table;
begin

    if '^UPGRADE' = '1' then

        if dbms_xdb.existsresource('/i/') then
          dbms_xdb.deleteresource('/i/', dbms_xdb.delete_recursive_force);
        end if;

        if dbms_xdb.existsresource('/images/') then
          dbms_xdb.deleteresource('/images/',dbms_xdb.delete_recursive_force);
        end if;

        dbms_epg.get_dad_list( l_dad_list );
        for i in 1..l_dad_list.count loop
            if upper(l_dad_list(i)) = 'APEX' then
                dbms_epg.drop_dad('APEX');
            end if;
        end loop;

        cfg := dbms_xdb.cfg_get();

        if cfg.existsNode('/xdbconfig/sysconfig/protocolconfig/httpconfig/webappconfig/servletconfig/servlet-mappings/servlet-mapping/servlet-name[text()="PublishedContentServlet"]') = 1 then
            cfg := cfg.deleteXML('/xdbconfig/sysconfig/protocolconfig/httpconfig/webappconfig/servletconfig/servlet-mappings/servlet-mapping/servlet-name[text()="PublishedContentServlet"]/..');
        end if;

        if cfg.existsNode('/xdbconfig/sysconfig/protocolconfig/httpconfig/webappconfig/servletconfig/servlet-list/servlet/servlet-name[text()="PublishedContentServlet"]') = 1 then
            cfg := cfg.deleteXML('/xdbconfig/sysconfig/protocolconfig/httpconfig/webappconfig/servletconfig/servlet-list/servlet/servlet-name[text()="PublishedContentServlet"]/..');
        end if;

        dbms_xdb.cfg_update(cfg);
        commit;
        dbms_xdb.cfg_refresh;

    end if;

end;
/

Run the Edited Code

Either remove the IF statement surrounding the code, or edit it to make the test positive, so the code actually runs. Here is an example of what I run. Notice the modified IF statement.

CONN / AS SYSDBA
ALTER SESSION SET CONTAINER = pdb1;

-- XDB Cleanup
declare
    cfg XMLType;
    l_dad_list dbms_epg.varchar2_table;
begin

    if '1' = '1' then

        if dbms_xdb.existsresource('/i/') then
          dbms_xdb.deleteresource('/i/', dbms_xdb.delete_recursive_force);
        end if;

        if dbms_xdb.existsresource('/images/') then
          dbms_xdb.deleteresource('/images/',dbms_xdb.delete_recursive_force);
        end if;

        dbms_epg.get_dad_list( l_dad_list );
        for i in 1..l_dad_list.count loop
            if upper(l_dad_list(i)) = 'APEX' then
                dbms_epg.drop_dad('APEX');
            end if;
        end loop;

        cfg := dbms_xdb.cfg_get();

        if cfg.existsNode('/xdbconfig/sysconfig/protocolconfig/httpconfig/webappconfig/servletconfig/servlet-mappings/servlet-mapping/servlet-name[text()="PublishedContentServlet"]') = 1 then
            cfg := cfg.deleteXML('/xdbconfig/sysconfig/protocolconfig/httpconfig/webappconfig/servletconfig/servlet-mappings/servlet-mapping/servlet-name[text()="PublishedContentServlet"]/..');
        end if;

        if cfg.existsNode('/xdbconfig/sysconfig/protocolconfig/httpconfig/webappconfig/servletconfig/servlet-list/servlet/servlet-name[text()="PublishedContentServlet"]') = 1 then
            cfg := cfg.deleteXML('/xdbconfig/sysconfig/protocolconfig/httpconfig/webappconfig/servletconfig/servlet-list/servlet/servlet-name[text()="PublishedContentServlet"]/..');
        end if;

        dbms_xdb.cfg_update(cfg);
        commit;
        dbms_xdb.cfg_refresh;

    end if;

end;
/

Once that is complete, it's worth running the VALIDATE_APEX procedure to check everything is OK.

CONN / AS SYSDBA
ALTER SESSION SET CONTAINER = pdb1;

SET SERVEROUTPUT ON
EXEC SYS.validate_apex;

That's it!

For more information see:

Hope this helps. Regards Tim...

Back to the Top.