be3
be3

Reputation: 77

How to import existing app to APEX via SQLPLUS

I have an existing test app. My config is Windows 10, APEX 19.1, Database Express 18.4

I try to import app by sqlplus:

> sqlplus 
> User name: sys as sysdba
> Password: 1234
SQL>@install_KB.sql

And i`l get many errors that's starts with:

apex_application_install.set_workspace_id (100101);
  *
ERROR at line 9:
ORA-06550: line 9, column 3:
PLS-00201: identifier 'APEX_APPLICATION_INSTALL.SET_WORKSPACE_ID' must be
declared

ORA-06550: line 9, column 3:
PL/SQL: Statement ignored

ORA-06550: line 10, column 3:
PLS-00201: identifier 'APEX_APPLICATION_INSTALL.SET_APPLICATION_ID' must be
declared
...

My source from install_KB.sql:

spool install-apex-KB.log
@@APEX/kb_apex_0.0.1.sql
@@DB/security_2.1.0.sql
spool off

and source of kb_apex_0.0.1.sql:

declare
   workspace_id number    := 100101; 
   app_id number          := 62305999; 
   app_owner varchar2(32) := 'test'; 
   app_alias varchar2(32) := 'testapp';

begin 
  apex_application_install.set_workspace_id (workspace_id);
  apex_application_install.set_application_id(app_id);
  apex_application_install.set_schema(app_owner);
  apex_application_install.set_application_alias(app_alias);
end;
/

@@kb_0.0.1.sql

What i`m doing wrong? Sorry if answer is obvious

UPD: My Schema Assignments list - My Schema Assignments list Application Developers and Users - Application Developers and Users

Upvotes: 0

Views: 1833

Answers (1)

Adam vonNieda
Adam vonNieda

Reputation: 1745

I don't use any of those "apex_application_install" calls when I migrate apps from one environment to the next. I simply connect to the database via SQL*Plus as the user / schema associated with the workspace, and run the exported application .sql file (which was exported via SQLcl)

I know there are times when you might want to change an application ID etc., but if everything in the target environment is the same, keep it simple.

Import script examples: here

To get Workspace to schema assignment in SQL*Plus, you can use the following example, where APEX_180200 is the APEX schema, and 'ADAM' is the workspace. Or log in to the admin side of APEX and go to "Manage Workspaces" / "Manage Workspace to Schema Assignments" Note that in the example below, my workspace and schema are both named "ADAM".

sqlplus / as sysdba
...
SQL> ALTER SESSION SET CURRENT_SCHEMA = APEX_180200;
SQL> SELECT APEX_INSTANCE_ADMIN.GET_SCHEMAS('ADAM') FROM DUAL;
APEX_INSTANCE_ADMIN.GET_SCHEMAS('ADAM')
--------------------------------------------------------------------------------
ADAM  

SQL>

Admin GUI

Administration GUI

Upvotes: 1

Related Questions