How To Setup Postgresql Inwards Ubuntu 11.10 In Addition To Perform Dump/Restore

This write upwards volition show to explicate how to install postgresql in addition to endeavor to perform database dump in addition to restore. Which should hold out a basic functionality but is non introduce inwards pgadmin.

 1.) Install postgresql (execute inwards terminal):
sudo apt-get install postgresql postgresql-contrib 

2.) Setup postgres user:
sudo -u postgres psql modify user postgres password 'postgres' //close the final after. 

3.) To cheque install pgadmin via "Ubuntu Update Center", in addition to show to login using postgres/postgres account.
4.) Perform dump/restore. But earlier performing the ff commands, you lot should login every bit 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 information 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, simply added around to a greater extent than statements.
Next
Previous
Click here for Comments

0 komentar:

Please comment if there are any that need to be asked.