Translate into your own language

Sunday, July 22, 2018

Script to get row count of all tables in a schema

***************************************************
script to get row count of all tables in a schema
***************************************************
#!/bin/csh
            sqlplus -s <<EOF
username/password 
spool tablecount.log
select
      table_name,
      to_number(
        extractvalue(
          xmltype(dbms_xmlgen.getxml(‘select count(*) c from ‘||table_name))
          ,’/ROWSET/ROW/C’)
          )
          count
    from user_tables order by table_name;
spool off
        exit
EOF

No comments:

Post a Comment