为什么pg_restore的回报"选项-d / - dbname和-f / - 文件不能一起使用"? [英] Why does pg_restore return "options -d/--dbname and -f/--file cannot be used together"?
本文介绍了为什么pg_restore的回报"选项-d / - dbname和-f / - 文件不能一起使用"?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
下面的Windows批处理脚本上线失败,数据库还原:
@回响设置路径= C:\\ Program Files文件(86)
设置BACKUP_PATH = C:\\ Program Files文件(86)C:
CD \\
CD C:\\ Program Files文件(x86)的\\ PostgreSQL的\\ 9.1 \\ BIN@echo等等......
SETLOCAL
设置PGPASSWORD = 1234
psql.exe -U Postgres的-c创建数据库MYDATA
C:\\ Program Files文件(x86)的\\ PostgreSQL的\\ 9.1 \\ BIN \\ pg_restore.exe-h本地主机-U Postgres的-d MYDATA -fMydata.backup暂停
ENDLOCAL
该错误是:
pg_restore的:-d / - dbname和-f / - 文件不能一起使用
尝试pg_restore的--help
块引用>解决方案
-f
为输出文件名,而不是输入文件。输入文件没有任何参数开关。
C:\\> pg_restore的--help
那么pg_restore从pg_dump创建的备份恢复PostgreSQL数据库。用法:
pg_restore在[选项] ... [文件]常规选项:
-d,--dbname =名称连接到数据库名称
-f,--file = FILENAME输出文件名
-F,--format = C | D | Ts备份文件格式(应该是自动)
-l,--list打印总结归档的TOC
-v,--verbose详细模式
-V,--version输出版本信息,然后退出
- ?, --help显示此帮助,然后退出所以,你需要使用:
pg_restore.exe -h本地主机-U Postgres的-d MYDATAMydata.backup
在手册中的更多细节: HTTP://www.postgresql。组织/文档/电流/静态/ APP-pgrestore.html
The following Windows batch script fails on the line with database restore:
@Echo off set Path=C:\Program Files (x86) set Backup_Path=C:\Program Files (x86) c: cd \ cd C:\Program Files (x86)\PostgreSQL\9.1\bin @echo "Wait ..." setlocal set PGPASSWORD=1234 psql.exe -U postgres -c "create database Mydata" "C:\Program Files (x86)\PostgreSQL\9.1\bin\pg_restore.exe" -h localhost -U postgres -d Mydata -f "Mydata.backup" pause endlocal
The error is:
pg_restore : -d / - dbname and -f / - file can not be used together Try " pg_restore --help "
解决方案
-f
is the output filename, not the input file.The input file does not have any parameter switch.
c:\>pg_restore --help pg_restore restores a PostgreSQL database from an archive created by pg_dump. Usage: pg_restore [OPTION]... [FILE] General options: -d, --dbname=NAME connect to database name -f, --file=FILENAME output file name -F, --format=c|d|t backup file format (should be automatic) -l, --list print summarized TOC of the archive -v, --verbose verbose mode -V, --version output version information, then exit -?, --help show this help, then exit
So you need to use:
pg_restore.exe -h localhost -U postgres -d Mydata "Mydata.backup"
More details in the manual: http://www.postgresql.org/docs/current/static/app-pgrestore.html
这篇关于为什么pg_restore的回报"选项-d / - dbname和-f / - 文件不能一起使用"?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文