How to restore backup database

Started by klo uoover 11 years ago5 messagesgeneral
Jump to latest
#1klo uo
klonuo@gmail.com

Hi,

I use PostrgrSQL 9.3 for couple of months now, on Windows.
I installed new Window OS, and before installing, I made tar backups of my
PostgreSQL databases.
Now I want to restore these on my new OS, but I can't find such option in
pgAdmin.

In documentation (http://www.postgresql.org/docs/9.3/static/backup.html) I
see only suggestions how to restore sql dumps with command line tools, but
none how to restore single file tar backups.

Please suggest the right way to restore my backup databases.

Thanks

#2Adrian Klaver
adrian.klaver@aklaver.com
In reply to: klo uo (#1)
Re: How to restore backup database

On 09/08/2014 09:04 AM, klo uo wrote:

Hi,

I use PostrgrSQL 9.3 for couple of months now, on Windows.
I installed new Window OS, and before installing, I made tar backups of
my PostgreSQL databases.

What was the command you used?

Now I want to restore these on my new OS, but I can't find such option
in pgAdmin.

In documentation (http://www.postgresql.org/docs/9.3/static/backup.html)
I see only suggestions how to restore sql dumps with command line tools,
but none how to restore single file tar backups.

Please suggest the right way to restore my backup databases.

Well that depends on the answer to the previous question.

Thanks

--
Adrian Klaver
adrian.klaver@aklaver.com

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

#3klo uo
klonuo@gmail.com
In reply to: Adrian Klaver (#2)
Re: How to restore backup database

Hi Adrian,

I used pgAdmin backup command.
However in the meantime I figured how to restore.
I first have to create database, and then use restore option which becomes
available if I right-click on a database.
On MSSQL for example, I can restore database without creating database
first, and I guess I was expecting similar behavior.

Cheers

On Mon, Sep 8, 2014 at 6:47 PM, Adrian Klaver <adrian.klaver@aklaver.com>
wrote:

Show quoted text

On 09/08/2014 09:04 AM, klo uo wrote:

Hi,

I use PostrgrSQL 9.3 for couple of months now, on Windows.
I installed new Window OS, and before installing, I made tar backups of
my PostgreSQL databases.

What was the command you used?

Now I want to restore these on my new OS, but I can't find such option

in pgAdmin.

In documentation (http://www.postgresql.org/docs/9.3/static/backup.html)
I see only suggestions how to restore sql dumps with command line tools,
but none how to restore single file tar backups.

Please suggest the right way to restore my backup databases.

Well that depends on the answer to the previous question.

Thanks

--
Adrian Klaver
adrian.klaver@aklaver.com

#4Adrian Klaver
adrian.klaver@aklaver.com
In reply to: klo uo (#3)
Re: How to restore backup database

On 09/08/2014 10:49 AM, klo uo wrote:

Hi Adrian,

I used pgAdmin backup command.
However in the meantime I figured how to restore.
I first have to create database, and then use restore option which
becomes available if I right-click on a database.
On MSSQL for example, I can restore database without creating database
first, and I guess I was expecting similar behavior.

You do not have to create a database in Postgres either. There are some
system databases already created for you, template0(read only best left
alone), template1 and postgres. You can connect to one of these(best
practices, use postgres) and then have the restore script create the new
database.<IMPORTANT> If you do this you need to check the Include CREATE
DATABASE statement box (http://www.pgadmin.org/docs/1.18/restore.html)
<IMPORTANT>

To get a better idea of what is going on I would suggest reading the
following sections of the docs:

http://www.postgresql.org/docs/9.3/interactive/app-pgdump.html

http://www.postgresql.org/docs/9.3/interactive/app-pgrestore.html

This is what pgAdmin is using behind the scenes.

Cheers

--
Adrian Klaver
adrian.klaver@aklaver.com

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

#5klo uo
klonuo@gmail.com
In reply to: Adrian Klaver (#4)
Re: How to restore backup database

On Mon, Sep 8, 2014 at 8:10 PM, Adrian Klaver wrote:

You do not have to create a database in Postgres either. There are some
system databases already created for you, template0(read only best left
alone), template1 and postgres. You can connect to one of these(best
practices, use postgres) and then have the restore script create the new
database.<IMPORTANT> If you do this you need to check the Include CREATE
DATABASE statement box (http://www.pgadmin.org/docs/1.18/restore.html)
<IMPORTANT>

To get a better idea of what is going on I would suggest reading the
following sections of the docs:

http://www.postgresql.org/docs/9.3/interactive/app-pgdump.html

http://www.postgresql.org/docs/9.3/interactive/app-pgrestore.html

This is what pgAdmin is using behind the scenes.

Nice.
Thanks for the tip and suggestions.

Cheers