ITPub博客

首页 > Linux操作系统 > Linux操作系统 > Oracle database Statistics

Oracle database Statistics

原创 Linux操作系统 作者:licheng79 时间:2011-10-14 14:26:55 0 删除 编辑

DBA Notes: 2011/09/26

Cheng Li

 

Oracle database Statistics

 

Before database migration or upgrade, we should collect and restore database statistics to compare performance before and after image and track performance issue. 

 

–Collect database stats
EXEC DBMS_STATS.gather_database_stats;
EXEC DBMS_STATS.gather_database_stats(estimate_percent => 15);

–Collect schema stats
EXEC DBMS_STATS.gather_schema_stats(‘SCOTT’);
EXEC DBMS_STATS.gather_schema_stats(‘SCOTT’, estimate_percent => 15);

–Collect table stats
EXEC DBMS_STATS.gather_table_stats(‘SCOTT’, ‘EMPLOYEES’);
EXEC DBMS_STATS.gather_table_stats(‘SCOTT’, ‘EMPLOYEES’, estimate_percent => 15);

–collect index stats
EXEC DBMS_STATS.gather_index_stats(‘SCOTT’, ‘EMPLOYEES_PK’);
EXEC DBMS_STATS.gather_index_stats(‘SCOTT’, ‘EMPLOYEES_PK’, estimate_percent => 15);

–delete database stats
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’);

–-create stats table
begin
dbms_stats.create_stat_table(USER,stattab => ‘STAT_TABLE’);
end;

–-Export table stats
BEGIN
dbms_stats.export_table_stats(USER,tabname => ‘FEI_T’,stattab => ‘STAT_TABLE’);
END;

–-Delete table stats
BEGIN
DBMS_STATS.delete_table_stats(USER,tabname => ‘FEI_T’);
END;

–-Import table Stats
dbms_stats.IMPORT_TABLE_STATS(USER,’FEI_T’,stattab => ‘STAT_TABLE’);
END;

 

Reference:

http://www.xifenfei.com/1064.html

http://download.oracle.com/docs/cd/E14072_01/appdev.112/e10577/d_stats.htm#i997763

《生化危机》游戏里艾达·王.jpg

《生化危机》游戏里艾达·王2.jpg

来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/26136400/viewspace-709148/ ,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论

注册时间:2011-09-07

  • 博文量
    54
  • 访问量
    84441