Received: from malur.postgresql.org ([2a02:16a8:dc51::56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1g06Jg-00019v-1s for pgsql-general@arkaria.postgresql.org; Wed, 12 Sep 2018 14:40:28 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1g06Je-0000Fm-Gc for pgsql-general@arkaria.postgresql.org; Wed, 12 Sep 2018 14:40:26 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1g06Jd-0000FT-VS for pgsql-general@lists.postgresql.org; Wed, 12 Sep 2018 14:40:26 +0000 Received: from mail-oi0-x242.google.com ([2607:f8b0:4003:c06::242]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1g06Ja-0006F5-A1 for pgsql-general@lists.postgresql.org; Wed, 12 Sep 2018 14:40:24 +0000 Received: by mail-oi0-x242.google.com with SMTP id y207-v6so4119601oie.13 for ; Wed, 12 Sep 2018 07:40:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:references:from:message-id:date:user-agent:mime-version :in-reply-to:content-language; bh=SkBiw9roOt0aSY7nESF4bcj1eT+5UghgK9elcOJMixQ=; b=uCw52vaNKU8ZXjTFaNFngko3F9bBIeGHJes8aCIFTboL5zcbqoJ7U+fgAQIC7C2Ix6 Ue4nKKEf/oF4AoC+Jw8hDJS5MNE8HBP30Nl1S/O7VGddaUnoeDbjARFB8htFsY1KpQj/ clGnLNsQKMF1Ilr1oLKrGLwTtBS2INO8h90OSkOk2JdOrmc/47e2rgczZmvWrjg+yO93 +hQIbWTqcZQGA2496beVG3eFqALaWLr+Q/A51HsTZzpp4K/KttHRWuLNCXef2vG7P/Q4 SgYlUZSTzsuii/OjG8Yi10vZHQtcVUO5VSTzUzGuhSQ70/Hw1UDUQ6jzEB0+mhUP+zzu k67g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language; bh=SkBiw9roOt0aSY7nESF4bcj1eT+5UghgK9elcOJMixQ=; b=AoUBC3Tso/yM8p3l+6966n3Ho//pBHcMnT24Cdp/AZAkF81b8zeNK4rcTKnkrBJ0CV hdGy56d2ss7+eAaQwI16olBkSn9dbHR3v1AwFRN7+YKBcrTqflmPuF9akN0O9DTyedel mpma2G3jgu/5WEntfGyB2tISMjUMT169TFtrN4xGvYGK5thVPPrzXVzGByCRSdMbKVn3 hc0KPiA1slAICrNZjkZa+ELBMfhN4LykZ9OArPmcCBMry+3rIxLkzIGPYTNSvjzjFuy3 i+F+Nkm4+quUkKV0EHEEKKQLqrQAVRHOQfF+zWXAt3c1l5D4FwkPjHsRGszqwvKaT4w5 zH2w== X-Gm-Message-State: APzg51BVALxmUxEgft9n1jkgUB40/k+QBVBOCTJAVb+YuYQoWhT5Xx26 QPK2PzMLYj3Q5dCFX2r8QBfLxUPm X-Google-Smtp-Source: ANB0Vdb2NJLcMMBOlnxtymJV2V+4ChLxSDDO+pHzMg1kZI549tK4pgOsQe2CFsBK5Sj+ld2HlgQxcg== X-Received: by 2002:aca:dbc2:: with SMTP id s185-v6mr2393250oig.251.1536763220970; Wed, 12 Sep 2018 07:40:20 -0700 (PDT) Received: from [192.168.1.10] (ip70-171-116-89.no.no.cox.net. [70.171.116.89]) by smtp.googlemail.com with ESMTPSA id m4-v6sm701668oic.34.2018.09.12.07.40.19 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 12 Sep 2018 07:40:19 -0700 (PDT) Subject: Re: PG9.1 migration to PG9.6, dump/restore issues To: pgsql-general@lists.postgresql.org References: <17082AAFC33A934082836458CB53494374C993BD@MONDB03.na.lzb.hq> From: Ron Message-ID: Date: Wed, 12 Sep 2018 09:40:19 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: <17082AAFC33A934082836458CB53494374C993BD@MONDB03.na.lzb.hq> Content-Type: multipart/alternative; boundary="------------9A1FCFD22020EF97DB4973DD" 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. --------------9A1FCFD22020EF97DB4973DD Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit On 09/12/2018 08:55 AM, Scot Kreienkamp wrote: > > Hi Everyone, > > I am working on a migration from PG9.1 to PG9.6.  Hoping some people can > chime in on my plans as I am running into some restore issues. > > We are upgrading to a new version of PG and migrating to new hardware with > RHEL 7, so I am planning on doing a dump and restore to get moved to the > new server.  My database is about 300 gigs, not huge but big enough that > doing a single threaded dump with multi-threaded restore is going to take > too much time for the window of opportunity I’ve been given.  I know I can > use multi-threaded restore on PG9.6 using the custom or directory formats, > but PG9.1 only supports single threaded dump.  To get around this I’m > going to disable all database access to the PG9.1 databases, then use the > PG9.6 tools to do a multi-threaded dump and then multi-threaded restore. > > These are the commands I was using: > > pg_dump -vj 4 -F d -h $OLDSERVER  $DATABASE -f $BACKUPPATH/DATABASE > --no-synchronized-snapshots > > created $DATABASE > > pg_restore -evj 4 -d $DATABASE $BACKUPPATH/$DATABASE   --disable-triggers > > This is almost exactly what I did when migrating from 8.4 to 9.6. As Adrian Klaver mentioned, you need to dump the globals and then run that script on the new database. No need to disable triggers, since it's "relevant only when performing a data-only restore", and you aren't doing a data-only restore.  Besides, pg_restore adds all that metadata -- including PKs, FKs, indexes, etc. to the db *after* the data is loaded. -- Angular momentum makes the world go 'round. --------------9A1FCFD22020EF97DB4973DD Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: 8bit On 09/12/2018 08:55 AM, Scot Kreienkamp wrote:

Hi Everyone,

 

I am working on a migration from PG9.1 to PG9.6.  Hoping some people can chime in on my plans as I am running into some restore issues.

 

We are upgrading to a new version of PG and migrating to new hardware with RHEL 7, so I am planning on doing a dump and restore to get moved to the new server.  My database is about 300 gigs, not huge but big enough that doing a single threaded dump with multi-threaded restore is going to take too much time for the window of opportunity I’ve been given.  I know I can use multi-threaded restore on PG9.6 using the custom or directory formats, but PG9.1 only supports single threaded dump.  To get around this I’m going to disable all database access to the PG9.1 databases, then use the PG9.6 tools to do a multi-threaded dump and then multi-threaded restore. 

 

These are the commands I was using:

pg_dump -vj 4 -F d -h $OLDSERVER  $DATABASE -f $BACKUPPATH/DATABASE --no-synchronized-snapshots

created $DATABASE

pg_restore -evj 4 -d $DATABASE  $BACKUPPATH/$DATABASE   --disable-triggers



This is almost exactly what I did when migrating from 8.4 to 9.6.  As Adrian Klaver mentioned, you need to dump the globals and then run that script on the new database.

No need to disable triggers, since it's "relevant only when performing a data-only restore", and you aren't doing a data-only restore.  Besides, pg_restore adds all that metadata -- including PKs, FKs, indexes, etc. to the db *after* the data is loaded.


--
Angular momentum makes the world go 'round.
--------------9A1FCFD22020EF97DB4973DD--