提取文件时发生了错误(在gpg递减.gpg文件为.dump文件之后)

发布于 2025-02-12 00:24:41 字数 963 浏览 0 评论 0原文

我有一个Postgres数据库备份,加密并保存为.gpg文件。我正在努力提取/使用.dump文件。

我最初尝试使用此命令将其解密:

gpg --decrypt --output /home/jimmythecode/Downloads/db_backup /home/jimmythecode/Downloads/heroku-backup-2022-05-05_07.00.gpg

gpg似乎已经接受了我的加密密码/秘密,并在下载文件夹中创建了一个压缩db_backup文件 - 但是当我时打开并尝试提取pg_backup.dump db_backup文件我获取错误:提取文件时发生了错误

我已经在终端中运行了命令文件db_backup。它返回:

db_backup: gzip compressed data, was "pg_backup.dump", last modified: Thu May  5 07:00:35 2022, from Unix, original size modulo 2^32 332380

因此,由于它是gzip文件,因此我尝试使用命令:gunzip db_backup。但这会返回:

gzip: db_backup: unknown suffix -- ignored

如果我尝试输入命令gunzip db_backup.gzipgunzip db_backup.gz我得到:

gzip: db_backup.gz: No such file or directory

I have a postgres database backed up, encrypted, and saved as a .gpg file. I'm struggling to extract/use the .dump file.

I've initially tried decrypting it with this command:

gpg --decrypt --output /home/jimmythecode/Downloads/db_backup /home/jimmythecode/Downloads/heroku-backup-2022-05-05_07.00.gpg

gpg seems to have accepted my encryption passphrase/secret and has created a compressed db_backup file in my downloads folder - but when I open and try to extract the pg_backup.dump contained within the db_backup file I get the error: An error occurred while extracting files.

I've ran the command file db_backup in my terminal. It returns:

db_backup: gzip compressed data, was "pg_backup.dump", last modified: Thu May  5 07:00:35 2022, from Unix, original size modulo 2^32 332380

So, since it's a gzip file, I've tried using the command: gunzip db_backup. But this returns:

gzip: db_backup: unknown suffix -- ignored

If I try entering the commands gunzip db_backup.gzip or gunzip db_backup.gz I get:

gzip: db_backup.gz: No such file or directory

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

深巷少女 2025-02-19 00:24:41

我从来没有发现上述可能。我找到了一个替代方案,它是创建.sql而不是.dump文件:

gpg --batch --yes --passphrase=<MY PASSPHRASE> -d /home/jimmythecode/Downloads/heroku-backup-2022-05-05_07.00.gpg | gunzip --to-stdout > backup.sql

然后,我创建了一个名为June> June30 -Test的数据库,并在我的终端中执行了以下行:

pg_restore -U postgres -d june30test -1 /home/jimmythecode/Downloads/backup.sql -x --no-owner

数据库现在已恢复。

I never found out if the above is possible. I've found an alternative, which is to create a .SQL rather than a .dump file:

gpg --batch --yes --passphrase=<MY PASSPHRASE> -d /home/jimmythecode/Downloads/heroku-backup-2022-05-05_07.00.gpg | gunzip --to-stdout > backup.sql

I then created a database called june30test and executed the following line in my terminal:

pg_restore -U postgres -d june30test -1 /home/jimmythecode/Downloads/backup.sql -x --no-owner

The database is now restored.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文