Step 2. SQL to generate and Run a Script to Check Row Count for each Table

  1. set feedback off
  2. set heading off
  3. Generate the SQL Script, called gen_script.sql ...
    spool gen_script.sql
    select TO_CHAR(SysDate,'DD/Mon/YYYY HH:MI P.M.') from dual;
    Change Table Owner as appropriate ...
    SELECT 'SELECT '||''''||Table_name||''''||', COUNT(*) FROM '||Table_Name||';'
    FROM all_tables WHERE owner='OPS$ORACLE';
    select TO_CHAR(SysDate,'DD/Mon/YYYY HH:MI P.M.') from dual;
    spool off
  4. Run the generated SQL Script and create output file.
  5. spool chk_num_rows.op
  6. start gen_script.sql
  7. spool off
  8. rem This completes the Job.
    [ Home Page | Search & Site Map | What's New ]