- Dump from PostgreSQL on Windows
- cd %POSTGRESQL_SERVER_HOME%/bin
- pg_dump -U <db_user> -W <db_passwd> <db_name> > outfile
- for example: pg_dump -U postgres -W
terp > terp.dump - Restore into PostgreSQL on Linux
- su - postgres
- Assume the database owner is postgres
- /usr/local/pgsql/bin/createdb --encoding=UNICODE terp
- Assume PostfreSQL homed at /usr/local/pgsql and database name is terp
- /usr/local/pgsql/bin/psql terp <>
- Assume the restored database is terp and dump file named terp.dump
- Assume the restored database is terp and dump file named terp.dump
2007年11月20日 星期二
Dump PostgreSQL database from Windows and restore to Linux
It's often the case that you develop lots of stuffs on Windows, and some are database record dependency, such as language translation stored in database, that make porting data from two servers much more difficult. There is a quick and dirty way to solve it by dumping database from each other. Next is the sample to dump PostgreSQL database from Windows and restore into Linux's.
訂閱:
張貼留言 (Atom)
沒有留言:
張貼留言