【发布时间】:2016-05-18 17:23:34
【问题描述】:
我有一个名为“mydb”的数据库。现在我怎样才能创建一个名为“mydb_test”的新数据库,只有“mydb”的架构
试过以下链接PostgreSQL how to create a copy of a database or schema?
如上所述,我尝试了以下命令,
createdb -T olddb newdb
这会将包括数据在内的数据复制到newdb中
如果我尝试上面链接中提到的第二个选项,我会收到以下错误,
# pg_dump -Cs -U postgres my_test_db > dump_schema_file
# psql -U postgres naggappan_my_test_db < dump_schema_file
psql: FATAL: database "naggappan_my_test_db" does not exist
我怎样才能只接受架构
【问题讨论】:
标签: psql