postgresql dump - 无法使用它在新服务器上创建新数据库

时间:2013-11-14 21:42:28

标签: postgresql

我在现有数据库服务器上运行以下命令:

 pg_dump -C -U testuser testdb -h 127.0.0.1 -F t> testdbdump

现在我正在尝试在新服务器上创建此testdb。 我试图在新服务器上运行以下命令:

 pg_restore -h 127.0.0.1 testdbdump

我在新数据库服务器上创建了testuser角色。然后我也尝试了以下内容:

pg_restore -i -h 127.0.0.1 -p 5432 -U postgres "testdbdump"

psql template1 postgres -f testdbdump

它确实开始做一些事情,但我得到了一堆错误,包括:

psql:testdbdump:1720: invalid command \N
psql:testdbdump:1721: invalid command \N
psql:testdbdump:1808: ERROR:  syntax error at or near "user"
LINE 1: user=phone
        ^

我是否错误地创建了转储文件?

1 个答案:

答案 0 :(得分:1)

查找--create的{​​{1}}选项。它是为此而制作的。