DBAsupport.com Forums - Powered by vBulletin
Results 1 to 4 of 4

Thread: dbms_stats????

  1. #1
    Join Date
    Mar 2008
    Posts
    21

    dbms_stats????

    hello, I am very new to this DBA position. But today i was told by other DBA to run this query which took forever.

    Exec dbms_stats.gather_database_stats

    Just wanted to know what exactly its doing or a little overview of that. Is it createing a report?? if so where can i go to read the report. And also i am using TOAD as my third party tool. Can you create a explain plan from TOAD. If so anybody who uses TOAD can please give me a way to get a explain plan for it. Thanks in advance.

  2. #2
    Join Date
    Aug 2007
    Location
    Cyberjaya,kuala lumpur
    Posts
    340
    DBMS_STATS
    The DBMS_STATS package was introduced in Oracle 8i and is Oracles preferred method of gathering object statistics. Oracle list a number of benefits to using it including parallel execution, long term storage of statistics and transfer of statistics between servers. Once again, it follows a similar format to the other methods:

    EXEC DBMS_STATS.gather_database_stats;
    EXEC DBMS_STATS.gather_database_stats(estimate_percent => 15);

    EXEC DBMS_STATS.gather_schema_stats('SCOTT');
    EXEC DBMS_STATS.gather_schema_stats('SCOTT', estimate_percent => 15);

    EXEC DBMS_STATS.gather_table_stats('SCOTT', 'EMPLOYEES');
    EXEC DBMS_STATS.gather_table_stats('SCOTT', 'EMPLOYEES', estimate_percent => 15);

    EXEC DBMS_STATS.gather_index_stats('SCOTT', 'EMPLOYEES_PK');
    EXEC DBMS_STATS.gather_index_stats('SCOTT', 'EMPLOYEES_PK', estimate_percent => 15);


    This package also gives you the ability to delete statistics:

    EXEC DBMS_STATS.delete_database_stats;
    EXEC DBMS_STATS.delete_schema_stats('SCOTT');
    EXEC DBMS_STATS.delete_table_stats('SCOTT', 'EMPLOYEES');
    EXEC DBMS_STATS.delete_index_stats('SCOTT', 'EMPLOYEES_PK');

  3. #3
    Join Date
    Mar 2002
    Location
    Mesa, Arizona
    Posts
    1,204
    Quote Originally Posted by kool_max
    ..today i was told by other DBA to run this query which took forever.

    Exec dbms_stats.gather_database_stats
    If he asks you to jump off a bridge, read the manual first.

    Bottom line, it's a package to manage the statistical information on database objects that determines how SQL is executed.

    I would think the Toad docs explain how to run explain plans. If you can, I'd suggest using sqlplus and plustrace.

    Cheers,
    Ken
    "I do not fear computers. I fear the lack of them." Isaac Asimov
    Oracle Scirpts DBA's need

  4. #4
    Join Date
    May 2000
    Location
    ATLANTA, GA, USA
    Posts
    3,135

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Click Here to Expand Forum to Full Width