Обсуждение: How to restore

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

How to restore

От
Sachin Srivastava
Дата:
Dear Team,

If I have taken any backup successfully through pg_dump? How can I restore this pg_dump(Sql file) without use of pg_restore.

There is any command line option or through psql, kindly inform to me.

Regards,
Sachin

Re: How to restore

От
Guillaume Lelarge
Дата:

Hi,

Le 10 août 2015 7:43 AM, "Sachin Srivastava" <ssr.teleatlas@gmail.com> a écrit :
>
> Dear Team,
>
> If I have taken any backup successfully through pg_dump? How can I restore this pg_dump(Sql file) without use of pg_restore.
>
> There is any command line option or through psql, kindly inform to me.
>

If it's an SQL file, you can run it through psql.

--
Guillaume

Re: How to restore

От
Michael Paquier
Дата:
On Mon, Aug 10, 2015 at 2:41 PM, Sachin Srivastava
<ssr.teleatlas@gmail.com> wrote:
> Dear Team,
>
> If I have taken any backup successfully through pg_dump? How can I restore
> this pg_dump(Sql file) without use of pg_restore.
> There is any command line option or through psql, kindly inform to me.

The way to restore a backup depends on the format a dump has been taken:
http://www.postgresql.org/docs/devel/static/app-pgdump.html
Except the plain format that need psql, all the others (custom,
directory and tar) need pg_restore.
--
Michael


Re: How to restore

От
Guillaume Lelarge
Дата:

Please keep the list in your answers.

Le 10 août 2015 7:51 AM, "Sachin Srivastava" <ssr.teleatlas@gmail.com> a écrit :
>
> Dear Guillaume,
>
> What is the syntax of this (psql), kindy confirm.
>

That can be: psql -f the_file the_database

> Regards,
> Sachin
>
> On Mon, Aug 10, 2015 at 11:18 AM, Guillaume Lelarge <guillaume@lelarge.info> wrote:
>>
>> Hi,
>>
>> Le 10 août 2015 7:43 AM, "Sachin Srivastava" <ssr.teleatlas@gmail.com> a écrit :
>> >
>> > Dear Team,
>> >
>> > If I have taken any backup successfully through pg_dump? How can I restore this pg_dump(Sql file) without use of pg_restore.
>> >
>> > There is any command line option or through psql, kindly inform to me.
>> >
>>
>> If it's an SQL file, you can run it through psql.
>>
>> --
>> Guillaume
>
>

Re: How to restore

От
Andomar
Дата:
>
> If I have taken any backup successfully through pg_dump? How can I restore this pg_dump(Sql file) without use of
pg_restore.
>

You can send the file to psql, the command line client:

    psql yourdb < yourbackup.sql

Or:

    cat yourbackup.sql | psql yourdb

Kind regards,
Andomar