I use EMS SQL Manager for PostgreSQL and I need to dump difficult database(domains, 300+ stored procedures/functions, triggers, data, etc). This tool cannot do it.
Please advice me good GUI tool for postgres.
pg_dump is a utility for backing up a PostgreSQL database. It makes consistent backups even if the database is being used concurrently. pg_dump does not block other users accessing the database (readers or writers). pg_dump only dumps a single database.
In PostgreSQL, you can restore a database in two ways: Using psql to restore plain SQL script file generated by pg_dump and pg_dumpall tools. Using pg_restore to restore tar file and directory format created by the pg_dump tool.
sql , which uses the plain or SQL format, the pg_dump command does not store any file anywhere. It just sends the output to STDOUT , which is usually your screen, and it's done. But in your command, you also told your shell (Terminal, Command prompt, whatever) to redirect STDOUT to a file.
You can always just use the command line utility.
Dump the cluster:
pg_dumpall -p 5432 > /path/to/my/dump_file.sql
Dump a single database:
pg_dump -p 5432 mydb > /path/to/my/mydb_dump.sql
Dump the schema only:
pg_dump -p 5432 mydb -s > /path/to/my/mydb_dump_schema.sql
More in the manual.
If you want to restore to an empty database, you might want to run before restoring:
DROP DATABASE IF EXISTS mydb;
CREATE DATABASE mydb;
The --clean
option for pg_dump
is not needed in this case.
Backup your database no tool needed.we can do with terminal
All commands should be run as the postgres user.
sudo su - postgres
Backup a single database
pg_dump db_name > db_backup.sql
Restore a single database
psql db_name < db_backup.sql
Backup an entire postgres database cluster
pg_dumpall > cluster_backup.sql
Restore an entire postgres database cluster
psql -f cluster_backup.sql postgres
Refer this source for more commands backup commands
pgAdmin3 will do the trick, it has pg_dump and pg_restore included in the installer.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With