dbTalk Databases Forums  

Backups with PSQL (pg_dumpall/pg_dump)

comp.databases.postgresql comp.databases.postgresql


Discuss Backups with PSQL (pg_dumpall/pg_dump) in the comp.databases.postgresql forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Fuzzydave
 
Posts: n/a

Default Backups with PSQL (pg_dumpall/pg_dump) - 12-21-2006 , 08:55 AM






Hello,
I don't know if this is a stupid question to ask or not, but I am
currently writing
a backup application for Postgres. I am using shell scripts using PSQL
to do
the actual dumps. I am incorparating the ability to completly customise
what
you want to backup from database to table level and to back up
seprately the
data and schema. I was considering breaking the shell scripts up too,
for both
readability and to keep the data dump code seperate from the
structure/schema
dump code.

What was wondering is with PSQL would I be able to run the data and the
schema
backup simultaniously? I would assume that one would fail due to the
fact a
backup is already being run on that same table? if not would there be
much
diffrence in the backups being simultaniously as opposed to
sequentially?

I know there are probably lots of pre-build system to backup postgres
avaliable
but its a bit of fun and quite interesting learning curve

Many thanks
David Phillips


Reply With Quote
  #2  
Old   
HansH
 
Posts: n/a

Default Re: Backups with PSQL (pg_dumpall/pg_dump) - 12-21-2006 , 10:18 AM






"Fuzzydave" <dav.phillips (AT) ntlworld (DOT) com> schreef in bericht
news:1166709315.002317.204830 (AT) 80g2000cwy (DOT) googlegroups.com...
Quote:
What was wondering is with PSQL would I be able to run the data and
the schema backup simultaniously?
IIRC psql does NOT have a backup option ...

Quote:
I would assume that one would fail due to the fact a backup is already
being run on that same table?
But for the system load AFAIK there is no limit on the backup frequency.
Be aware of locks that may hold [insert or update] queries

Quote:
if not would there be much diffrence in the backups being simultaniously
as opposed to sequentially?
Making multiple backups of single tables may brake referential integraty.
Further you may end up NOT backupping the definition of indexes,
restrictions and defaults, as well as both the definition and current value
of sequences.

Quote:
I know there are probably lots of pre-build system to backup postgres
avaliable but its a bit of fun and quite interesting learning curve
Do add 'man pg_dump[all]' to your learning curve.

Just my 2ct

HansH




Reply With Quote
  #3  
Old   
Fuzzydave
 
Posts: n/a

Default Re: Backups with PSQL (pg_dumpall/pg_dump) - 12-22-2006 , 04:29 AM



Quote:
IIRC psql does NOT have a backup option ...
sorry me not being clear again, I am using psql to do pg_dump and
pg_dumpall

Quote:
But for the system load AFAIK there is no limit on the backup frequency.
Be aware of locks that may hold [insert or update] queries
thats okay the backup is done when no one is actually using the system
so
it shouldn't be an issue.

Quote:
Making multiple backups of single tables may brake referential integraty.
Further you may end up NOT backupping the definition of indexes,
restrictions and defaults, as well as both the definition and current value
of sequences.
again me not being very clear I think, I am not making multiple backups

of the same table, I want to back up the database/schema/table
structure,
permission etc seperately from the actually database/schema/table data.


Quote:
Do add 'man pg_dump[all]' to your learning curve.
I am already dynamically writing my pg_dumpall to do the database dump
on the table structure as it retains all the permissions, user groups
and logins
etc ... but now that I think about it can I do pg_dumpall at
schema/table level
too? I am currently using a combination of pg_dumpall and pg_dump.

Quote:
Just my 2ct
Its apprecaited my friend

Muchly Appreciated merry christmas
David P



Reply With Quote
  #4  
Old   
Laurenz Albe
 
Posts: n/a

Default Re: Backups with PSQL (pg_dumpall/pg_dump) - 12-22-2006 , 04:49 AM



Fuzzydave <dav.phillips (AT) ntlworld (DOT) com> wrote:
Quote:
I don't know if this is a stupid question to ask or not, but I am
currently writing a backup application for Postgres.
I am using shell scripts using PSQL to do the actual dumps.

IIRC psql does NOT have a backup option ...

sorry me not being clear again, I am using psql to do pg_dump and
pg_dumpall
Either I do not really understand what you are trying to do, or you are
on a wrong track.

You do not call pg_dump from psql.

Using the appropriate options of pg_dump and pg_dumpall you should
be able to dump only the data you want:

The --globals-only option of pg_dumpall will dump only those things that
pg_dump won't (roles, role memberships and tablespaces).

With pg_dump, you can use --schema and --table to export only individual
schemata and tables.

Is that not enough for what you have in mind?

Yours,
Laurenz Albe


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.