gpt4 book ai didi

database - 使用批处理文件恢复纯文本 postgresql

转载 作者:搜寻专家 更新时间:2023-10-30 20:38:39 26 4
gpt4 key购买 nike

我想恢复一个普通的 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' 恢复完成

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

最佳答案

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

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

关于database - 使用批处理文件恢复纯文本 postgresql,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30085205/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com