On 10/22/22 16:29, Adrian Klaver wrote:
> On 10/22/22 14:02, Ron wrote:
>> On 10/22/22 12:00, Adrian Klaver wrote:
>>> On 10/22/22 09:41, Ron wrote:
>>>> On 10/22/22 11:20, Adrian Klaver wrote:
>>>>> On 10/20/22 14:34, Ron wrote:
>>>>>> On 10/20/22 10:02, Adrian Klaver wrote:
>>>>>>> On 10/20/22 06:20, Ron wrote:
>>>>>>>> On 10/20/22 00:12, Tom Lane wrote:
>>>>>
>>>
>>>> I was afraid you were going to say that.
>>>>
>>>> The work-around is to:
>>>> pg_dump $SRCDB --schema-only | grep -e '^\(GRANT|REVOKE\)' > all_GRANT.sql
>>>> pg_dump $SRCDB --schema-only | grep OWNER > all_OWNER.sql
>>>> pg_restore --jobs=X --no-owner $NEWDB
>>>
>>> The above and below have me confused.
>>>
>>> What is $NEWDB?
>>>
>>> In above it seems to be a file and below a database name.
>>
>> Consider it pseudo-code.
>
> To pseudo for me.
>
> What file exactly is:
>
> pg_restore --jobs=X --no-owner $NEWDB
>
> restoring?
>
> And how was that file created?
>
> Knowing this might help get at why the more straight forward method does
> not work.
This is what I ran to restore the database:
export PGHOST=${RDSENV}.xxxxxxxxxxxx.us-east-1.rds.amazonaws.com
cd /migrate/TASK001793786/2022-10-19b
NEWDB=sides
pg_restore -v --create --clean --no-owner --jobs=`nproc` -Fd
--dbname=template1 $NEWDB
psql $NEWDB -f all_OWNER.sql
psql $NEWDB -f all_GRANT.sql
The name of the database is "sides", and there's a directorynamed "sides"
under /migrate/TASK001793786/2022-10-19b.
>>
>>>
>>>> psql $NEWDB -f all_OWNER.sql
>>>> psql $NEWDB -f all_GRANT.sql
>>>>
>>>> This is, of course, why we need to test the backup/restore process.
>>>>
>>>
>>
>
--
Angular momentum makes the world go 'round.