The AskTOM team is taking a break over the holiday season, so we're not taking questions or responding to comments. Please have a happy and safe festive season and as always, thanks for being a member of the AskTOM community.
Thanks for the question, Jesica.
Asked: September 12, 2016 - 10:40 am UTC
Last updated: September 12, 2016 - 12:49 pm UTC
Version: 11.2.0.4.0
Viewed 10K+ times! This question is
To invoke this procedure you must be owner of the table, or you need the ANALYZE ANY privilege. For objects owned by SYS, you need to be either the owner of the table, or you need the ANALYZE ANY DICTIONARY privilege or the SYSDBA privilege.
conn hr/hr create or replace procedure gather_stats is begin dbms_stats.gather_table_stats('HR', 'EMPLOYEES'); end gather_stats; / grant select on hr.employees to scott; grant execute on gather_stats to scott; conn scott/scott exec hr.gather_stats; select last_analyzed, sysdate from all_tables where owner = 'HR' and table_name = 'EMPLOYEES'; LAST_ANALYZED SYSDATE 12-SEP-16 12-SEP-16
Check out more PL/SQL tutorials on our LiveSQL tool.
PL/SQL reference manual from the Oracle documentation library