我需要将现有数据库(包括其架构和结构)复制到另一个新数据库。我在 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 ×1