pg_dump备份多张表到不同的sql文件

  1. pg_dump 备份多张表到同一个文件
PGPASSWORD='password' pg_dump -t 'thr_*' -t ellll -d dbName -U userName > /tmp/db_dump.sql

上面命令将所有以thr开头的表以及ellll表备份到sql文件
2. pg_dump备份多张表到不同文件

for table in public.haha public.test; do PGPASSWORD='haha' pg_dump -t $table -U username -d postgres --data-only --inserts > /tmp/$table.sql; done;

你可能感兴趣的:(postgresql,数据库,postgresql)