Ask the Expert

Using DBMS_STATS to generate statistics in Oracle 10g

I need to know the best way to generate statistics within a database (Oracle 10g 10.1.0.5). I read that using DBMS_STATS is better than using compute command. So, I need the exact syntax to do it. Thanks.

    Requires Free Membership to View

If you are using Oracle 9i or 10g, then DBMS_STATS is the only way to go to generate optimizer statistics. You can generate statistics for your entire database with the following in SQL*Plus:
exec dbms_stats.gather_database_stats(estimate_percent=>
DBMS_STATS.AUTO_SAMPLE_SIZE);
There are other gather programs as well. They are all documented here.

This was first published in May 2007

There are Comments. Add yours.

 
TIP: Want to include a code block in your comment? Use <pre> or <code> tags around the desired text. Ex: <code>insert code</code>

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
Sort by: OldestNewest

Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to: