From: Ron <ronljohnsonjr@gmail.com>
To: pgsql-admin@lists.postgresql.org <pgsql-admin@lists.postgresql.org>
Subject: Re: pg_restore is not working
Date: Tue, 24 Oct 2023 15:03:45 -0500
Message-ID: <27670a63-9dce-4b46-a56b-26cdc788ba06@gmail.com> (raw)
In-Reply-To: <DM4PR19MB5978D87984405FA500DECB9BD3DFA@DM4PR19MB5978.namprd19.prod.outlook.com>
References: <0100018b62722391-65a890bf-5d6b-415f-8831-bf8ae2a09fde-000000@email.amazonses.com>
<PH2P110MB0922514D54CCB31B5D85BA55FFDFA@PH2P110MB0922.NAMP110.PROD.OUTLOOK.COM>
<DM4PR19MB59784C59594057E868659666D3DFA@DM4PR19MB5978.namprd19.prod.outlook.com>
<c09be485-2d50-4362-90dd-94b808eadabb@gmail.com>
<DM4PR19MB59788643959C454261040B82D3DFA@DM4PR19MB5978.namprd19.prod.outlook.com>
<e5e9e6d2-ccaf-4780-baf1-28a9c9cb96c6@gmail.com>
<DM4PR19MB597878D5D9B7BEC82D527BD7D3DFA@DM4PR19MB5978.namprd19.prod.outlook.com>
<d4eef549-e0f6-43d6-8533-bcb016af198d@gmail.com>
<DM4PR19MB5978D87984405FA500DECB9BD3DFA@DM4PR19MB5978.namprd19.prod.outlook.com>
If you were, then you'd see all sorts of output from pg_dump and pg_restore.
On 10/24/23 14:55, M Sarwar wrote:
> In both pg_dump and pg_restore commands, I am always using -v option which
> verbose mode. Without that I will not be able to know any status.
> All of my commands are using -v clause.
> Thanks,
> Sarwar
>
> ----------------------------------------------------------------------------
> *From:* Ron <ronljohnsonjr@gmail.com>
> *Sent:* Tuesday, October 24, 2023 3:43 PM
> *To:* pgsql-admin@lists.postgresql.org <pgsql-admin@lists.postgresql.org>
> *Subject:* Re: pg_restore is not working
> You're still doing something wrong. And "pg_restore --verbose" *does*
> throw errors.
>
> On 10/24/23 14:13, M Sarwar wrote:
>> Here is my update.
>> I was using pg_restore with -t 'schema-name.tablename'.
>>
>> After reading the document,
>> https://www.postgresql.org/docs/16/app-pgrestore.html
>> <https://www.postgresql.org/docs/16/app-pgrestore.html;, I tried to avoid
>> using the clause of -t in pg-restore command. I just restored the entire
>> which has just 1 table dump.
>>
>> In my opinion if there is any issue with -t clause in pg_restore, it
>> should through an error instead of it is simply coming out without
>> throwing any error.
>> Thanks,
>> Sarwar
>>
>> ----------------------------------------------------------------------------
>> *From:* Ron <ronljohnsonjr@gmail.com> <mailto:ronljohnsonjr@gmail.com>
>> *Sent:* Tuesday, October 24, 2023 1:56 PM
>> *To:* pgsql-admin@lists.postgresql.org
>> <mailto:pgsql-admin@lists.postgresql.org>
>> <pgsql-admin@lists.postgresql.org> <mailto:pgsql-admin@lists.postgresql.org>
>> *Subject:* Re: pg_restore is not working
>> 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@gmail.com> <mailto:ronljohnsonjr@gmail.com>
>>> *Sent:* Tuesday, October 24, 2023 1:08 PM
>>> *To:* pgsql-admin@lists.postgresql.org
>>> <mailto:pgsql-admin@lists.postgresql.org>
>>> <pgsql-admin@lists.postgresql.org> <mailto:pgsql-admin@lists.postgresql.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.
>
> --
> Born in Arizona, moved to Babylonia.
--
Born in Arizona, moved to Babylonia.
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-admin@postgresql.org
Cc: ronljohnsonjr@gmail.com, pgsql-admin@lists.postgresql.org
Subject: Re: pg_restore is not working
In-Reply-To: <27670a63-9dce-4b46-a56b-26cdc788ba06@gmail.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox