統計所有 Tables 的筆數

    版本為 08:22, 27 Nov 2024

    到這個版本。

    返回到 版本存檔.

    查閱目前版本

    gensql_count_tables.sh:

    #!/bin/bash
    # Author: A-Lang
    
    DB_USER="WIN_FDC_OFFLINE_STDB"
    DB_PASS="1234"
    
    get_tab_list (){
        sqlplus -s $DB_USER/$DB_PASS <<EOF
    SET PAGESIZE 0 FEEDBACK OFF VERIFY OFF HEADING OFF ECHO OFF
    SELECT t.table_name
    FROM user_tables t
    ORDER BY 1;
    EXIT;
    EOF
    }
    
    cat << EOF
    set heading off
    set feedback off
    set pagesize 0
    
    EOF
    
    get_tab_list | while read tab_name
    do
        echo "select '${DB_USER}.${tab_name} ' || count(*) from ${DB_USER}.${tab_name};"
        #echo $tab_name
    done
    
    echo
    echo "exit;"
    
    Powered by MindTouch Core