Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1erRua-0000tz-6S for pgsql-general@arkaria.postgresql.org; Thu, 01 Mar 2018 17:22:32 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1erRuY-0004zu-Rl for pgsql-general@arkaria.postgresql.org; Thu, 01 Mar 2018 17:22:30 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1erRuY-0004zk-I7 for pgsql-general@lists.postgresql.org; Thu, 01 Mar 2018 17:22:30 +0000 Received: from eastrmfepo202.cox.net ([68.230.241.217]) by magus.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1erRuV-0005yo-2o for pgsql-general@lists.postgresql.org; Thu, 01 Mar 2018 17:22:30 +0000 Received: from eastrmimpo109.cox.net ([68.230.241.222]) by eastrmfepo202.cox.net (InterMail vM.8.01.05.28 201-2260-151-171-20160122) with ESMTP id <20180301172221.CEOT7489.eastrmfepo202.cox.net@eastrmimpo109.cox.net> for ; Thu, 1 Mar 2018 12:22:21 -0500 Received: from [192.168.1.10] ([70.171.109.83]) by eastrmimpo109.cox.net with cox id GhNL1x00q1o04Vy01hNLxt; Thu, 01 Mar 2018 12:22:21 -0500 X-Authority-Analysis: v=2.2 cv=bLhmGL2Z c=1 sm=1 tr=0 a=uCHdjGDeLqaieW9t8IbZ6A==:117 a=uCHdjGDeLqaieW9t8IbZ6A==:17 a=x7bEGLp0ZPQA:10 a=T11QR6bd6vIA:10 a=r77TgQKjGQsHNAKrUKIA:9 a=kviXuzpPAAAA:8 a=QSRvRZayCzGejTwT7HwA:9 a=QEXdDO2ut3YA:10 a=pGLkceISAAAA:8 a=CO-e5A8WYlDqN57rDPsA:9 a=QDe97Lvm5mJp4p3c:21 a=_W_S_7VecoQA:10 a=qrIFiuKZe2vaD64auk6j:22 X-CM-Score: 0.00 Authentication-Results: cox.net; auth=pass (PLAIN) smtp.auth=ron.l.johnson@cox.net Subject: Re: Version upgrade: is restoring the postgres database needed? To: pgsql-general@lists.postgresql.org References: <30fe4b25-14b1-4408-c3bf-f40c2299465f@cox.net> <9636317b-d071-e830-af31-c532f9572aa4@cox.net> <971d555e-545f-fc55-6637-cbfd5dfe44bb@cox.net> From: Ron Johnson Message-ID: Date: Thu, 1 Mar 2018 11:22:20 -0600 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 MIME-Version: 1.0 In-Reply-To: Content-Type: multipart/alternative; boundary="------------E0CCD2B6DEAD83E521BC1886" Content-Language: en-US List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk This is a multi-part message in MIME format. --------------E0CCD2B6DEAD83E521BC1886 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit On 03/01/2018 11:03 AM, Melvin Davidson wrote: > > > On Thu, Mar 1, 2018 at 11:51 AM, Ron Johnson > wrote: > > On 03/01/2018 10:37 AM, Vick Khera wrote: >> On Thu, Mar 1, 2018 at 11:15 AM, Ron Johnson > > wrote: >> >> No, I do: >> >> $ pg_dump -Fc PROD > PROD.pgdump >> $ pg_dump --globals-only postgres > globals.sql >> $ pg_dump -Fc postgres > postgres.pgdump >> >> >> That's how I back them up as well. You are correct that all you need >> to do is restore the globals.sql, then each "pgdump" file >> individually. Just ignore the warning when it tries to restore your >> initial postgres superuser, since it was created by the initdb already. >> >> You probably don't need the "postgres" db at all, since it is just >> there to allow the client to connect to something on initial install. >> Normally you don't use it in production. > > Good.  What, then, have I forgotten to restore such that the "Access > privileges" are showing on my current 9.2 servers, but not on the > newly-restored 9.6.6 server? > > *Current* > postgres=# \l >      List of databases >     Name     |  Owner   | Encoding | Collate   |    Ctype    |   > Access privileges > -------------+----------+----------+-------------+-------------+----------------------- > CSSCAT_STI   | CSS      | UTF8     | en_US.UTF-8 | en_US.UTF-8 | > CSS=CTc/CSS          + >              |          | |             |             | > =Tc/CSS              + >              |          | |             |             | app_user=CTc/CSS > CSSCAT_STIB  | CSS      | UTF8     | en_US.UTF-8 | en_US.UTF-8 | > CSS=CTc/CSS          + >              |          | |             |             | > =Tc/CSS              + >              |          | |             |             | app_user=CTc/CSS > CSSCAT_STIC  | CSS      | UTF8     | en_US.UTF-8 | en_US.UTF-8 | > CSS=CTc/CSS          + >              |          | |             |             | > =Tc/CSS              + >              |          | |             |             | app_user=CTc/CSS > > *Newly restored* > postgres=# \l >      List of databases >     Name     |  Owner   | Encoding | Collate   |    Ctype    |   > Access privileges > -------------+----------+----------+-------------+-------------+----------------------- > CSSCAT_STIB | CSS      | UTF8     | en_US.UTF-8 | en_US.UTF-8 | > CSSCAT_STIC | CSS      | UTF8     | en_US.UTF-8 | en_US.UTF-8 | > postgres    | postgres | UTF8     | en_US.UTF-8 | en_US.UTF-8 | > > > -- > Angular momentum makes the world go 'round. > > > *>$ pg_dump -Fc PROD > PROD.pgdump > >$ pg_dump --globals-only postgres > globals.sql > >$ pg_dump -Fc postgres > postgres.pgdump > > * > *The last I looked, pg_dump does not have a "--globals-only" > * > *Did you mean? > $ pg_dump -Fc PROD > PROD.pgdump > > $ pg_dumpall --globals-only postgres > globals.sql > OR > $ pg_dumpall -g > globals.sql > > $ pg_dump -Fc postgres > postgres.pgdump* Hmmm.  I just looked at the script, and it says: $ pg_dumpall --schema-only > globals.sql That's not good. -- Angular momentum makes the world go 'round. --------------E0CCD2B6DEAD83E521BC1886 Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: 8bit
On 03/01/2018 11:03 AM, Melvin Davidson wrote:


On Thu, Mar 1, 2018 at 11:51 AM, Ron Johnson <ron.l.johnson@cox.net> wrote:
On 03/01/2018 10:37 AM, Vick Khera wrote:
On Thu, Mar 1, 2018 at 11:15 AM, Ron Johnson <ron.l.johnson@cox.net> wrote:
No, I do:

$ pg_dump -Fc PROD > PROD.pgdump
$ pg_dump --globals-only postgres > globals.sql
$ pg_dump -Fc postgres > postgres.pgdump


That's how I back them up as well. You are correct that all you need to do is restore the globals.sql, then each "pgdump" file individually. Just ignore the warning when it tries to restore your initial postgres superuser, since it was created by the initdb already.

You probably don't need the "postgres" db at all, since it is just there to allow the client to connect to something on initial install. Normally you don't use it in production.

Good.  What, then, have I forgotten to restore such that the "Access privileges" are showing on my current 9.2 servers, but not on the newly-restored 9.6.6 server?

Current
postgres=# \l
                                   List of databases
    Name     |  Owner   | Encoding |   Collate   |    Ctype    |   Access privileges 
-------------+----------+----------+-------------+-------------+-----------------------
CSSCAT_STI   | CSS      | UTF8     | en_US.UTF-8 | en_US.UTF-8 | CSS=CTc/CSS          +
             |          |          |             |             | =Tc/CSS              +
             |          |          |             |             | app_user=CTc/CSS
CSSCAT_STIB  | CSS      | UTF8     | en_US.UTF-8 | en_US.UTF-8 | CSS=CTc/CSS          +
             |          |          |             |             | =Tc/CSS              +
             |          |          |             |             | app_user=CTc/CSS
CSSCAT_STIC  | CSS      | UTF8     | en_US.UTF-8 | en_US.UTF-8 | CSS=CTc/CSS          +
             |          |          |             |             | =Tc/CSS              +
             |          |          |             |             | app_user=CTc/CSS

Newly restored
postgres=# \l
                                   List of databases
    Name     |  Owner   | Encoding |   Collate   |    Ctype    |   Access privileges 
-------------+----------+----------+-------------+-------------+-----------------------
CSSCAT_STIB | CSS      | UTF8     | en_US.UTF-8 | en_US.UTF-8 |
CSSCAT_STIC | CSS      | UTF8     | en_US.UTF-8 | en_US.UTF-8 |
postgres    | postgres | UTF8     | en_US.UTF-8 | en_US.UTF-8 |


--
Angular momentum makes the world go 'round.

>$ pg_dump -Fc PROD > PROD.pgdump
>$ pg_dump --globals-only postgres > globals.sql
>$ pg_dump -Fc postgres > postgres.pgdump

The last I looked, pg_dump does not have a "--globals-only"
Did you mean?
$ pg_dump -Fc PROD > PROD.pgdump

$ pg_dumpall --globals-only postgres > globals.sql

OR
$ pg_dumpall -g > globals.sql

$ pg_dump -Fc postgres > postgres.pgdump

Hmmm.  I just looked at the script, and it says:

$ pg_dumpall --schema-only > globals.sql

That's not good.


--
Angular momentum makes the world go 'round.
--------------E0CCD2B6DEAD83E521BC1886--