Tips--如何导出导入统计信息

上一篇 / 下一篇  2007-11-19 00:00:00

有很多时候我们不方便在数据量很大的数据库做分析,这样可能会在测试库上做完分析后把统计信息应用到生产库中去.我们可以用下面的脚本来实现:
--1.create a table for storage the statistics information
EXEC DBMS_STATS.create_stat_table('SYSTEM','STATS_TABLE');
--2. Gather the statistics information
EXEC DBMS_STATS.gather_schema_stats('TEST');
--3. Confirm statistics information
select * from DBA_TABLES
WHERE OWNER='TEST';
--4. Export the statistics information to table STATS_TABLE
EXEC DBMS_STATS.export_schema_stats('TEST','STATS_TABLE',NULL,'SYSTEM');
--5. Check the statistics information
SELECT * FROM SYSTEM.STATS_TABLE;
--6. Delete the statistics information
EXEC DBMS_STATS.delete_schema_stats('TEST');
--7. Check the statistics information is exist or not
select * from DBA_TABLES
WHERE OWNER='TEST';
--8. Import the statistics information
EXEC DBMS_STATS.import_schema_stats('TEST','STATS_TABLE',NULL,'SYSTEM');
--9. Check the statistics
select * from DBA_TABLES
WHERE OWNER='TEST';
--10. Drop the statistics table
EXEC DBMS_STATS.drop_stat_table('system','STATS_TABLE');

TAG:

 

评分:0

我来说两句

显示全部

:loveliness: :handshake :victory: :funk: :time: :kiss: :call: :hug: :lol :'( :Q :L ;P :$ :P :o :@ :D :( :)

日历

« 2008-08-30  
     12
3456789
10111213141516
17181920212223
24252627282930
31      

我的存档

数据统计

  • 访问量: 3459
  • 日志数: 583
  • 建立时间: 2007-12-10
  • 更新时间: 2007-12-12

RSS订阅

Open Toolbar