First: 

 pg_dumpall> outfile

 : then
 psql-U "owner name" dbname <infile
 (Or: postgres psql-f infile) 

Once restored, it is wise to run ANALYZE on each database optimizer has useful statistics So the. Run an easy way to do this is to:

"Vacuumdb-U 'owner name'-a-z"

to VACUUM ANALYZE all databases; this is equivalent to running VACUUM ANALYZE manually.