Search Postgresql Archives

Re: Upgrade to 12.2 using same data directory

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 described above 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 copy terabytes 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 interruption usually 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 problems with about a minute! But that of course requires proper planning and proper scripting. :-) Practice that (including the scripting!) on an identical test database setup in advance.

Hope this helps,
Paul


> On 25. Feb, 2020, at 13:52, Mihalidesová Jana <jana.mihalidesova@xxxxxxxx> 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@xxxxxxxxx> 
> Sent: Tuesday, February 25, 2020 1:05 PM
> To: Mihalidesová Jana <jana.mihalidesova@xxxxxxxx>
> Cc: pgsql-general@xxxxxxxxxxxxxxxxxxxx
> 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@xxxxxxxx> 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 postupem podle příslušných všeobecných podmínek společnosti CETIN a.s., a pokud jsou dohodnuty všechny náležitosti. Smlouvy jsou 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řistupuje k 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 amendments thereto in a written form or in the form and the procedure in accordance with relevant general terms and conditions of CETIN a.s., if all requirements are agreed. Contracts are concluded by an authorized person entitled on the basis of a written authorization. Contracts on a future contract are concluded solely in a written form, self-signed or signed by means of an advanced electronic signature. The conditions under which CETIN a.s. negotiates contracts and under which 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 postupem podle příslušných všeobecných podmínek společnosti CETIN a.s., a pokud jsou dohodnuty všechny náležitosti. Smlouvy jsou 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řistupuje k 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 amendments thereto in a written form or in the form and the procedure in accordance with relevant general terms and conditions of CETIN a.s., if all requirements are agreed. Contracts are concluded by an authorized person entitled on the basis of a written authorization. Contracts on a future contract are concluded solely in a written form, self-signed or signed by means of an advanced electronic signature. The conditions under which CETIN a.s. negotiates contracts and under which it proceeds are available here.







[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]

  Powered by Linux