问题
Can I programatically(or whichever way works fine) create the backup of a database, with only the tables I want? I have around 100 tables in my database and I want only 10 tables backup(ofcourse all are interdependant). How can I achieve this? And by the way I have a postgresql database.
回答1:
Of course. pg_dump lets you pass list of tables with parameter -t
To clear some doubts. True, the -t
parameter accepts only one pattern. But it's a pattern very similar to regular expression, so if you want to dump tables A, B & C you can do:
pg_dump -t '(A|B|C)'
来源:https://stackoverflow.com/questions/602730/can-i-selectively-create-a-backup-of-postgres-database-with-only-certian-tables