小编Kar*_*esh的帖子

如何在postgresql中复制数据库?

我需要将现有数据库(包括其架构和结构)复制到另一个新数据库。我在 shell 命令环境中需要这个,而不是在 pgadmin 中。请帮助我。

nohup pg_dump exampledb > example-01.sql
createdb -O postgres exampledbclone_01
Run Code Online (Sandbox Code Playgroud)

我的用户是“postgres”

nohup psql exampledbclone_01 < example-01.sql
Run Code Online (Sandbox Code Playgroud)
$ pg_dump mydb > db.sql
$ psql -d newdb -f db.sql
Run Code Online (Sandbox Code Playgroud)

postgresql

29
推荐指数
2
解决办法
4万
查看次数

标签 统计

postgresql ×1