我在增量备份期间使用 WHM 备份了所有 PostgreSQL 数据库,这会创建一个 $dbName。tar文件。
数据存储在这些 .tar 文件中,但我不知道如何通过 SSH 将其恢复到各个数据库中。特别是文件位置。
我一直在使用:
pg_restore -d client03 /backup/cpbackup/daily/client03/psql/client03.tar
Run Code Online (Sandbox Code Playgroud)
产生错误“无法打开输入文件:权限被拒绝”
任何帮助表示赞赏。
Ste*_*hen 33
找到正确的代码字符串,以防其他人找到此线程。
pg_restore -c -U postgres -d client03 -v "/tmp/client03.tar" -W
Run Code Online (Sandbox Code Playgroud)
故障来自http://www.postgresql.org/docs/7.3/static/app-pgrestore.html和一些反复试验。
本质上...
-c to clean the database
-U to force a user
-d to select the database
-v verbose mode, don't know why
"$$" the location of the files to import in tmp to get around permission issues
-W to force asking for the password to the user (postgres)
Run Code Online (Sandbox Code Playgroud)
希望以上帮助别人。
我不确定它可以导入 .tar 文件。我会做一个
tar -zxvf client03.tar
Run Code Online (Sandbox Code Playgroud)
提取文件中的所有内容,然后再次尝试 pg_restore。我知道 pg_restore 有效,因为我们有与裸机恢复相同的恢复方法。
| 归档时间: |
|
| 查看次数: |
72363 次 |
| 最近记录: |