How to Restore a Postgresql Database.doc - FTP Directory Listing

needmoreneedmoreΔιαχείριση Δεδομένων

28 Νοε 2012 (πριν από 4 χρόνια και 8 μήνες)

374 εμφανίσεις


How to
Restore a Postgresql

Database


To restore database



rcapache stop


r
csolcl stop


rcpostgresql restart


If the database is compressed to a .gz file:


C
opy zip
ped file (.gz)

to a dir
ectory

and unzip (assuming the zipped file is in
/root/ direc
tory
)



md db


cd db


cp /root/

db_backup_filename
.sql.gz /root/db


gunzip *


Next, copy the unzipped .sql file to /work/pgsql



cd /work/pgsql


cp /root/db/ db_backup_filename.sql /work/pgsql/


Now to do the restore:



su
-

postgres
-
c 'drop
db ipbilling'


su
-

postgres
-
c 'createdb ipbilling'


psql
-
U postgres ipbilling < db_backup_filename.sql


rcapache start


rcsolcl start