Home » RDBMS Server » Performance Tuning » Gathering statistics with different size parameter
Gathering statistics with different size parameter [message #173599] Tue, 23 May 2006 06:43 Go to next message
kumarsz
Messages: 180
Registered: March 2005
Location: canada
Senior Member
Hi,
I am using - Oracle9i Enterprise Edition Release 9.2.0.7.0 - Production
i want to create a generic script for gathering statistics of all tables and indexes.
So that i can create a scheduled job using it.

However, if i create procedure like the following one, it will create histograms with same number of buckets (e.g. 250 here).
If a table is having primary key then its statistics will be hampered with this method (fixed "size")of statistics.
Please suggest, how to make it dynamic?

Procedure i have created is as follows:
CREATE OR REPLACE PROCEDURE table_stats
AS
BEGIN
FOR c_tbl_nm IN (SELECT table_name
FROM user_tables)
LOOP
DBMS_STATS.gather_table_stats
('HSASYS',
UPPER (c_tbl_nm.table_name),
method_opt => 'For all indexed columns size 250',
CASCADE => TRUE
);
END LOOP;
END;
/
Thanks in Advance,
Pratap
Re: Gathering statistics with different size parameter [message #173665 is a reply to message #173599] Tue, 23 May 2006 18:39 Go to previous messageGo to next message
BlackSwan
Messages: 26766
Registered: January 2009
Location: SoCal
Senior Member
>Please suggest, how to make it dynamic?
By using dynamic SQL or by using bind variable(s).
Re: Gathering statistics with different size parameter [message #173673 is a reply to message #173599] Tue, 23 May 2006 23:03 Go to previous message
kumarsz
Messages: 180
Registered: March 2005
Location: canada
Senior Member
Hi,
Thanks for Your Suggestion.
However,how if i want to create a job which will run in background from where the values for these bind variables will be assigned?

Thanks and Regards,
Pratap
Previous Topic: Error Using STATPACK
Next Topic: Update a new column in a Large Table
Goto Forum:
  


Current Time: Sat Nov 23 15:48:11 CST 2024