Oracle:11g操作系统:Linux
我有这个非常棘手的问题,我试图解决,但无法得到明确的答案...我在谷歌等搜索但没有运气我的要求...
架构统计不可靠所以想查询dba_tables ..也不想在数据库下创建任何程序或函数..只是试图用简单的SQL实现 .
问:如何假脱特定模式的所有表行数并显示table_name?
答:我可以在假脱机中轻松显示计数,但不能在计数旁边获取表名 .
例如
Table_Name Count
tab1 200
tab2 500
tab3 300
在下面,我可以得到计数,但无法弄清楚结果中的table_name显示...
spool runme.sql
select 'select count(*) from '|| owner || '.' || table_name || ';'
from dba_tables
where owner = 'user1'
order by table_name;
spool off
1 回答
你可以使用这样的函数,但它会很慢:
Tom Kyte网站上的答案代码:
http://asktom.oracle.com/pls/asktom/f?p=100:11:::::P11_QUESTION_ID:1660875645686
Without a function call 它也有可能:
从这里的提示:
http://laurentschneider.com/wordpress/2007/04/how-do-i-store-the-counts-of-all-tables.html