Thread: copy/backup database

copy/backup database

From
"Dan"
Date:
Hello,

I have a pgsql database I want to make a copy of to do some test work on it.
In /var/lib/psql/data/base I have made a copy of this directory with correct
file permission etc but when I try to access the database it says it's not
in the catalogue.  I guess there's obviously a procudure for this or a pgsql
command but I dont know what.
Please help!
Thanks!



Re: copy/backup database

From
Doug McNaught
Date:
"Dan" <dan@NOSPAMbluecap.co.uk> writes:

> Hello,
>
> I have a pgsql database I want to make a copy of to do some test work on it.
> In /var/lib/psql/data/base I have made a copy of this directory with correct
> file permission etc but when I try to access the database it says it's not
> in the catalogue.  I guess there's obviously a procudure for this or a pgsql
> command but I dont know what.

Don't do it that way.

$ pg_dump original_db > dump.out
$ createdb test_db
$ psql -f dump.out test_db

-Doug
--
The rain man gave me two cures; he said jump right in,
The first was Texas medicine--the second was just railroad gin,
And like a fool I mixed them, and it strangled up my mind,
Now people just get uglier, and I got no sense of time...          --Dylan