takeshin takeshin - 1 year ago 80
SQL Question

Purge postgresql database as it was new

I have created a PostgreSQL database dump using


Now I want to restore this backup from the file:

psql -d thesamename -f /my/backup/file

But I get errors that the data already exists.

Is there any command to delete everything from the database to bring it to just created state, except dropping and creating once again?

(I don't want to set up owner, tablescpace etc. once again)

Maybe some way to overwrite the database with the one from the backup file? (the backup file is from another database server)

Answer Source
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download