微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

Oracle架构表行数

Oracle:11g操作系统:Linux

我有这个非常棘手的问题,我正在试图解决,但不能得到明确的答案…我search谷歌…等,但没有运气与我的要求…

模式统计是不可靠的,所以想要查询dba_tables ..也不想在数据库下创build任何程序或function..只是试图用简单的sql来实现。

问:如何后台处理特定模式的所有表行数并显示table_name?

bash:如何从文件提取数千个非连续的行

QTableView:如何将鼠标hover在整个行上?

cmd / c和文件path中的&符号

在法国的Windows服务器上使用django换行的问题

Windows上的PHP错误日志文件格式(PHP.ini error_log指令)

答:我可以很容易地在spool中显示计数,但不能在计数旁边得到表名。

例如

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

如何计算空格分隔文件中行数的总和?

是否有可能使VIM显示行数?

C – 删除已经打印的换行符

改变std :: endl放弃CR + LF而不是LF

如何检测一个文件是否有Unix换行符( n)或Windows换行符( r n)?

你可以使用这样的函数,但是它会很慢:

create or replace function get_rows( p_tname in varchar2 ) return number as l_columnValue number default NULL; begin execute immediate 'select count(*) from ' || p_tname INTO l_columnValue; return l_columnValue; end; / select user,table_name,get_rows( user||'.'||table_name) cnt from user_tables /

Tom Kyte网站上的这个答案的代码

http://asktom.oracle.com/pls/asktom/f?p=100:11:::::P11_QUESTION_ID:1660875645686

没有函数调用也是可能的:

select table_name,to_number( extractvalue( xmltype( dbms_xmlgen.getxml('select count(*) c from '||table_name)),'/ROWSET/ROW/C')) count from user_tables;

从这里提示

http://laurentschneider.com/wordpress/2007/04/how-do-i-store-the-counts-of-all-tables.html

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。

相关推荐