I'm new to postgresql, and locally, I use pgadmin3. On the remote server, however, I have no such luxury.
I've already created the backup of the database and copied it over, but, is there a way to restore a backup from the command line? I only see things related to GUI or to pg_dumps, so, if someone can tell me how to go about this, that'd be terrific!
Try to see if the following commands can help you:
1) Open psql terminal.
2) Unzip/ untar the dump file.
3) Create an empty database.
4) use the following command to restore the .dump file
Backup and restore with GZIP
backup
restore
https://www.postgresql.org/docs/9.1/static/backup-dump.html
I was having authentication problems running pg_dump, so I moved my dump file
into the temp directory and then ran
If you have a large database dump, you may just want to create another directory where your current user and the postgres user can access and putting the database dump file into that.
See below example its working
C:/Program Files/PostgreSQL/9.4/bin\pg_restore.exe --host localhost --port 5432 --username "postgres" --dbname "newDatabase" --no-password --verbose
"C:\Users\Yogesh\Downloads\new Download\DB.backup"
Sorry for the necropost, but these solutions did not work for me. I'm on postgres 10. On Linux:
service postgresql-10 restart
Change directory to where my backup.sql was located and execute:
psql postgres -d database_name -1 -f backup.sql
-database_name is the name of my database
-backup.sql is the name of my .sql backup file.