解决统计表行数与All_Tables(Dba_Tables)对应表的Num_Rows不一致的问题
2017-03-29 21:31
323 查看
我们在使用ORACLE中,有时要将表中数据导出。当常常发现统计表行数与All_Tables(Dba_Tables)对应表的Num_Rows的值不一致。这是因为没有采用analyze分析表的缘故。
可在sqlplus中采用下面第1条语句,重新对表进行分析统计即可。后面2条语句是对表的索引记录重新分析统计和清除。
解决如下:
1)select ‘ analyze table ‘ || A.TABLE_NAME ||’ compute statistics;’ from all_tables A where A.OWNER=’用户名’;
2)select ‘ analyze table ‘ || A.TABLE_NAME | |’ compute statistics for all indexes;’ from all_tables A where A.OWNER=’用户名”;
3)select ‘ analyze table ‘ || A.TABLE_NAME || ‘ delete statistics ;’ from all_tables A where A.OWNER=’用户名”;
例如:
1)select ‘ analyze table ‘ || A.TABLE_NAME || ‘ compute statistics;’ from all_tables A where A.OWNER=’JZUSER’;
2)select ‘ analyze table ‘ || A.TABLE_NAME | |’ compute statistics for all indexes;’ from all_tables A where A.OWNER=’JZUSER’;
3)select ‘ analyze table ‘ || A.TABLE_NAME || ‘ delete statistics ;’ from all_tables A where A.OWNER=’JZUSER’;
将以上三条语句查询出来的结果,分别拷贝并粘贴至sqlplus中执行,然后重新执行
select * from all_tables A where A.OWNER=’用户名’ and A.NUM_ROWS > 0
例如:select * from all_tables A where A.OWNER=’JZUSER’ and A.NUM_ROWS > 0
可在sqlplus中采用下面第1条语句,重新对表进行分析统计即可。后面2条语句是对表的索引记录重新分析统计和清除。
解决如下:
1)select ‘ analyze table ‘ || A.TABLE_NAME ||’ compute statistics;’ from all_tables A where A.OWNER=’用户名’;
2)select ‘ analyze table ‘ || A.TABLE_NAME | |’ compute statistics for all indexes;’ from all_tables A where A.OWNER=’用户名”;
3)select ‘ analyze table ‘ || A.TABLE_NAME || ‘ delete statistics ;’ from all_tables A where A.OWNER=’用户名”;
例如:
1)select ‘ analyze table ‘ || A.TABLE_NAME || ‘ compute statistics;’ from all_tables A where A.OWNER=’JZUSER’;
2)select ‘ analyze table ‘ || A.TABLE_NAME | |’ compute statistics for all indexes;’ from all_tables A where A.OWNER=’JZUSER’;
3)select ‘ analyze table ‘ || A.TABLE_NAME || ‘ delete statistics ;’ from all_tables A where A.OWNER=’JZUSER’;
将以上三条语句查询出来的结果,分别拷贝并粘贴至sqlplus中执行,然后重新执行
select * from all_tables A where A.OWNER=’用户名’ and A.NUM_ROWS > 0
例如:select * from all_tables A where A.OWNER=’JZUSER’ and A.NUM_ROWS > 0
相关文章推荐
- Sybase IQ: All buffer cache pages are in use, ask your DBA to increase问题解决
- dba_tables表中的num_rows与count(*)的值为何不同
- OLEDB方式操作规则EXCEL的字符串的完整写法(解决标题行和列数据类型不一致的问题)
- ORACEL中使用IMP出现的表空间不一致的问题暂时解决办法
- 彻底解决ASP.NET MD5加密中文结果和ASP不一致的问题
- 成功解决blog搬家后地址不对应的问题
- 大型网站架构不得不考虑的10个问题(续 相对应的解决方法)
- 分享:用PreRender解决DataGrid分页最后一页行数不满的排版问题
- session验证码不一致[不同步]【问题解决】(
- 今天解决了一个问题:GDI库版本不一致
- 解决密码框和文本框长度不一致的问题
- erwin unable to find all oracle library functions 问题解决
- 转载:解决指定域的名称或安全标识SID与该域的信任信息不一致问题
- 解决指定域的名称或安全标识SID与该域的信任信息不一致问题
- 彻底解决ASP.NET MD5加密中文结果和ASP不一致的问题
- Java编程中前后台页面编码不一致问题的解决方法
- (原)航运售票系统物理票号与流水号一致存在的问题与解决办法
- union all 和union 的区别,如何让union 排序问题解决
- WPF学习心得(1):WPF进行动画后不能改变相对应的属性问题的解决
- "未能在sysindexes 中找到数据库ID7中对象ID1中的索引ID1对应的行"问题之解决