Re: Upgrade to 12.2 using same data directory

Поиск
Список
Период
Сортировка
От Paul Förster
Тема Re: Upgrade to 12.2 using same data directory
Дата
Msg-id C2228486-FB85-4AA3-B143-3C256924C293@gmail.com
обсуждение исходный текст
Ответ на RE: Upgrade to 12.2 using same data directory  (Mihalidesová Jana <jana.mihalidesova@cetin.cz>)
Список pgsql-general
Hi J,

you can do the following:

mkdir /alias/data/dbname-new
initdb -D /alias/data/dbname-new
pg_upgrade \
    -b /old/bin/dir \
    -B /new/bin/dir \
    -d /alias/data/dbname \
    -D /alias/data/dbname-new \
    -k

After the successful upgrade:

rm -rf /alias/data/dbname
mv /alias/data/dbname-new /alias/data/dbname

This is how I always do it. You can't initialize a new database cluster into the same data directory as the old
one(!!),which makes sense, but which is exactly what you are trying to do and why it fails on you. Doing it the way
describedabove has the advantages, that 

a) you don't need double disk space, espacially in a commercial environment, and which is ugly if pg_upgrade has to
copyterabytes of data, and 

b) saves time because there is no file copy, and

c) you then have the same data directory naming conventions that you are used to

Also see:

initdb --help
pg_upgrade --help

You can properly put this into a script. My last migrations (11.5 to 12.1) took about 18 seconds each. This
interruptionusually can be communicated to the users. 

If they're used to Oracle, they're used to interruptions in the range 90-120 minutes. :-D So there should be no
problemswith about a minute! But that of course requires proper planning and proper scripting. :-) Practice that
(includingthe scripting!) on an identical test database setup in advance. 

Hope this helps,
Paul


> On 25. Feb, 2020, at 13:52, Mihalidesová Jana <jana.mihalidesova@cetin.cz> wrote:
>
> I think it’s strange to change the data directory $PATH every time I upgrade the software, when the data are the
same.I have a specific naming convention not using a db version. 
>
> /alias/data/<db_name>
>
> J
>
> From: Josef Šimánek <josef.simanek@gmail.com>
> Sent: Tuesday, February 25, 2020 1:05 PM
> To: Mihalidesová Jana <jana.mihalidesova@cetin.cz>
> Cc: pgsql-general@lists.postgresql.org
> Subject: Re: Upgrade to 12.2 using same data directory
>
> I think that's not possible. What's the reason to reuse old directory?
>
> út 25. 2. 2020 v 12:59 odesílatel Mihalidesová Jana <jana.mihalidesova@cetin.cz> napsal:
> Hi,
>
> Is there possibility to upgrade from 10.6 to 12.2 using exact same data directory? First problem is with initialing
of“new” cluster. Then pg_upgrade check fail. 
>
>
> ./pg_upgrade -b $OLD/bin -B $NEWd/bin -d $OLD -D $OLD -k -c
>
>
> Thx,
> Jana
>
>
> Obsah této zprávy má výlučně komunikační charakter. Nepředstavuje návrh na uzavření smlouvy či na její změnu ani
přijetípřípadného návrhu. Smlouvy či jejich změny jsou společností CETIN a.s. uzavírány v písemné formě nebo v podobě a
postupempodle příslušných všeobecných podmínek společnosti CETIN a.s., a pokud jsou dohodnuty všechny náležitosti.
Smlouvyjsou uzavírány oprávněnou osobou na základě písemného pověření. Smlouvy o smlouvě budoucí jsou uzavírány
výhradněv písemné formě, vlastnoručně podepsané nebo s uznávaným elektronickým podpisem. Podmínky, za nichž CETIN a.s.
přistupujek jednání o smlouvě a jakými se řídí, jsou dostupné zde. 
>
> The content of this message is intended for communication purposes only. It does neither represent any contract
proposal,nor its amendment or acceptance of any potential contract proposal. CETIN a.s. concludes contracts or
amendmentsthereto in a written form or in the form and the procedure in accordance with relevant general terms and
conditionsof CETIN a.s., if all requirements are agreed. Contracts are concluded by an authorized person entitled on
thebasis of a written authorization. Contracts on a future contract are concluded solely in a written form, self-signed
orsigned by means of an advanced electronic signature. The conditions under which CETIN a.s. negotiates contracts and
underwhich it proceeds are available here. 
>
>
> Obsah této zprávy má výlučně komunikační charakter. Nepředstavuje návrh na uzavření smlouvy či na její změnu ani
přijetípřípadného návrhu. Smlouvy či jejich změny jsou společností CETIN a.s. uzavírány v písemné formě nebo v podobě a
postupempodle příslušných všeobecných podmínek společnosti CETIN a.s., a pokud jsou dohodnuty všechny náležitosti.
Smlouvyjsou uzavírány oprávněnou osobou na základě písemného pověření. Smlouvy o smlouvě budoucí jsou uzavírány
výhradněv písemné formě, vlastnoručně podepsané nebo s uznávaným elektronickým podpisem. Podmínky, za nichž CETIN a.s.
přistupujek jednání o smlouvě a jakými se řídí, jsou dostupné zde. 
>
> The content of this message is intended for communication purposes only. It does neither represent any contract
proposal,nor its amendment or acceptance of any potential contract proposal. CETIN a.s. concludes contracts or
amendmentsthereto in a written form or in the form and the procedure in accordance with relevant general terms and
conditionsof CETIN a.s., if all requirements are agreed. Contracts are concluded by an authorized person entitled on
thebasis of a written authorization. Contracts on a future contract are concluded solely in a written form, self-signed
orsigned by means of an advanced electronic signature. The conditions under which CETIN a.s. negotiates contracts and
underwhich it proceeds are available here. 




В списке pgsql-general по дате отправления:

Предыдущее
От: Sushant Pawar
Дата:
Сообщение: Re: Upgrade to 12.2 using same data directory
Следующее
От: Stephen Frost
Дата:
Сообщение: Re: Backup & Restore