From: Wetmore, Matthew (CTR) <Matthew.Wetmore@express-scripts.com>
To: M Sarwar <sarwarmd02@outlook.com>
To: Scott Ribe <scott_ribe@elevated-dev.com>
Cc: pgsql-admin@postgresql.org <pgsql-admin@postgresql.org>
Subject: RE: pg_restore is not working
Date: Tue, 24 Oct 2023 17:25:02 +0000
Message-ID: <0ca8de602dab49a9af7ccce76bb842ef@express-scripts.com> (raw)
In-Reply-To: <DM4PR19MB5978B4199468F5A91916A619D3DFA@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>
<7102931C-1588-470F-95D7-39E50320690F@elevated-dev.com>
<DM4PR19MB597825D73A7EE2EE9FEB24DDD3DFA@DM4PR19MB5978.namprd19.prod.outlook.com>
<fbde87479dc04126a544eb86bdfbc736@express-scripts.com>
<DM4PR19MB5978B4199468F5A91916A619D3DFA@DM4PR19MB5978.namprd19.prod.outlook.com>
In AWS you need to use –dbname, not –d.
AWS postgres is their own, they have rewritten Postgres to their needs, you need to use AWS Postgres commands, not regular Postgres command. Some work, some don’t.
Best practices for migrating PostgreSQL databases to Amazon RDS and Amazon Aurora | AWS Database Blog<https://aws.amazon.com/blogs/database/best-practices-for-migrating-postgresql-databases-to-amazon-rd...;
From: M Sarwar <sarwarmd02@outlook.com>
Sent: Tuesday, October 24, 2023 10:18 AM
To: Wetmore, Matthew (CTR) <Matthew.Wetmore@express-scripts.com>; Scott Ribe <scott_ribe@elevated-dev.com>
Cc: pgsql-admin@postgresql.org
Subject: [EXTERNAL] Re: pg_restore is not working
Hi Matt,
I tried this approach. It is generating error when I am using the format of < filename with pg_restore.
Database location: aws/rds
Client where I am running pg-dump and pg-restore is from Windows laptop.
Thanks,
Sarwar
________________________________
From: Wetmore, Matthew (CTR) <Matthew.Wetmore@express-scripts.com<mailto:Matthew.Wetmore@express-scripts.com>>
Sent: Tuesday, October 24, 2023 1:05 PM
To: M Sarwar <sarwarmd02@outlook.com<mailto:sarwarmd02@outlook.com>>; Scott Ribe <scott_ribe@elevated-dev.com<mailto:scott_ribe@elevated-dev.com>>
Cc: pgsql-admin@postgresql.org<mailto:pgsql-admin@postgresql.org> <pgsql-admin@postgresql.org<mailto:pgsql-admin@postgresql.org>>
Subject: RE: pg_restore is not working
Pg_restore …blah.. < dumpfile.sql
From: M Sarwar <sarwarmd02@outlook.com<mailto:sarwarmd02@outlook.com>>
Sent: Tuesday, October 24, 2023 10:03 AM
To: Scott Ribe <scott_ribe@elevated-dev.com<mailto:scott_ribe@elevated-dev.com>>
Cc: pgsql-admin@postgresql.org<mailto:pgsql-admin@postgresql.org>
Subject: [EXTERNAL] Re: pg_restore is not working
Hi Scott,
When I tried to add -f in the pg_restore clause, it is generating error.
I tried to use another clause --file=file-name which is also generating errors.
PS H:\> pg_restore -F t -v -h bronxdb1.c52p1f6zjuib.us-gov-west-1.rds.amazonaws.com -U db_sarwar -d bronxdb1 -t 'bronxdev.errors' --file=C:\Mohammed\Work\NGC\Apps\Bronx\Backups\Dumps\data\backup_Dev_Bronxdev-Errors_20231024-5.DUMP
pg_restore: error: options -d/--dbname and -f/--file cannot be used together
Try "pg_restore --help" for more information.
PS H:\>
Thanks,
Sarwar
________________________________
From: Scott Ribe <scott_ribe@elevated-dev.com<mailto:scott_ribe@elevated-dev.com>>
Sent: Tuesday, October 24, 2023 12:56 PM
To: M Sarwar <sarwarmd02@outlook.com<mailto:sarwarmd02@outlook.com>>
Cc: pgsql-admin@postgresql.org<mailto:pgsql-admin@postgresql.org> <pgsql-admin@postgresql.org<mailto:pgsql-admin@postgresql.org>>
Subject: Re: pg_restore is not working
> On Oct 24, 2023, at 10:43 AM, M Sarwar <sarwarmd02@outlook.com<mailto:sarwarmd02@outlook.com>> 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
>
> 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
You're missing the -f on the pg_restore to take the dump from a file, so it's sitting waiting for SQL to come via stdin.
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: Matthew.Wetmore@express-scripts.com, sarwarmd02@outlook.com, scott_ribe@elevated-dev.com
Subject: RE: pg_restore is not working
In-Reply-To: <0ca8de602dab49a9af7ccce76bb842ef@express-scripts.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