Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1olZIs-00064r-Uc for pgsql-general@arkaria.postgresql.org; Thu, 20 Oct 2022 17:25:58 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1olZIr-0005hB-4P for pgsql-general@arkaria.postgresql.org; Thu, 20 Oct 2022 17:25:57 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1olZIq-0005h1-N7 for pgsql-general@lists.postgresql.org; Thu, 20 Oct 2022 17:25:56 +0000 Received: from mail-oa1-x33.google.com ([2001:4860:4864:20::33]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1olZIo-0002KD-5J for pgsql-general@lists.postgresql.org; Thu, 20 Oct 2022 17:25:55 +0000 Received: by mail-oa1-x33.google.com with SMTP id 586e51a60fabf-131dda37dddso466499fac.0 for ; Thu, 20 Oct 2022 10:25:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:in-reply-to:from:references:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=BvL1M8i++spvhUGQv7DuRRZ+Pc3pJ/6TgnTN9BRJMF8=; b=ckzuN2fwiPg0dISKKlQipMiwKiCJAedwikB2nfuzsGCAhy7fxNSWHgveW4FcHAvxYk zeCsO8C1PeY6Hd+SLEj155FdQhjdPsU2iT0uRfTmR/jKqdnsvn2O+Ybi2C4K/yC/3Jqe rIpYxqdlOyu0ftdvpalXmEJgdxJf7thKMl6ZUEFupsrWwOYN8KFTDC1gg/DNl6274tEk iE4gCdvD7Fcj4L8LZLjVu0HZwWB5lnFl7JAk6dSebfU7rJpUvq1BgLikbPVhRMXspOq5 3f0Iy1CnB+EhOQ64FygPF1yEbBET35dTd11bvhF80dRSQQ8bLg7FaFxg3XD1ud9CxAp1 xP/w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:in-reply-to:from:references:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=BvL1M8i++spvhUGQv7DuRRZ+Pc3pJ/6TgnTN9BRJMF8=; b=l78XG74xyuAS7YZguXYw+8aQoF/mNVXIiWkIqhO1EBIYMHRnpHRbDEXIsuHa61tfM/ 4FPd79evL740WvHgKUrKoWF8aHhpYTOqGOhmSxKkRD9TJhrFTcdVkwmHcnGrl+xibx7R qgEFHJLRcd1fYO10fVi1+e9dc6Zs135I348by8XRTDskFDwDWufpRx+MJEcLlTsISR4G 74FwYjIo7MseIWLD5ar1FgeCoVn+q0KUbF8kMK/xFLS7fpuKpnObcx4hu70h9VXp5uLH IlBs6XNmHqRIuyJsbtQeWp4bYu8+s2yQf9IYIojzyWgazWDVYAt5rB0NYcl3W7nyWNfD c1SA== X-Gm-Message-State: ACrzQf3e5sejCKkniT2WPEa8lRQHR+ZtV3IsOns+bcHs4L3HKlZuqcmh MWfiNqTjCo2WgRa0fTZqR9fOAhYWtHA= X-Google-Smtp-Source: AMsMyM4TioXV9dhsGi9rWUFtrhVBS3P6c/tFAhfUIHN++wIBd35fCJqeSPEG8z8grIdDcKl3tA5XKQ== X-Received: by 2002:a05:6870:390b:b0:132:9ca3:8dc1 with SMTP id b11-20020a056870390b00b001329ca38dc1mr9594488oap.106.1666286753008; Thu, 20 Oct 2022 10:25:53 -0700 (PDT) Received: from [192.168.88.10] (ip68-11-68-85.no.no.cox.net. [68.11.68.85]) by smtp.googlemail.com with ESMTPSA id a5-20020a05680802c500b0034fd36e95bfsm156451oid.31.2022.10.20.10.25.52 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 20 Oct 2022 10:25:52 -0700 (PDT) Message-ID: Date: Thu, 20 Oct 2022 12:25:51 -0500 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.2.2 Subject: Re: pg_restore 12 "permission denied for schema" errors Content-Language: en-US To: pgsql-general@lists.postgresql.org References: <287717df-88e2-a4a5-2025-260c39662bca@gmail.com> <40fd91d2-d981-2f44-4d58-a3f08a9448fb@familie-gard.de> <2980993.1666242738@sss.pgh.pa.us> From: Ron In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk 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: >>> Frank Gard writes: >>>> Am 20.10.22 um 02:58 schrieb Ron: >>>>> pg_restore -v --create --clean --jobs=`nproc` -Fd --dbname=template1 $DB >>>> What database do you want to restore your data into? As far as I know >>>> your pg_restore command would import the data into template1, right? >>> No --- my ears went up about that too, but he's using --create. >>> So template1 is just the springboard for the initial connection >>> in which CREATE DATABASE will be issued. >>> >>> My guess is that there's something inconsistent between source >>> and target installations about roles and role-privilege grants. >>> We don't have enough details to do more than guess, though. >> >> I ran "pg_dumpall --globals-only --no-role-passwords" on the source >> instance, and applied it to the new instance before doing the pg_restore. >> If I hadn't done that, pg_restore would have thrown errors on all the >> GRANT and ALTER TABLE ... OWNER TO statements embedded in the backup. >> > > Some questions: > > 1) The backup was from a Postgres 12.x database using a version 12 or > higher instance of pg_backup? The data is in an RDS Postgresql 12.11 instance. pg_dump on the "client" Linux VM is v12.12 or 12.11 from RHEL8 packages. (Don't remember the exact version ATM.) > 2) What does nproc --jobs=`nproc` resolve to? Two CPUs on the VM. > 3) What if you run without --jobs? I can test that, but will be under serious time constraints during the maintenance window.  Heavily parallel dump and restore are imperative. > 4) What user are you running the pg_restore as? PGUSER=postgres > 5) Why the --no-role-passwords in the pg_dump? That's a requirement for AWS RDS.  User postgres does not have privs to dump the password hash from pg_authid. -- Angular momentum makes the world go 'round.