My Oracle Support Banner

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

Last updated on AUGUST 04, 2018

Applies to:

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


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;

  d1 := ('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);

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.


You newly set the event:

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

to trace the DM/DW processes.


To view full details, sign in with your My Oracle Support account.

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

In this Document

My Oracle Support provides customers with access to over a million knowledge articles and a vibrant support community of peers and Oracle experts.