PostgreSQL转储/还原 [英] PostgreSQL dump/restore

查看:95
本文介绍了PostgreSQL转储/还原的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我不想在转储中整个表 ,但只表中的某些记录文件,以后又还原相同。

PS:我想对数据库中的 1个表执行相同的操作而是将其转储到单个文件中。

这可能吗?如果是,那我该怎么办?

I don't want to Dump the entire table but only certain records in a table in my dump file and later restore the same.
P.S.: I want to do the same for more than 1 table in my database but dump it in a single file.
Is this possible? If yes then how do i go about it?

预先感谢。

推荐答案

正如@Pondlife在他的答案中提到的那样,必须使用 COPY 命令,但是并没有解决我将所有转储数据都放入一个文件的问题。

因此,从 Craig Ringer 给出的想法出发,为每个表制作了单独的文件,并得到了所有
的文件都压缩为一个存档文件。

为了还原未压缩的存档,以生成单个文件,以后再使用它们来还原表。

As @Pondlife mentioned in his answer had to use COPY command but did not solve my Problem of getting all the dump data into a single file.
So from the idea given by Craig Ringer made individual files for each table and got all the files compressed into a single archive file.
For restore uncompressed the archive to generate individual files later used them to restore the Tables.

必须回答我自己的问题,这样可能会对某人有所帮助。

Had to answer my own question so it might help somebody.

这篇关于PostgreSQL转储/还原的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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