ORA-31631 During Export Using DataPump API (Doc ID 1053432.1)

Last updated on NOVEMBER 28, 2016

Applies to:

Oracle Database - Enterprise Edition - Version 10.1.0.2 to 11.2.0.3 [Release 10.1 to 11.2]
Information in this document applies to any platform.
***Checked for relevance on 18-APR-2013***

Symptoms

You created a user (ASDBA) and granted the roles CONNECT, RESOURCE, EXP_FULL_DATABASE and IMP_FULL_DATABASE to that user.

Then, as user ASDBA, you created the following procedure that uses DataPump API to export different database objects (in my example a schema):

create or replace procedure myexp as
   d1 number;

begin
  d1 := dbms_datapump.open ('EXPORT', 'SCHEMA');
  dbms_datapump.add_file (d1, 'test.dmp', 'DPU');
  dbms_datapump.add_file (d1, 'test.log', 'DPU', NULL, DBMS_DATAPUMP.KU$_FILE_TYPE_LOG_FILE);
  dbms_datapump.metadata_filter (d1, 'SCHEMA_EXPR', 'IN (''TEST'')');
  dbms_datapump.start_job (d1);
  dbms_datapump.detach (d1);
end;
/

When you start the procedure, the following errors are raised:

SQL> exec myexp;
BEGIN myexp; END;

*
ERROR at line 1:
ORA-31631: privileges are required
ORA-06512: at "SYS.KUPF$FILE", line 7266
ORA-06512: at "SYS.KUPP$PROC", line 644
ORA-06512: at "SYS.DBMS_DATAPUMP", line 1032
ORA-06512: at "SYS.DBMS_DATAPUMP", line 4631
ORA-06512: at "ASDBA.MYEXP", line 5
ORA-06512: at line 1

The errors occur during the call to DBMS_DATAPUMP.OPEN.

Changes

You newly set the event:

alter system set events '39089 trace name context forever, level 0x480300';

to trace the DM/DW processes.

Cause

Sign In with your My Oracle Support account

Don't have a My Oracle Support account? Click to get started

My Oracle Support provides customers with access to over a
Million Knowledge Articles and hundreds of Community platforms