Dbms_Stats.gather_schema_stats is throwing an error while executing it in named Procedure.
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