Skip site navigation (1) Skip section navigation (2)

Reliably backing up a live database

From: Tanstaafl <tanstaafl(at)libertytrek(dot)org>
To: pgsql-novice(at)postgresql(dot)org
Subject: Reliably backing up a live database
Date: 2012-02-24 14:07:18
Message-ID: 4F479996.1000301@libertytrek.org (view raw or flat)
Thread:
Lists: pgsql-novice
Hello,

I am relatively new to SQL databases in general, and very new to 
postgresql, so please be gentle.

My question has to do with how to properly perform a dump on a live 
database, that I've sort of inherited. We have some developers that are 
assisting with making some modifications, but I want to make sure that 
something they told me is true...

I was told by one of the developers (who admits that he is still 
learning postgres) that I could get a successful dump of the live 
database using the following command, and more importantly, that I could 
do this safely without stopping the database first:

./pg_dump -U postgres  -Z --blobs --oids --encoding=UTF-8 dbname >
dbname.sql.gz

First, will that command result in a dump file that can be used to 
perform a full restore in event of a catastrophe (these will be uploaded 
to off-site storage)?

Second, can this command be run safely on a running database, or should 
the database be stopped first? If the latter, would someone be so kind 
as to provide an example of the commands necessary to stop this 
database, perform the dump, then restart it, that I could put in a cron job?

Thanks in advance for any help...

Simon

Responses

pgsql-novice by date

Next:From: Daniel StaalDate: 2012-02-24 14:30:34
Subject: Re: Reliably backing up a live database
Previous:From: Arda ÇeşmecioğluDate: 2012-02-24 10:00:27
Subject: Test inserted text in trigger (arrays, custom types) (corrected)

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group