Is there a simple way to create a copy of a database or schema in PostgreSQL 8.1?
I'm testing some software which does a lot of updates to a particular schema within a database, and I'd like to make a copy of it so I can run some comparisons against the original.
From stackoverflow
-
pg_dump with the --schema-only option. (Link goes to 7.4 docs but if you just Google pg_dump you will get links to every version)
bortzmeyer : Replace "7.4" with "current" and you have a link to the latest version. -
here is a link to some examples of backing up and restoring. You can use the backup to restore to a different server or whatever
-
If it's on the same server, you just use the CREATE DATABASE command with the TEMPLATE parameter. For example:
CREATE DATABASE newdb WITH TEMPLATE olddb;
Jin Kim : Thanks, that did the trick.
0 comments:
Post a Comment