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: