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 1g05qD-0007v4-SP for pgsql-general@arkaria.postgresql.org; Wed, 12 Sep 2018 14:10:02 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1g05qB-0006Ho-Mj for pgsql-general@arkaria.postgresql.org; Wed, 12 Sep 2018 14:09:59 +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 1g05qA-0006Hf-6P for pgsql-general@lists.postgresql.org; Wed, 12 Sep 2018 14:09:59 +0000 Received: from out1-smtp.messagingengine.com ([66.111.4.25]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1g05pt-0003sA-HL for pgsql-general@lists.postgresql.org; Wed, 12 Sep 2018 14:09:57 +0000 Received: from compute6.internal (compute6.nyi.internal [10.202.2.46]) by mailout.nyi.internal (Postfix) with ESMTP id B6C6D21CFC; Wed, 12 Sep 2018 10:09:39 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute6.internal (MEProxy); Wed, 12 Sep 2018 10:09:39 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aklaver.com; h= content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-sender :x-me-sender:x-sasl-enc; s=fm3; bh=QZMxpMYwk3ca3PfJxzMYOeU+IcFgA QuUpl4TKxK1NME=; b=wIO0CpIHcB6/cufqQ2SpavjT56QMgfzt4W+IYwjmXJZpq CuUeYZVudDIvRkN4EzSoiItTZIyPBUCuY1G8+lUu0zXJUzsnZHBFc3CEJSO2JZnL 2sssAfFAC1JA+ZGrig5HnFLNHehKYLo/KDe2AJYzOGI+NzGmI7U2Kq0kJ3Y0hzMw SMJrpvuA/PawKjHRVoGEBiEZs6sdcF7n4qYK/DAMWLVbj1GRMipbJQhWi+ZPr3yq DW7RPccfwrOCYVu8peamlAEZBk5fGXrfnPLYWRVUm7UHFXEWePAHycKFhSIAVFdg L2SZXdhl9UQj27hhpWadZdxapAXFKUMLLUyyWteow== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-sender:x-me-sender:x-sasl-enc; s=fm3; bh=QZMxpM Ywk3ca3PfJxzMYOeU+IcFgAQuUpl4TKxK1NME=; b=gjlflyfOlJPK2kJIXjTjwy 3BH45MhWGQ0MBhqeTIIfp8TfPjPCbdGF4GhMH5xKRfisB1uqI4roNDC4gUIynOPc bbmpU8fUZrVKDUEXLI5AIl3WFSFPMCt/qmTV5WzuTt2g4ZgvNWsmtnI3V+DK0MKG opMSZ4XjUwKCStpRk5QAwY+J6U8p7vOaDGSEUgeCfTU82zPduLISUBWt4ejWjfZb /HaeXkldIicaVj2R+0zNoK9PVWz/vz9T5+vyUirtbbP7tNvG4q2Fbt7/3KbsLxZn A3QaWBpcfXbGC6EHPBKe7zO9XnBgpRc+2eZQZ/BHNTa922XIynekwVqmKVikhYhA == X-ME-Proxy: X-ME-Sender: Received: from [192.168.1.3] (unknown [71.212.134.3]) by mail.messagingengine.com (Postfix) with ESMTPA id CE589102DA; Wed, 12 Sep 2018 10:09:38 -0400 (EDT) Subject: Re: PG9.1 migration to PG9.6, dump/restore issues To: Scot Kreienkamp , "pgsql-general@lists.postgresql.org" References: <17082AAFC33A934082836458CB53494374C993BD@MONDB03.na.lzb.hq> From: Adrian Klaver Message-ID: <88e20905-8400-1781-9d11-0efe6f60dfef@aklaver.com> Date: Wed, 12 Sep 2018 07:09:38 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.0 MIME-Version: 1.0 In-Reply-To: <17082AAFC33A934082836458CB53494374C993BD@MONDB03.na.lzb.hq> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 9/12/18 6: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 > > Restore completes successfully, but I noticed that the schema > permissions are missing, possibly others as well (Is this a known > issue?).  So instead, I tried backing up and restoring the schema only Did you see errors in the restore? In particular about not finding roles(users) for the permissions? I ask because I do not see in the above anything about dumping objects global to the cluster. That would include roles. I use: pg_dumpall -g -f globals.sql See: https://www.postgresql.org/docs/10/static/app-pg-dumpall.html > as single threaded dump and restore, then dumping the data > multi-threaded using the PG9.6 tools, then doing a multi-threaded > data-only restore using PG9.6 tools into the already existing schema. > > These are the commands I’m using now: > > pg_dump -sh $OLDSERVER  $DATABASE -f $BACKUPPATH/$DATABASE.schema.sql > > pg_dump -vj 4 -F d -h $OLDSERVER  $DATABASE -f $BACKUPPATH/DATABASE > --no-synchronized-snapshots > > createdb $DATABASE > > psql –d $DATABASE –f $BACKUPPATH/$DATABASE.schema.sql > > pg_restore -evj 4 -d $DATABASE  $BACKUPPATH/$DATABASE   -a > --disable-triggers > > That seemed to work OK so far, but the missing schema permissions from > my first try has me spooked.  Are there any problems with attempting > this type of backup/restore?  Would I be better off using the commands > from my first attempt and reapplying permissions?  Or is doing a single > threaded dump my only option to get a good backup?  I have to be able to > revert to the old server as this is production, so doing in place > upgrades are not possible… the original server has to remain pristine. > > Thanks! > > *Scot Kreienkamp | Senior Systems Engineer | La-Z-Boy Corporate* > One La-Z-Boy Drive | Monroe, Michigan 48162  |( 734-384-6403| > |)7349151444| * Scot.Kreienkamp@la-z-boy.com > www .la-z-boy.com | > facebook. com > / > lazboy  | > twitter.com/lazboy | youtube.com/ > lazboy > > > This messageis intended onlyfor the individual or entity to which it is > addressed.  It may contain privileged, confidential information which is > exempt from disclosure under applicable laws.  If you are not the > intended recipient, you are strictly prohibited from disseminating or > distributing this information (other than to the intended recipient) or > copying this information.  If you have received this communication in > error, please notify us immediately by e-mail or by telephone at the > above number. Thank you. > -- Adrian Klaver adrian.klaver@aklaver.com