如何将二进制pgdump(压缩)转换为纯SQL文件? [英] How do I convert a binary pgdump (compressed) to a plain SQL file?

查看:278
本文介绍了如何将二进制pgdump(压缩)转换为纯SQL文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我确实想在数据库转储中搜索某些数据,但是这些转储使用的是二进制压缩格式( PGDMP 标头)。

I do want to search for some data inside a database dump but these dumps are using the binary-compressed format (PGDMP header).

如何在不恢复它们的情况下将它们转换为SQL?

How can I convert these to SQL without restoring them?

推荐答案

pg_restore ,在没有数据库名称的情况下运行时,将文本转储输出到stdout;您可以使用 -f 或通过I / O重定向将其发送到其他地方。

pg_restore, when run without a database name, outputs a text dump to stdout; you can send that elsewhere with -f or with I/O redirection.

pg_restore -f mydatabase.sql mydatabase.dump 

这篇关于如何将二进制pgdump(压缩)转换为纯SQL文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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