11.07.2015 Views

Oracle Database 11 g - Online Public Access Catalog

Oracle Database 11 g - Online Public Access Catalog

Oracle Database 11 g - Online Public Access Catalog

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

202 CHAPTER 4 ■ PERFORMANCE MANAGEMENTYou can monitor expression statistics with the DBA_STAT_EXTENSION view, and you candrop the extension statistics from a table with the drop_extended_statistics function of theDBMS_STATS package.Changing Statistics PreferencesIn <strong>Oracle</strong> <strong>Database</strong> 10g, you used the DBMS_STATS package’s GET_PARAM function to return thedefault values of parameters for several procedures that belong to the DBMS_STATS package. TheGET_PARAM procedure is obsolete in <strong>Oracle</strong> <strong>Database</strong> <strong>11</strong>g. Instead, there is a more powerful newfunction called GET_PREFS, which will get you the default values of various preferences. TheGET_PREFS function has parameters such as cascade, degree, estimate_percent, granularity,publish, and stale_percent, each of which is called a preference. Here’s an example of how youcan use the get_prefs function to get the preferences for a certain parameter, in this case thestale_percent parameter:SQL> select dbms_stats.get_prefs('stale_percent','sh','product_descriptions')stale_percent from dual;STALE_PERCENT------------------------20If you provide the schema, the table name, and a preference, the previous function willreturn the values specified for that table. If you don’t specify any values for that table, the functionwill return the global preference, if you specified one. If you don’t specify either a globalpreference or a table specific preference, the function will return the default values for thatpreference.Setting PreferencesThe set_param procedure that enabled you to set default parameter values for various DBMS_STAT procedures in the previous version of the <strong>Oracle</strong> database is now obsolete. Instead, thereis a new procedure, set_global_prefs, that lets you set global statistics preferences for thevarious parameters. You need the sysdba privilege to set global preferences using the set_global_prefs procedure.The following example shows how to use the set_global_prefs procedure:SQL>exec dbms_stats.set_global_prefs('estimate_percent','70');PL/SQL procedure successfully completed.SQL>Confirm the change in the estimate_percent parameter’s value in the table product_descriptions by using the following query:

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!