Take the 2-minute tour ×
Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. It's 100% free, no registration required.

I have 2 CentOS servers, one is running PostgreSQL 9.2 and the other, 9.3.

I'm trying to migrate the database but I'm getting 'relation does not exist' errors.

What I did was on the 9.2 server:

pg_dump -h localhost -W -U postgres --clean DBName > dbname.dump

copied the dbname.dump file to the 9.3 server and then:

pgsql -h localhost -W -U postgres -f dbname.dump

Am I doing something wrong?

Other misc info, I am using the postgis extension and have some foreign key restraints.

share|improve this question
2  
Show the full, exact text of the error message(s). I also recommend using pg_dump -Fc and using pg_restore instead of psql. If you use psql at least use psql -v ON_ERROR_STOP=1 –  Craig Ringer Mar 31 at 12:08

1 Answer 1

up vote 0 down vote accepted

I would do something like:

pg_dump -h localhost -W -U postgres --clean -f dbname.dump DBName

The move the file to the new server, create the new database with

createdb DBName

then restore with:

psql -d DBName -f dbname.dump -v ON_ERROR_STOP=1

Remember that if you have tablespaces created on the old DB you will have to manually recreate them in the new DB before importing the dump.

share|improve this answer
    
Managed to find out what the error was with the -v and ON_ERROR_STOP=1 flags/parameters. I didn't install postgis on the 9.3 server. –  wyred Apr 1 at 3:26

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.