Statistics for all table records in Oracle ____oracle

Source: Internet
Author: User

http://space.itpub.net/7104/viewspace-133950

Statistics of records for all tables in Oracle

CREATE TABLE A
(
USERNAME VARCHAR2 (20),
TableName VARCHAR2 (50),
JS VARCHAR2 (10)
)

Create or replace procedure P_getcount
As
Micount INTEGER;
T_owner VARCHAR2 (40);
T_table VARCHAR2 (40);
BEGIN
For C_tab in (SELECT owner,table_name to Dba_tables where owner not in (' SYS ', ' SYSTEM ', ' Ctxsys ', ' perfstat ', ' Wmsys ', ' exf ') SYS ', ' Sysman ') LOOP
--dbms_output.put_line (' Select COUNT (*) from ' | | | c_tab.owner| | '. ' | | C_tab.table_name | | '');
--dbms_output.put_line (c_tab.owner| | | C_tab.table_name);
T_owner: = C_tab.owner;
T_table: = C_tab.table_name;
EXECUTE IMMEDIATE ' SELECT COUNT (*) from ' | | c_tab.owner| | ' | | | c_tab.table_name| | ' "' | | ' Into Micount;
--dbms_output.put_line (Rpad (c_tab.table_name,30, '. ') | | lpad (micount,10, '. '));
INSERT into A VALUES (c_tab. Owner,c_tab. Table_name,micount);


End LOOP;

EXCEPTION
When others THEN
Dbms_output.put_line (t_owner| | | t_table);
RAISE;
Commit
End

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.