Database Administration (MOSC)

MOSC Banner

Dbms_Stats.gather_schema_stats is throwing an error while executing it in named Procedure.

edited Jun 18, 2012 4:06PM in Database Administration (MOSC) 6 commentsAnswered
Gurus,

When i m executing the gather_schema_stats as anonymous block, It works but when i execute the same in named procedure it thows  an error..'ORA-27486: insufficient privileges'

this Works Fine ------------------------------------------------------------- 

BEGIN
  Dbms_Stats.gather_schema_stats(ownname=>'BSSAO_UAT12');
   ENd;
 ------------------------------------------------------------- ------------------

This thows an Error..------------------------------------------------------

SQL> show user;
USER is "BSSAO_UAT12"
SQL>    CREATE OR REPLACE PROCEDURE proc_2   AS
  2                      BEGIN
  3
  4                      Dbms_Stats.gather_schema_stats(ownname=>'BSSAO_UAT12');
  5                      ENd;
  6  /

Procedure created.

SQL> exec proc_2;
BEGIN proc_2; END;

*
ERROR at line 1:
ORA-27486: insufficient privileges
ORA-06512: at "SYS.DBMS_STATS", line 24867
ORA-06512: at "SYS.DBMS_STATS", line 24945

Howdy, Stranger!

Log In

To view full details, sign in to My Oracle Support Community.

Register

Don't have a My Oracle Support Community account? Click here to get started.

Category Leaderboard

Top contributors this month

New to My Oracle Support Community? Visit our Welcome Center

MOSC Help Center