Skip to main content

We're trying to create an application in Thinkwise which uses an Oracle as underlying database.
The following configuration is used:

- Model:
  RDBMS type: Oracle
- Runtime configuration:
  Database:
    Server name: <server-name>\<pdb-name>:1521
    Database: THINKWISE
    Pool credentials:
      User: THINKWISE
      Password: <password of user THINKWISE>
      

On creating the Execute Sourcecode gives errors.
Connection to the database is successful and the software factory identifies that the schema exists and will skip the db step. So far so good.
But when executing all code files the 'indexes' and 'procedures' steps fail:

Index step:

An unknown error occurred while executing '/* drop all indexes */
declare 
  v_index_name      varchar2(255);
  cursor drop_objects is
  select i.index_name
    from all_indexes i 
   where i.owner = (select sys_context('userenv', 'current_schema') from dual)
     and not exists (select 1 -- bij het aanmaken van een pk kolom wordt automatisch een index aangemaakt die niet verwijderd mag worden.
                       from all_constraints c
                      where c.constraint_name = i.index_name
                        and c.constraint_type = 'P'
                        and c.owner = (select sys_context('userenv', 'current_schema') from dual));

begin
   open drop_objects;   
   fetch drop_objects into v_index_name;

   while drop_objects%found
   loop

      execute immediate 'drop index ' || v_index_name; -- || 'purge';
      fetch drop_objects into v_index_name;

   end loop;

   close drop_objects;
end;'. 

Error: 'ORA-01418: specified index does not exist
ORA-06512: at line 21'.

 


The procedures step fails with:

An unknown error occurred while executing '
   --control_proc_id:      ora_tsf_set_session_variable
   --template_id:          grant_session_execute
   --prog_object_item_id:  grant_session_execute
   --template_description: Grant session execution rights to the current schema and add the session_vars context, assigning it to the tsf_set_session_variable procedure.
   
   declare 
       v_grant_cmd varchar2(100);
   begin
   
       select 'grant execute on sys.dbms_session to ' || sys_context('userenv','current_schema') 
       into v_grant_cmd
       from dual;
   
       execute immediate v_grant_cmd;
   end;'. 

Error: 'ORA-01749: Cannot GRANT or REVOKE privileges to or from yourself.
ORA-06512: at line 15'.

--------------------------------------------------------------------------------------------------

An unknown error occurred while executing '   
   create or replace context session_vars using tsf_set_session_variable'. 

Error: 'ORA-01031: insufficient privileges
ORA-41725: User "THINKWISE" lacks CREATE ANY CONTEXT privilege'.

These look like different issues here:
1) An index is dropped which doesn't exist (which seems correct because the schema is empty)
2) The user THINKWISE has not the proper privileges in Oracle.

Now our questions:
a) How can we resolve the error regarding the non-existent index?
b) Which privileges should the schema owner need when using Oracle as database?
In our case the DBA will create a schema for our application but won't, offcourse, give us sysdba privileges.

Be the first to reply!

Reply