Обсуждение: Restore a backup to a different disk?

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

Restore a backup to a different disk?

От
a f
Дата:
Good day all, 

I am fairly new with PQSQL and am slowly picking things up - I have added a new disk and would like to do two things:

1. Restore a backup to this new disk - /hda2/pgdata/
2. Move a database from /hda1/pgdata to /hda2/pgdata/

Any help is most appreciated, thank you.

Re: Restore a backup to a different disk?

От
"Kevin Grittner"
Дата:
a f <just1coder@yahoo.ca> wrote:

> I have added a new disk and would like to do two things:
>
> 1. Restore a backup to this new disk - /hda2/pgdata/
> 2. Move a database from /hda1/pgdata to /hda2/pgdata/

First I want to be clear about whether you want to restore and move
entire database *clusters*, or whether you want to deal with
individual databases within a cluster.  A cluster is the level at
which you start and stop the server process, and it can contain many
databases

-Kevin

Re: Restore a backup to a different disk?

От
a f
Дата:
No cluster here, it is just a stand alone db server. Sorry if I sent this to the wrong UG.

I have #2 down already; but #1 was focused on backing up MyDatabase that resides on /hda1/pgdata, and restore it as MyDatabase2 on /hda2/pgdata.


From: Kevin Grittner <Kevin.Grittner@wicourts.gov>
To: pgsql-admin@postgresql.org; a f <just1coder@yahoo.ca>
Sent: Thu, July 22, 2010 12:52:59 PM
Subject: Re: [ADMIN] Restore a backup to a different disk?

a f <just1coder@yahoo.ca> wrote:

> I have added a new disk and would like to do two things:
>
> 1. Restore a backup to this new disk - /hda2/pgdata/
> 2. Move a database from /hda1/pgdata to /hda2/pgdata/

First I want to be clear about whether you want to restore and move
entire database *clusters*, or whether you want to deal with
individual databases within a cluster.  A cluster is the level at
which you start and stop the server process, and it can contain many
databases

-Kevin

--
Sent via pgsql-admin mailing list (pgsql-admin@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-admin

Re: Restore a backup to a different disk?

От
"Kevin Grittner"
Дата:
a f <just1coder@yahoo.ca> wrote:

> No cluster here, it is just a stand alone db server.

There's some terminology you've apparently not grasped yet -- when
PostgreSQL is running, the instance of the server is referred to as
a "cluster".  If you're running a PostgreSQL database server, you
are running a cluster, in the terminology of the PostgreSQL world.
Within the cluster you normally have a template0 database, a
template1 database, a postgres database, and one or more application
databases.

> Sorry if I sent this to the wrong UG.

Posting to this list is fine for this question.  pgsql-general or
pgsql-novice would also be OK, but having posted here, don't post on
another list unless the thread here goes dormant for at least a
couple days.

http://wiki.postgresql.org/wiki/Guide_to_reporting_problems

> I have #2 down already;

So you moved a PostgreSQL cluster from one mount point to another?
How, exactly, did you do that?

> but #1 was focused on backing up MyDatabase that resides on
> /hda1/pgdata, and restore it as MyDatabase2 on /hda2/pgdata.

Do you already have the backup you want to restore?  If so, how was
it made, exactly?

-Kevin

Re: Restore a backup to a different disk?

От
a f
Дата:


>> but #1 was focused on backing up MyDatabase that resides on
>> /hda1/pgdata, and restore it as MyDatabase2 on /hda2/pgdata.

>Do you already have the backup you want to restore?  If so, how was
>it made, exactly?

Yes. 
I used pg_dump to make the backup.

Re: Restore a backup to a different disk?

От
"Kevin Grittner"
Дата:
a f <just1coder@yahoo.ca> wrote:

>>> but #1 was focused on backing up MyDatabase that resides on
>>> /hda1/pgdata, and restore it as MyDatabase2 on /hda2/pgdata.
>
>> Do you already have the backup you want to restore?  If so, how
>> was it made, exactly?
>
>
> Yes.
> I used pg_dump to make the backup.

Well, if you made it without specifying any non-default options
you're not telling me about, you should initdb on the new drive (if
you haven't already), create any roles you had in the old database
which you want in the new one, create the database with the name you
want it to have, and run psql against that database using the file
created by pg_dump.

-Kevin

Re: Restore a backup to a different disk?

От
Andreas Schmitz
Дата:
Reading this thread confuses me a little bit. There is no need to backup
a cluster in order to move it to another disk within the same machine.
Stopping the Database, moving $PGDATA, adjusting scripts and routines if
nessecary and firing up the whole thing would do fine.

regards

-Andreas


On 07/22/2010 10:48 PM, Kevin Grittner wrote:
> a f<just1coder@yahoo.ca>  wrote:
>
>
>>>> but #1 was focused on backing up MyDatabase that resides on
>>>> /hda1/pgdata, and restore it as MyDatabase2 on /hda2/pgdata.
>>>>
>>
>>> Do you already have the backup you want to restore?  If so, how
>>> was it made, exactly?
>>>
>>
>> Yes.
>> I used pg_dump to make the backup.
>>
>
> Well, if you made it without specifying any non-default options
> you're not telling me about, you should initdb on the new drive (if
> you haven't already), create any roles you had in the old database
> which you want in the new one, create the database with the name you
> want it to have, and run psql against that database using the file
> created by pg_dump.
>
> -Kevin
>
>