Database 12.1.0.1.0
Application Express 5.0.0.00.31
Hi all,
I have a packaged procedure that exports APEX workspaces and applications. The procedure works form SQL*Plus but NOT when it is run by the scheduler. It works with Database 12.1.0.1.0 and Application Express 4.2.6.00.03 from SQL*Plus AND when it is run by the scheduler.
The following code snippet fails with: ORA-20987: APEX - User ADMIN requires ADMIN privilege to perform this operation.
APEX_UTIL.SET_SECURITY_GROUP_ID(r1.workspace_id);
APEX_CUSTOM_AUTH.SET_USER(get_workspace_admin(p_workspace_id => r1.workspace_id));
lv_clob := wwv_flow_utilities.export_workspace_to_clob(p_workspace_id => r1.workspace_id,
p_include_team_development => TRUE,
p_minimal => FALSE);
The following code snippet fails with: ORA-20987: APEX - Websheet application 10000 not found logged in as database user APEX_PUBLIC_USER.
Note: Application 10000 is not a Websheet application.
APEX_UTIL.SET_SECURITY_GROUP_ID(r1.workspace_id);
APEX_CUSTOM_AUTH.SET_USER(get_workspace_admin(p_workspace_id => r1.workspace_id))
lv_clob := wwv_flow_utilities.export_application_to_clob(p_application_id => apps_array(i),
p_export_ir_public_reports => 'Y',
p_export_ir_private_reports => 'Y',
p_export_ir_notifications => 'Y',
p_export_translations => 'Y');
Has anything changed with wwv_flow_utilities that would cause this? I have searched for hours but have not found anything yet.
Any help would be greatly appreciated.
Regards, Garry Lawton
Additional info:
When the job is scheduled from an APEX app the procedure runs with SYS_CONTEXT ('USERENV', 'SESSION_USER') = APEX_PUBLIC_USER
Both of the above errors occur.
When the job is scheduled using SQL*Plus the procedure runs with SYS_CONTEXT ('USERENV', 'SESSION_USER') = SQL*Plus user (the procedure's owner)
The first error occurs (wwv_flow_utilities.export_workspace_to_clob)but NOT the second (wwv_flow_utilities.export_application_to_clob)
Regards, Garry