I am using 11g Release 11.2.0.1.0 - 64bit Production
and am logged in as SYS as SYSDBA.
I am attempting to extract the DDL for tables in several schemas. Each schema name begins with 'JOB_' and I am using this as a filtering condition.
The following sql
yields the following error
I have googled and found that this is a known bug. A search of the knowledge base on MOS reveals the "solution" to be
Since I am logged in as SYS, I am surprised to have any problems, as the oracle note above explicitly says that the procedure works fine from SYS.
I have also granted SELECT_CATALOG_ROLE to the user experiencing the problem, but this has had no effect.
Can anyone assist?
Regards
T
and am logged in as SYS as SYSDBA.
I am attempting to extract the DDL for tables in several schemas. Each schema name begins with 'JOB_' and I am using this as a filtering condition.
The following sql
Code:
SELECT DBMS_METADATA.GET_DDL('TABLE',table_name) DDL_STRING,OWNER,table_name
FROM ALL_TABLES
WHERE SUBSTR(OWNER,1,4) = 'JOB_'
AND OWNER != 'SYS'
AND SUBSTR(table_name,1,3) != ('MV_') --Ignore materialized views
AND table_name NOT LIKE ('%$%') --Ignore materialized view logs
AND table_name NOT IN (SELECT MVIEW_NAME
FROM ALL_MVIEWS
WHERE SUBSTR(OWNER,1,4)= 'JOB_')
ORDER BY OWNER,table_name;
yields the following error
Code:
ORA-31603: object "CURRICULUM_DETAIL" of type TABLE not found in schema "SYS"
ORA-06512: at "SYS.DBMS_METADATA", line 2625
ORA-06512: at "SYS.DBMS_METADATA", line 2668
ORA-06512: at "SYS.DBMS_METADATA", line 2983
ORA-06512: at "SYS.DBMS_METADATA", line 3897
I have googled and found that this is a known bug. A search of the knowledge base on MOS reveals the "solution" to be
Code:
Cause
The appropriate privileges have not been granted to the schema executing the procedure as the same procedure works fine from the schema that owns the object and from SYS.
Solution
Step 1: Execute "GRANT SELECT_CATALOG_ROLE TO <schema>;" as SYS or another user with the privilege.
Step 2. Modify the procedure to include "AUTHID CURRENT_USER"
Since I am logged in as SYS, I am surprised to have any problems, as the oracle note above explicitly says that the procedure works fine from SYS.
I have also granted SELECT_CATALOG_ROLE to the user experiencing the problem, but this has had no effect.
Can anyone assist?
Regards
T