我可以选择性创建Postgres数据库的备份,只有certian表吗? [英] Can I selectively create a backup of Postgres database, with only certian tables?

查看:240
本文介绍了我可以选择性创建Postgres数据库的备份,只有certian表吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我可以编程(或任何方式工作正常)创建数据库的备份,只有我想要的表?我在我的数据库中有大约100个表,我只需要10个表备份(所有都是相互依赖的)。我该如何实现呢?和我的方式,我有一个postgresql数据库。

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.

推荐答案

pg_dump 可让您传递参数<$ c $的表格列表c> -t

清除一些疑问。 True, -t 参数只接受一个模式。但它是一个模式非常类似于正则表达式,所以如果你想转储表A,B& C可以:

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)' 

这篇关于我可以选择性创建Postgres数据库的备份,只有certian表吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆