Thread:

From
"JinMing Qiu"
Date:
Hello everyone! How to move a postgresql database to another directory?

Re:

From
Chris
Date:
> JinMing Qiu wrote:
>
> Hello everyone! How to move a postgresql database to another
> directory?

Use tar or whatever, then symlink to the new location.

Re:

From
"He Weiping (Laser Henry)"
Date:
JinMing Qiu wrote:

> Hello everyone! How to move a postgresql database to another
> directory?

I think the procedure below would work:

1, create the new directory and assign the read write previlege to
postgres  superuser;
2, shut down all your postmaster using command like (assume you are
using bash on linux):
postgres@db$ killall -SIGTERM postmaster
3, move the totally data base to the new directory using command like:

 postgres@db$   tar cvf - /the_old_db_location | tar  -C
/the_new_db_location xvf -

4, remove the file in old location: (of course, make a backup is a good
idea)
postgres@db$ rm -r /the_old_db_location

5, make a symbol link to the new location, thus avoid the environment
variable changes:

postgres@db$ln -s /the_new_db_location /the_old_db_location

6, restart your postmaster:
postgres@db$ (something you've used before)

that's it



Re:

From
"cuke"
Date:
thank you very much!
But I can tar the old database ,if there is another way to move the datebase , please tell me or please tell me about
yourway detailed,thank you ! 
----- Original Message -----
From: He Weiping (Laser Henry) <laser@zhengmai.com.cn>
To: JinMing Qiu <cukechina@hotmail.com>
Cc: <pgsql-general@postgresql.org>
Sent: Monday, September 04, 2000 10:46 AM
Subject: Re: [GENERAL]


> JinMing Qiu wrote:
>
> > Hello everyone! How to move a postgresql database to another
> > directory?
>
> I think the procedure below would work:
>
> 1, create the new directory and assign the read write previlege to
> postgres  superuser;
> 2, shut down all your postmaster using command like (assume you are
> using bash on linux):
> postgres@db$ killall -SIGTERM postmaster
> 3, move the totally data base to the new directory using command like:
>
>  postgres@db$   tar cvf - /the_old_db_location | tar  -C
> /the_new_db_location xvf -
>
> 4, remove the file in old location: (of course, make a backup is a good
> idea)
> postgres@db$ rm -r /the_old_db_location
>
> 5, make a symbol link to the new location, thus avoid the environment
> variable changes:
>
> postgres@db$ln -s /the_new_db_location /the_old_db_location
>
> 6, restart your postmaster:
> postgres@db$ (something you've used before)
>
> that's it
>
>
>