How to Setup Postgresql in Ubuntu and Perform Dump/restore
This write up will try to explain how to install postgresql and attempt to perform database dump and restore. Which should be a basic functi...
https://www.czetsuyatech.com/2012/06/ubuntu-install-postgresql-dump-restore.html
This write up will try to explain how to install postgresql and attempt to perform database dump and restore. Which should be a basic functionality but is not present in pgadmin.
1.) Install postgresql (execute in terminal):
2.) Setup postgres user:
3.) To check install pgadmin via "Ubuntu Update Center", and try to login using postgres/postgres account.
4.) Perform dump/restore. But before performing the ff commands, you should login as postgres first:
+Create the dumps:
+How to restore
Note: Got this somewhere else, just added some more statements.
1.) Install postgresql (execute in terminal):
sudo apt-get install postgresql postgresql-contrib
2.) Setup postgres user:
sudo -u postgres psql alter user postgres password 'postgres' //close the terminal after.
3.) To check install pgadmin via "Ubuntu Update Center", and try to login using postgres/postgres account.
4.) Perform dump/restore. But before performing the ff commands, you should login as postgres first:
sudo su postgres
+Create the dumps:
//dump the roles pg_dumpall -g -U postgres > roles.sql +Dump the schema pg_dump -Fp -s -v -f schema.sql -U postgres databaseName +Dump the data pg_dump -Fc -v -f data.dump -U postgres databaseName
+How to restore
psql -f roles.sql psql -f schema.sql databaseName pg_restore -a -d databaseName -Fc data.dump
Note: Got this somewhere else, just added some more statements.
Post a Comment