Re: pg_restore is not working

From: Ron <ronljohnsonjr(at)gmail(dot)com>
To: "pgsql-admin(at)lists(dot)postgresql(dot)org" <pgsql-admin(at)lists(dot)postgresql(dot)org>
Subject: Re: pg_restore is not working
Date: 2023-10-24 17:56:48
Message-ID: e5e9e6d2-ccaf-4780-baf1-28a9c9cb96c6@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

On 10/24/23 12:24, M Sarwar wrote:
> Hi Ron,
>
> I did try using -Fc clause. pg_dump is running fine but pg_restore is
> having the same issue.
> I tried once again now after seeing your email and getting the same scenario.
>
> Pg_Dump:-
>
> PS H:\> pg_dump -Fc -v -h*/sharded/*-U db_sarwar -d NGBRDVDB -t
> 'bronxdev.errors' -f
> C:\Mohammed\Work\NGC\Apps\Bronx\Backups\Dumps\data\backup_Dev_Bronxdev-Errors_20231024-6.DUMP
>
> Password:
>
> Pg_dump ran fine.
>
> Pg_Restore:-
>
> PS H:\> pg_restore -v -h*/sharded/* -U db_sarwar -d bronxdb1 -t
> 'bronxdev.errors'
> C:\Mohammed\Work\NGC\Apps\Bronx\Backups\Dumps\data\backup_Dev_Bronxdev-Errors_20231024-6.DUMP
>
> pg_restore: connecting to database for restore
>
> Password:
>
> pg_restore: implied data-only restore
>
> PS H:\> pg_restore -Fc -v -h*/sharded/* -U db_sarwar -d bronxdb1 -t
> 'bronxdev.errors'
> C:\Mohammed\Work\NGC\Apps\Bronx\Backups\Dumps\data\backup_Dev_Bronxdev-Errors_20231024-6.DUMP
>
> pg_restore: connecting to database for restore
>
> Password:
>
> pg_restore: implied data-only restore
>
> PS H:\>
>
> It has no errors but it did not restore the data.
>

This works for me.  I just tested it.  You'll have to convert from bash to
Windows.

SrcHost=somehost
DescHost=anotherhost

SrcDir=/var/lib/pgsql/backups/test

SrcDB=somedb

DestDB=anotherdb

Tbl=public.job

pg_dump --host=$SrcHost -Fc -t $Tbl -v -d ${SrcDB} -f $SrcDir/${Tbl}.dump

pg_restore --host=$DestHost -v -d ${DestDB} ${SrcDir}/${Tbl}.dump

> Thanks,
> Sarwar
>
> ----------------------------------------------------------------------------
> *From:* Ron <ronljohnsonjr(at)gmail(dot)com>
> *Sent:* Tuesday, October 24, 2023 1:08 PM
> *To:* pgsql-admin(at)lists(dot)postgresql(dot)org <pgsql-admin(at)lists(dot)postgresql(dot)org>
> *Subject:* Re: pg_restore is not working
> On 10/24/23 11:43, M Sarwar wrote:
>>
>> Hi,
>>
>> Restore is having no errors but it is not restoring any data.
>> I have used the below command pg_dump
>> pg_dump -F t -v -h bronxdb1.c52p1yyyjuib.us-xxx-west-1.rds.amazonaws.com
>> -U db_sarwar -d NGBRDVDB -t 'bronxdev.errors' -f
>> C:\Mohammed\Work\NGC\Apps\Bronx\Backups\Dumps\data\backup_Dev_Bronxdev-Errors_20231024-5.DUMP
>>
>
> Why "-Ft" instead of "-Fc" for a .dump file?
>
>> I am using the below command for the restore.
>>
>> PS H:\> pg_restore -F t -v -h
>> bronxdb1.c52p1fyyyuib.us-xxx-west-1.rds.amazonaws.com -U db_sarwar -d
>> bronxdb1 -t 'bronxdev.errors'
>> C:\Mohammed\Work\NGC\Apps\Bronx\Backups\Dumps\data\backup_Dev_Bronxdev-Errors_20231024-5.DUMP
>> pg_restore: connecting to database for restore
>> Password:
>> pg_restore: implied data-only restore
>> PS H:\>
>>
>> Thanks,
>> Sarwar
>>
>
> --
> Born in Arizona, moved to Babylonia.

--
Born in Arizona, moved to Babylonia.

In response to

Responses

Browse pgsql-admin by date

  From Date Subject
Next Message M Sarwar 2023-10-24 18:28:31 Re: pg_restore is not working
Previous Message Michael Banck 2023-10-24 17:34:08 Re: pg_restore is not working