pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Scott Marlowe <scott.marlowe@gmail.com>
To: NUWAN LIYANAGE <alnuwan@yahoo.com>
Cc: pgsql-admin@postgresql.org
Subject: Re: backup including symbolic links?
Date: Sat, 26 Jan 2008 16:30:32 -0600
Message-ID: <dcc563d10801261430n1f24de5m31e788c5a332fbe2@mail.gmail.com> (raw)
In-Reply-To: <447214.98499.qm@web56414.mail.re3.yahoo.com>
References: <dcc563d10801251822r229357b0s795610631d6bab02@mail.gmail.com>
	<447214.98499.qm@web56414.mail.re3.yahoo.com>

On Jan 26, 2008 3:06 PM, NUWAN LIYANAGE <alnuwan@yahoo.com> wrote:
> Yes, I was thinking of doing a pg_dumpall, but my only worry was that the
> singl file is going to be pretty large. I guess I don't have to worry too
> much about that.
> But my question to you sir is, If I want to create the development db using
> this pg dump file, how do I actually edit create tablespace statements so
> they will be created in the directory I want them to be. Or should I even
> worry about this.. (I want my data directory to be in E: drive including all
> the tablespaces.)

Take a look through the docs on pg_dump and pg_dumpall.

A few of the options to look at are the ones to dump just data or just
schema.  Quite often you don't need the data, just the schema, for
development.  "pg_dump -s dbname" will dump just the schema, and
"pg_dumpall --globals" will dump just the global database info, i.e.
usernames, tablespaces, etc...

Then just edit in your favorite text editor and point the resulting
file(s) at your dev db with psql f mydump.sql where mydump.sql is the
file you got from one or more of the above operations.

After that, I highly recommend that any changes you wish to make, do
so with .sql scripts (stored in your favorite version control system),
so that you can then apply them to your production database later with
minimal fuss.

Note that any changes that should be "all or nothing" to the
production database can be applied in a transaction (i.e. wrapped in a
begin/commit pair) and then either all or none of the changes will be
made...

example
begin;
create table abc ....
alter table xyz ...
insert ...
commit;

if any of those commands fail (things like creating unique indexes
might fail on production where they didn't in development) then no
harm, no foul, just figure out what went wrong and update your script
so it takes care of those problems.



view thread (5+ messages)  latest in thread

Message-ID: <dcc563d10801261430n1f24de5m31e788c5a332fbe2@mail.gmail.com>
Permalink:  ../dcc563d10801261430n1f24de5m31e788c5a332fbe2@mail.gmail.com/
Also on:    postgresql.org/message-id/dcc563d10801261430n1f24de5m31e788c5a332fbe2@mail.gmail.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-admin@postgresql.org
  Cc: scott.marlowe@gmail.com, alnuwan@yahoo.com
  Subject: Re: backup including symbolic links?
  In-Reply-To: <dcc563d10801261430n1f24de5m31e788c5a332fbe2@mail.gmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox