分类: Oracle
2010-03-25 17:32:14
1.创建保存统计信息的表
exec DBMS_STATS.CREATE_STAT_TABLE (ownname=>'MAYJ',stattab=>'stattab');
2.导出test整个shcema的统计信息
SQL> exec DBMS_STATS.EXPORT_SCHEMA_STATS (ownname=>'DWADMIN',stattab=>'stattab',statid=>'f20100325',statown=>'MAYJ');
3.导出单个表的统计信息
exec DBMS_STATS.EXPORT_TABLE_STATS (ownname=>'DM',tabname=>'TMP_KGB_CUST2',STATTAB=>'stattab',statown=>'MAYJ');
4.导入单个表的统计信息
EXEC dbms_stats.import_table_stats(OWNNAME=>'DM',TABNAME=>'TMP_KGB_CUST2',STATTAB=>'stattab',statown=>'MAYJ');
5.导入整个schema的统计信息
exec DBMS_STATS.IMPORT_SCHEMA_STATS (ownname=>'test',,STATTAB=>'stattab',statown=>'MAYJ')