Sample Header Ad - 728x90

Dump PostgreSQL without DROP DATABASE

3 votes
2 answers
7091 views
I want dump a database, but, without DROP DATABASE, and CREATE DATABASE instructions, in .backup / .sql (generate file). Actually I use this command: pg_dump --format=c --no-privileges --no-owner --file=/tmp/hostname-date +%d%m%Y.backup --username=admin --host=127.0.0.1 database_name But, in top lines of file, I have this: DROP DATABASE... CREATE DATABASE... So, I my case, I want duplicate this database, and, if I use this script with **pg_restore** I drop the other database (I don't want that).
Asked by Patrick Maciel (143 rep)
Jul 12, 2013, 07:28 PM
Last activity: Apr 19, 2021, 06:34 AM