oracle的num_rows准确没,解决统计表行数与All_Tables(Dba_Tables)对应表的Num_Rows不一致的问题...

解决统计表行数与All_Tables(Dba_Tables)对应表的Num_Rows不一致的问题 .

我们在使用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

即可

  • 1
    点赞
  • 11
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值