Search code examples
oracle-databaseoracle11goracle-apexsql-deleteworkspace

In Oracle Database 11g XE, how do I delete applications from the application builder from a deleted workspace?


I just started learning SQL and Databases using Oracle Database 11g XE. I noticed that under the Application Builder section there is always a Sample Application, which application_ID is 100 for the first workspace. When I create a new workspace, the ID of this sample application in the new workspace increases accordingly, so for my second workspace it's 101, and so on. But if I delete a workspace, without first deleting it's application, the id for new applications still increases, which leads me to think that the application is still there somewhere even after I deleted the workspace and dropped the user... They don't show up anywhere, not even in the admin view... How can I find and delete these sample applications that no longer belong to any workspace? Thank you

Note: If I delete the sample application before deleting the workspace, then the next new workspace will have the same ID for the sample application, so that's why I believe these applications are still there somewhere undeleted when I don't delete the application before deleting the workspace.


Solution

  • As far as I can tell, once you drop the workspace, all its applications (and everything else - shared components etc.) are dropped with it. The fact that Sample Application ID keeps increasing - in my opinion - depends on some internal mechanism which uses some kind of a "smart counter" / "sequence", i.e. if you delete an application it decreases, but - if you delete a workspace, it does not. Please, note that this is just my opinion, I don't know how it exactly works.

    Anyway: to check applications you currently have, connect as a privileged user (such as SYS). First, check what Apex users you have:

    SQL> select * From all_users where username like 'APEX%' order by username;
    
    USERNAME                          USER_ID CREATED
    ------------------------------ ---------- --------
    APEX_INSTANCE_ADMIN_USER              156 01.06.17
    APEX_LISTENER                         173 05.03.19
    APEX_PUBLIC_USER                       86 10.10.16
    APEX_REST_PUBLIC_USER                 174 05.03.19
    APEX_050000                            87 10.10.16
    APEX_050100                           154 01.06.17
    APEX_180200                           178 08.03.19
    
    7 rows selected.
    
    SQL>
    

    Then find applications within certain Apex user; as you're on 11g XE and if you didn't upgrade Apex, I believe you have APEX_040000 (which is built-in into 11g XE). I don't have it, but I do have other versions, so:

    SQL> select workspace, application_id, application_name, owner
      2  from apex_050100.apex_applications
      3  order by application_id;
    
    WORKSPACE       APPLICATION_ID APPLICATION_NAME               OWNER
    --------------- -------------- ------------------------------ ---------------
    RNAL                       100 Sample Database Application    RNAL
    WEB                        101 Sample Database Application    WEB
    RNAL                       129 Warehouse                      RNAL
    MBUN                       130 web_service                    MBUN
    ORAGIS                     131 GIS                            ORAGIS
    <snip>