pg_dump导出

导出postgresql pg_dump -U your_username -h your_host -d your_database -t your_table > dump_file.sql

  • export.sh
    #!/bin/bash
    PGPASSWORD=password pg_dump -U root -h 127.0.0.1 -d db -t $1 --column-inserts > /tmp/migrate_db/$1.sql
    
  • for_export.sh
    #!/bin/bash
    my_array=("table_a" "table_b")
    
    
    for item in "${my_array[@]}"; do
        ./export.sh "$item"
    done
    

你可能感兴趣的:(postgreSQL,postgresql)