Обсуждение: File System Restore

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

File System Restore

От
Carter Harrison
Дата:
I'm running the latest version of PostgreSQL.  I backed up one of my
databases following the instructions in the postgresql documentation.
This means that I did shut down postmaster and I tarred the data
directory just like it says to.  Now, I'd like to restore the file
system.  I started by just copying the data directory back, but that
hasn't worked for me.  Can somebody please give me some detailed
directions on restoring the file system correctly.  I think the only
thing that is different about this new install of postgresql is that it
is owned by a different user than before.  Thanks.

-Carter


Re: File System Restore

От
"Scot L. Harris"
Дата:
On Sat, 2004-06-19 at 16:34, Carter Harrison wrote:
> I'm running the latest version of PostgreSQL.  I backed up one of my
> databases following the instructions in the postgresql documentation.
> This means that I did shut down postmaster and I tarred the data
> directory just like it says to.  Now, I'd like to restore the file
> system.  I started by just copying the data directory back, but that
> hasn't worked for me.  Can somebody please give me some detailed
> directions on restoring the file system correctly.  I think the only
> thing that is different about this new install of postgresql is that it
> is owned by a different user than before.  Thanks.
>
> -Carter

I just recently upgraded from 7.2.4 to 7.4.2 postgresql.  What I did was
a pg_dumpall to save my databases.  Then after the upgrade I did a
pg_restore using the saved dump file.  Worked perfectly for me.

After I installed the new version of postgresql I did a initdb to setup
the new database cluster then a started postgresql.  After that I ran a
psql -d template1 -f databasebackupfile.  The databasebackupfile was
created from the pg_dumpall.  This recreated all my tables and loaded
the data.

Very easy and clean.

Not sure you can just copy the file systems around like you describe.

--
Scot L. Harris
webid@cfl.rr.com

After an instrument has been assembled, extra components will be found
on the bench.


Re: File System Restore

От
Tom Lane
Дата:
Carter Harrison <gtg459b@mail.gatech.edu> writes:
> Can somebody please give me some detailed
> directions on restoring the file system correctly.  I think the only
> thing that is different about this new install of postgresql is that it
> is owned by a different user than before.  Thanks.

Did you make sure the files were owned by the correct user?  If not,
better show us exactly what's going wrong.  "hasn't worked" is about
as content-free a trouble report as you could offer ...

            regards, tom lane

Re: File System Restore

От
"Tim Penhey"
Дата:
Scot L. Harris wrote:
>
> I just recently upgraded from 7.2.4 to 7.4.2 postgresql.  What I did was
> a pg_dumpall to save my databases.  Then after the upgrade I did a
> pg_restore using the saved dump file.  Worked perfectly for me.
>
> After I installed the new version of postgresql I did a initdb to setup
> the new database cluster then a started postgresql.  After that I ran a
> psql -d template1 -f databasebackupfile.  The databasebackupfile was
> created from the pg_dumpall.  This recreated all my tables and loaded
> the data.
>
> Very easy and clean.
>
> Not sure you can just copy the file systems around like you describe.

This has been a bit of a point of confusion for me.

When do you use pg_restore vs. psql -f dumped.sql?

Thanks
Tim


Re: File System Restore

От
Doug McNaught
Дата:
"Tim Penhey" <tim@penhey.net> writes:

> This has been a bit of a point of confusion for me.
>
> When do you use pg_restore vs. psql -f dumped.sql?

If you used the 'custom' or 'tar' formats of pg_dump, you need to use
pg_restore.  If you dumped as straight SQL (the default), just feed
the dump to psql.

-Doug