SQL> conn / as sysdba
Connected.
SQL> show user
USER is "SYS"
SQL> create user test2 identified by test2;
User created.
SQL> alter user test2 quota unlimited on users;
User altered.
SQL> grant create table, create session to test2;
Grant succeeded.
SQL> conn test2/test2
Connected.
SQL> show user
USER is "TEST2"
SQL> create table dummy (name varchar2(20));
Table created.
SQL> conn test/test
Connected.
SQL> show user
USER is "TEST"
SQL> exec dbms_stats.gather_schema_stats(ownname => 'TEST2',method_opt =>'for all columns size auto', estimate_percent=>100, cascade => true, options => 'gather auto');
BEGIN dbms_stats.gather_schema_stats(ownname => 'TEST2',method_opt =>'for all columns size auto', estimate_percent=>100, cascade => true, options => 'gather auto'); END;
*
ERROR at line 1:
ORA-20000: Insufficient privileges to analyze an object in Schema
ORA-06512: at "SYS.DBMS_STATS", line 18553
ORA-06512: at "SYS.DBMS_STATS", line 19009
ORA-06512: at "SYS.DBMS_STATS", line 19132
ORA-06512: at "SYS.DBMS_STATS", line 19088
ORA-06512: at line 1
Disclaimer: Advice is provided to the best of my knowledge but no implicit or explicit warranties are provided. Since the advisor explicitly encourages testing any and all suggestions on a test non-production environment advisor should not held liable or responsible for any actions taken based on the given advice.
Gathering stats on a non-owned schema requires 'analyze any" system privilege and also either 'select any' OR select on specific tables.
Yes, but here i am not granted any of these privileges to the user test and test1, but still they are able to gather the stats of the schema "WMEXT".
why it is happening ?
I guess that EXECUTE privilege on DBMS_STATS Oracle DB package is granted to PUBLIC. if yes, that is the reason why the new user test is also able to gather schema stats using the package.
Disclaimer: Advice is provided to the best of my knowledge but no implicit or explicit warranties are provided. Since the advisor explicitly encourages testing any and all suggestions on a test non-production environment advisor should not held liable or responsible for any actions taken based on the given advice.
I have logged SR with Oracle for the same and they have created bug# 12714396 with their development team, and Oracle BDE team is working on the issue now, i will update you all once i will get the feedback from Oracle support.
Database version is 11.1.0.7.0
OS is AIX
U can't find it, Oracle Development team is working on that, till now i am waiting for the update from Oracle :(
Bookmarks