How to clone a test database from a production one in one single action?

后端 未结 4 2145
不思量自难忘°
不思量自难忘° 2021-02-07 22:11

I am looking for a basic script/command that will create a copy of a live database (let name them mydb and mydb_test, both on the same server).

4条回答
  •  情歌与酒
    2021-02-07 22:55

    Since you didn't say it was a problem to drop objects in the database, I think running pg_dump with the --clean option will do what you want. You can pipe the output of pg_dump into psql for this sort of thing.

提交回复
热议问题