1. Create the following procedure by changing the 'User Name'
CREATE OR REPLACE PROCEDURE analyze_tables IS
BEGIN
FOR syn_cur IN (SELECT table_name
FROM user_tables)
LOOP
DBMS_STATS.GATHER_TABLE_STATS(ownname => 'User Name',
tabname => syn_cur.TABLE_NAME,
estimate_percent => NULL,
cascade => TRUE);
END LOOP;
EXCEPTION
WHEN OTHERS THEN
null;
END analyze_tables;
2. Run the procedure as below
begin
-- Call the procedure
analyze_tables;
end;
That is it.
No comments:
Post a Comment