0

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

 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
        ^

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

4

1 回答 1

1

查找 的--create选项pg_restore。它是为此目的而制作的。

于 2013-11-15T02:25:02.353 回答