best practices for dumping databases

Поиск
Список
Период
Сортировка
Искать

best practices for dumping databases

От:
"Mag Gam" <magawake@gmail.com>
Дата:
What is the best way to dump a database?

Currently, I am using pg_dump dbname. However, my data contains a lot of escape sequences and various characters which is causing a restore problem. How can I avoid problems like this? Is there a "binary" dump and restore? I rather use that if its going to guarantee valid data.

TIA


Re: best practices for dumping databases

От:
"Sean Davis" <sdavis2@mail.nih.gov>
Дата:
On Sun, Apr 6, 2008 at 4:25 PM, Mag Gam  wrote:
> What is the best way to dump a database?
>
> Currently, I am using pg_dump dbname. However, my data contains a lot of
> escape sequences and various characters which is causing a restore problem.
> How can I avoid problems like this? Is there a "binary" dump and restore? I
> rather use that if its going to guarantee valid data.

See the format argument to pg_dump.  It allows binary dumps.

Sean

Re: best practices for dumping databases

От:
Tom Lane <tgl@sss.pgh.pa.us>
Дата:
"Mag Gam"  writes:
> What is the best way to dump a database?
> Currently, I am using pg_dump dbname. However, my data contains a lot of
> escape sequences and various characters which is causing a restore problem.

Please provide details --- it should work anyway, in any remotely
modern PG version.

			regards, tom lane

Re: best practices for dumping databases

От:
"Mag Gam" <magawake@gmail.com>
Дата:
I am not able to reproduce this error now..strange!

I am running 8.3.0, and basically the error I was getting was "\m ignoring" when I tried to do a restore. I was using the redirect " psql foo < db.dump" and the "\i db.dump" method for the restore.
I will be vigilant and try to attempt this again if I find anything I will report it ASAP.

But, what is the correct practice to do db_dumps? pg_dump db should suffice?

Thanks


On Sun, Apr 6, 2008 at 6:36 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
"Mag Gam" <magawake@gmail.com> writes:
> What is the best way to dump a database?
> Currently, I am using pg_dump dbname. However, my data contains a lot of
> escape sequences and various characters which is causing a restore problem.

Please provide details --- it should work anyway, in any remotely
modern PG version.

                       regards, tom lane

Re: best practices for dumping databases

От:
Tom Lane <tgl@sss.pgh.pa.us>
Дата:
"Mag Gam"  writes:
> But, what is the correct practice to do db_dumps? pg_dump db should suffice?

Yes, though remember that pg_dump doesn't dump any role or tablespace
definitions, and it also doesn't think about properties attached to the
database as such (ALTER DATABASE etc).  You might want to use
"pg_dumpall -g" for those.

			regards, tom lane

Re: best practices for dumping databases

От:
richard terry <rterry@gnumed.net>
Дата:
On the same topic, but a variation. 

I use pgAdmin 1.4.2 and am a paranoid backer-upper, ie do it frequently, but 
obviously have not been taking notice of the messages as they spin past.

When the database and its schema's have been open and I've been working on 
them, I usally then just click on the database name, right mouse click > 
backup > enter file name > choose plain > ok, then copy the resultant file 
off the machine.

I noticed yesterday that on occasions the title bar window was only showing 
the name of either a schema, or even a single table, and to my horror I've 
discovered I was often not getting a complete database dump.

Despite going back up and clicking the database name, right mouse up witih the 
menu, choose _Backup etc, it was only copying a table or shema I'd previously 
worked on.

If I closed the connection and re-established it, then the squence works.

Am I doing anything wrong???

Regards

Richard

On Mon, 7 Apr 2008 11:24:04 am Tom Lane wrote:
> "Mag Gam"  writes:
> > But, what is the correct practice to do db_dumps? pg_dump db should
> > suffice?
>
> Yes, though remember that pg_dump doesn't dump any role or tablespace
> definitions, and it also doesn't think about properties attached to the
> database as such (ALTER DATABASE etc).  You might want to use
> "pg_dumpall -g" for those.
>
> 			regards, tom lane


FAQ