Re: Backing Up a Postgres database...

From: "vijay" <vijayanath(at)hotmail(dot)com>
To: "Jonathan Telep" <jon2(at)autoweb(dot)net>, <pgsql-novice(at)postgresql(dot)org>
Subject: Re: Backing Up a Postgres database...
Date: 2003-09-25 22:54:22
Message-ID: BAY2-DAV3bKP7Ie8tlM00002f37@hotmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

Hi Jon,

Hope this helps you.

More detailed info about backing up
---------------------------------------------------

Examples
To dump a database:

$ pg_dump mydb > db.out
In the above example "pg_dump " is the command for backing up
"mydb" is the name of the db you want to backup
">" is used for redirecting the output
"db.out" is the file where the backup of the DB will be stored

To reload this database:

$ psql -d database -f db.out
In the above example "psql" is the command for reloading DB from the
backup
"-d" is the option indicating the database you are
backing it into
"database" is the name of the db you want to restore into
"-f" is used for restoring it from the following
file
"db.out" is the file where the DB will be restored from

To dump a database called mydb that contains BLOBs( BIG LARGE OBJECTS, a
special object in postgresql) to a tar file:

$ pg_dump -Ft -b mydb > db.tar
In the above example "pg_dump " is the command for backing up
"mydb" is the name of the db you want to backup
">" is used for redirecting the output
"db.tar" is the file where the backup of the DB will be
stored

To reload this database (with BLOBs) to an existing database called newdb:

$ pg_restore -d newdb db.tar
In the above example "pg_restore" is the command for reloading DB
from the backup
"-d" is the option indicating the database you are
backing it into
"newdb" is the name of the db you want to restore into
"db.tar" is the file where the DB will be restored from

Vijay

----- Original Message -----
From: "Jonathan Telep" <jon2(at)autoweb(dot)net>
To: <pgsql-novice(at)postgresql(dot)org>
Sent: Wednesday, September 24, 2003 1:51 PM
Subject: [NOVICE] Backing Up a Postgres database...

> Hello, I'm not sure who I should be posing this question to but I'm a
> System Administrator who has inherited several Debian Linux servers one
> of which apparently hosts a rather large Postgres database. One of my
> responsibilites is to back that database up each night and be able to
> recover it "on the fly" in the event of a problem. I have no idea how
> to even check which version of Postgres is loaded on this server, let
> alone, be able to back it up.
>
> Is there anyone who can give me just some basic commands on how to shut
> it down each night, back it up, verify that the back up is good and what
> to do in the event that I ever have to restore it? I know it seems like
> a lot but I'm swamped with a million things to do and would rather not
> have to read a couple hundred pages of material if I can avoid it.
>
> Thanks in advance,
>
> Jon
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 1: subscribe and unsubscribe commands go to majordomo(at)postgresql(dot)org
>

In response to

Browse pgsql-novice by date

  From Date Subject
Next Message Tom Lane 2003-09-25 23:03:34 Re: Cache lookup error
Previous Message Godshall Michael 2003-09-25 22:46:50 Re: Calling a function within a function - plpsql