ORA-31050: Access Denied Trying to Create a Resource in XDB Repository (Doc ID 762425.1)

Last updated on FEBRUARY 20, 2012

Applies to:

Oracle Server - Enterprise Edition - Version: 10.2.0.1 to 11.1.0.6 - Release: 10.2 to 11.1
Information in this document applies to any platform.
Checked for relevance on 21-Feb-2012

Symptoms

When trying to create a resource in a folder which is owned by another user, it fails with error when done in a PL/SQL procedure, even if the XDBADMIN role has been granted.

create or replace procedure test is
  retb BOOLEAN;
BEGIN
  retb := DBMS_XDB.createresource('/common/new.xml',
                                  '<emp_name>Selby</emp_name>');
  commit;
END;
/
Procedure created.

execute test
*
ERROR at line 1:
ORA-31050: Access denied
ORA-6512: at "XDB.DBMS_XDB", line 73
ORA-6512: at "TESTUSER.TEST", line 4
ORA-6512: at line 1


Changes

The error only occurs when trying to create a resource in a PL/SQL procedure. Creating the resource in SQL*Plus directly works:

DECLARE
  retb BOOLEAN;
BEGIN
  retb := DBMS_XDB.createresource('/common/new2.xml',
                                  '<emp_name>selby</emp_name>');
  commit;
END;
/
PL/SQL procedure successfully completed.

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