【问题标题】:Restore plain text postgresql using batch file使用批处理文件恢复纯文本 postgresql
【发布时间】:2015-05-06 18:51:10
【问题描述】:

我想恢复一个普通的 postgres 备份,我使用以下命令通过 psql.exe 进行:

cd "C:\Program Files (x86)\PostgreSQL\9.0\bin\" <br>
psql -h 192.168.10.160 -p 5432 db_name postgres

然后 cmd 显示 db_name=# ,然后我输入 \i 'C:/Backup.sql' 并完成还原

有没有办法使用批处理文件来做到这一点?

【问题讨论】:

标签: database postgresql batch-file restore psql


【解决方案1】:

是的,使用-f 选项从文件中读取:

psql -h 192.168.10.160 -p 5432 -f C:\Backup.sql db_name postgres 

【讨论】:

    【解决方案2】:

    当我这样做时,我将 pgdump 设置为在所有创建表之前将数据库名称包含在 sql 中

    \连接我的数据库名称

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2022-10-18
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-01-01
      相关资源
      最近更新 更多