Getting errors ORA-31603, ORA-06512 when generating DDL for view
When I am trying to get DDL for view owner by other user using DBMS_METADATA.GET_DDL, it is giving errors
ERROR:
ORA-31603: object "V1" of type VIEW not found in schema "USER1"
ORA-06512: at "SYS.DBMS_SYS_ERROR", line 105
ORA-06512: at "SYS.DBMS_METADATA", line 3912
ORA-06512: at "SYS.DBMS_METADATA", line 5678
ORA-06512: at line 1
This can be reproduced with a simple test case (I can reproduce it on both 10.2 and 11.2)
SQL> create user user1 identified by password1;
User created.
SQL> grant connect, resource to user1;
Grant succeeded.
SQL> grant create view to user1;
Grant succeeded.
SQL> create user user2 identified by password2;
ORA-31603: object "V1" of type VIEW not found in schema "USER1"
ORA-06512: at "SYS.DBMS_SYS_ERROR", line 105
ORA-06512: at "SYS.DBMS_METADATA", line 3912
ORA-06512: at "SYS.DBMS_METADATA", line 5678
ORA-06512: at line 1
This can be reproduced with a simple test case (I can reproduce it on both 10.2 and 11.2)
SQL> create user user1 identified by password1;
User created.
SQL> grant connect, resource to user1;
Grant succeeded.
SQL> grant create view to user1;
Grant succeeded.
SQL> create user user2 identified by password2;
0