{"id":6413,"date":"2015-12-01T14:27:09","date_gmt":"2015-12-01T13:27:09","guid":{"rendered":"https:\/\/www.dbi-services.com\/blog\/patching-postgresql-to-a-new-minor-release\/"},"modified":"2015-12-01T14:27:09","modified_gmt":"2015-12-01T13:27:09","slug":"patching-postgresql-to-a-new-minor-release","status":"publish","type":"post","link":"https:\/\/www.dbi-services.com\/blog\/patching-postgresql-to-a-new-minor-release\/","title":{"rendered":"Patching PostgreSQL to a new minor release"},"content":{"rendered":"<p>If you are used to patch Oracle databases you probably know how to use opatch to apply PSUs. How does PostgreSQL handle this? Do we need to patch the existing binaries to apply security fixes? The answer is: No. <\/p>\n<p>Lets say you want to patch PostgreSQL from version 9.4.1 to version 9.4.5. What do you need to do? <\/p>\n<p>For this little demo I&#8217;ll create a new database and a sample table in my 9.4.1 instance:<\/p>\n<pre class=\"brush: sql; gutter: true; first-line: 1\">\n(postgres@[local]:5432) [postgres] &gt; select version();\n                                                         version                                                          \n--------------------------------------------------------------------------------------------------------------------------\n PostgreSQL 9.4.1 on x86_64-unknown-linux-gnu, compiled by gcc (GCC) 4.8.3 20140911 (Red Hat 4.8.3-9), 64-bit\n(1 row)\n\nTime: 0.483 ms\n(postgres@[local]:5432) [postgres] &gt; create database patch;\nCREATE DATABASE\nTime: 2533.745 ms\n(postgres@[local]:5432) [postgres] &gt; c patch\nYou are now connected to database \"patch\" as user \"postgres\".\n(postgres@[local]:5432)  &gt; create table test ( a int );\nCREATE TABLE\nTime: 2.430 ms\n(postgres@[local]:5432)  &gt; insert into test (a) values ( generate_series(1,100));\nINSERT 0 100\nTime: 0.959 ms\n<\/pre>\n<p>If I now want to bring this version to 9.4.5 the first step I&#8217;ll need to do is to install the 9.4.5 binaries in a separate path. The binaries for my 9.4.1 installation are located here:<\/p>\n<pre class=\"brush: sql; gutter: true; first-line: 1\">\npostgres@oel7:\/home\/postgres\/ [PG1] ps -ef | grep PG1\npostgres  2645     1  0 10:51 ?        00:00:00 \/u01\/app\/postgres\/product\/94\/db_1\/bin\/postgres -D \/u02\/pgdata\/PG1\npostgres 14439 11550  0 11:04 pts\/1    00:00:00 grep --color=auto PG1\n<\/pre>\n<p>I already installed the 9.4.5 binaries here:<\/p>\n<pre class=\"brush: sql; gutter: true; first-line: 1\">\npostgres@oel7:\/home\/postgres\/ [PG1] ls \/u01\/app\/postgres\/product\/94\/db_5\nbin  include  lib  share\n<\/pre>\n<p>The only tasks I need to do from here on are a) stop the 9.4.1 version:<\/p>\n<pre class=\"brush: sql; gutter: true; first-line: 1\">\npostgres@oel7:\/home\/postgres\/ [PG1] which pg_ctl\n\/u01\/app\/postgres\/product\/94\/db_1\/bin\/pg_ctl\npostgres@oel7:\/home\/postgres\/ [PG1] pg_ctl -D \/u02\/pgdata\/PG1 stop -m fast\nwaiting for server to shut down.... done\nserver stopped\npostgres@oel7:\/home\/postgres\/ [PG1] ps -ef | grep PG1\npostgres 14452 11550  0 11:06 pts\/1    00:00:00 grep --color=auto PG1\npostgres@oel7:\/home\/postgres\/ [PG1] \n<\/pre>\n<p>Once the old version is down I just can b) restart with the new binaries:<\/p>\n<pre class=\"brush: sql; gutter: true; first-line: 1\">\npostgres@oel7:\/home\/postgres\/ [PG1] which pg_ctl\n\/u01\/app\/postgres\/product\/94\/db_5\/bin\/pg_ctl\npostgres@oel7:\/home\/postgres\/ [PG1] pg_ctl -D \/u02\/pgdata\/PG1 start\nserver starting\npostgres@oel7:\/home\/postgres\/ [PG1] LOG:  database system was shut down at 2015-12-01 11:06:31 CET\nLOG:  MultiXact member wraparound protections are now enabled\nLOG:  database system is ready to accept connections\nLOG:  autovacuum launcher started\n<\/pre>\n<p>That&#8217;s it. The new version is now 9.4.5:<\/p>\n<pre class=\"brush: sql; gutter: true; first-line: 1\">\n(postgres@[local]:5432) [postgres] &gt; select version();\n                                                   version                                                    \n--------------------------------------------------------------------------------------------------------------\n PostgreSQL 9.4.5 on x86_64-unknown-linux-gnu, compiled by gcc (GCC) 4.8.3 20140911 (Red Hat 4.8.3-9), 64-bit\n(1 row)\n\nTime: 20.725 ms\n(postgres@[local]:5432) [postgres] &gt; c patch\nYou are now connected to database \"patch\" as user \"postgres\".\n(postgres@[local]:5432)  &gt; select count(*) from test;\n count \n-------\n   100\n(1 row)\n\nTime: 104.297 ms\n<\/pre>\n<p>Usually, for minor versions, you can just install the new binaries and start the instance from there. But anyway, be sure to read the <a href=\"http:\/\/www.postgresql.org\/docs\/current\/interactive\/release.html\" target=\"_blank\" rel=\"noopener\">release notes<\/a> before doing it.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>If you are used to patch Oracle databases you probably know how to use opatch to apply PSUs. How does PostgreSQL handle this? Do we need to patch the existing binaries to apply security fixes? The answer is: No. Lets say you want to patch PostgreSQL from version 9.4.1 to version 9.4.5. What do you [&hellip;]<\/p>\n","protected":false},"author":29,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[229],"tags":[155,77],"type_dbi":[],"class_list":["post-6413","post","type-post","status-publish","format-standard","hentry","category-database-administration-monitoring","tag-patching","tag-postgresql"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v27.2 (Yoast SEO v27.4) - https:\/\/yoast.com\/product\/yoast-seo-premium-wordpress\/ -->\n<title>Patching PostgreSQL to a new minor release - dbi Blog<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.dbi-services.com\/blog\/patching-postgresql-to-a-new-minor-release\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Patching PostgreSQL to a new minor release\" \/>\n<meta property=\"og:description\" content=\"If you are used to patch Oracle databases you probably know how to use opatch to apply PSUs. How does PostgreSQL handle this? Do we need to patch the existing binaries to apply security fixes? The answer is: No. Lets say you want to patch PostgreSQL from version 9.4.1 to version 9.4.5. What do you [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.dbi-services.com\/blog\/patching-postgresql-to-a-new-minor-release\/\" \/>\n<meta property=\"og:site_name\" content=\"dbi Blog\" \/>\n<meta property=\"article:published_time\" content=\"2015-12-01T13:27:09+00:00\" \/>\n<meta name=\"author\" content=\"Daniel Westermann\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@westermanndanie\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Daniel Westermann\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/patching-postgresql-to-a-new-minor-release\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/patching-postgresql-to-a-new-minor-release\\\/\"},\"author\":{\"name\":\"Daniel Westermann\",\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/#\\\/schema\\\/person\\\/8d08e9bd996a89bd75c0286cbabf3c66\"},\"headline\":\"Patching PostgreSQL to a new minor release\",\"datePublished\":\"2015-12-01T13:27:09+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/patching-postgresql-to-a-new-minor-release\\\/\"},\"wordCount\":187,\"commentCount\":0,\"keywords\":[\"Patching\",\"PostgreSQL\"],\"articleSection\":[\"Database Administration &amp; Monitoring\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/patching-postgresql-to-a-new-minor-release\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/patching-postgresql-to-a-new-minor-release\\\/\",\"url\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/patching-postgresql-to-a-new-minor-release\\\/\",\"name\":\"Patching PostgreSQL to a new minor release - dbi Blog\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/#website\"},\"datePublished\":\"2015-12-01T13:27:09+00:00\",\"author\":{\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/#\\\/schema\\\/person\\\/8d08e9bd996a89bd75c0286cbabf3c66\"},\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/patching-postgresql-to-a-new-minor-release\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/patching-postgresql-to-a-new-minor-release\\\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/patching-postgresql-to-a-new-minor-release\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Accueil\",\"item\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Patching PostgreSQL to a new minor release\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/\",\"name\":\"dbi Blog\",\"description\":\"\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/#\\\/schema\\\/person\\\/8d08e9bd996a89bd75c0286cbabf3c66\",\"name\":\"Daniel Westermann\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/31350ceeecb1dd8986339a29bf040d4cd3cd087d410deccd8f55234466d6c317?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/31350ceeecb1dd8986339a29bf040d4cd3cd087d410deccd8f55234466d6c317?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/31350ceeecb1dd8986339a29bf040d4cd3cd087d410deccd8f55234466d6c317?s=96&d=mm&r=g\",\"caption\":\"Daniel Westermann\"},\"description\":\"Daniel Westermann is Principal Consultant and Technology Leader Open Infrastructure at dbi services. He has more than 15 years of experience in management, engineering and optimization of databases and infrastructures, especially on Oracle and PostgreSQL. Since the beginning of his career, he has specialized in Oracle Technologies and is Oracle Certified Professional 12c and Oracle Certified Expert RAC\\\/GridInfra. Over time, Daniel has become increasingly interested in open source technologies, becoming \u201cTechnology Leader Open Infrastructure\u201d and PostgreSQL expert. \u00a0Based on community or EnterpriseDB tools, he develops and installs complex high available solutions with PostgreSQL. He is also a certified PostgreSQL Plus 9.0 Professional and a Postgres Advanced Server 9.4 Professional. He is a regular speaker at PostgreSQL conferences in Switzerland and Europe. Today Daniel is also supporting our customers on AWS services such as AWS RDS, database migrations into the cloud, EC2 and automated infrastructure management with AWS SSM (System Manager). He is a certified AWS Solutions Architect Professional. Prior to dbi services, Daniel was Management System Engineer at LC SYSTEMS-Engineering AG in Basel. Before that, he worked as Oracle Developper &amp;\u00a0Project Manager at Delta Energy Solutions AG in Basel (today Powel AG). Daniel holds a diploma in Business Informatics (DHBW, Germany). His branch-related experience mainly covers the pharma industry, the financial sector, energy, lottery and telecommunications.\",\"sameAs\":[\"https:\\\/\\\/x.com\\\/westermanndanie\"],\"url\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/author\\\/daniel-westermann\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"Patching PostgreSQL to a new minor release - dbi Blog","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.dbi-services.com\/blog\/patching-postgresql-to-a-new-minor-release\/","og_locale":"en_US","og_type":"article","og_title":"Patching PostgreSQL to a new minor release","og_description":"If you are used to patch Oracle databases you probably know how to use opatch to apply PSUs. How does PostgreSQL handle this? Do we need to patch the existing binaries to apply security fixes? The answer is: No. Lets say you want to patch PostgreSQL from version 9.4.1 to version 9.4.5. What do you [&hellip;]","og_url":"https:\/\/www.dbi-services.com\/blog\/patching-postgresql-to-a-new-minor-release\/","og_site_name":"dbi Blog","article_published_time":"2015-12-01T13:27:09+00:00","author":"Daniel Westermann","twitter_card":"summary_large_image","twitter_creator":"@westermanndanie","twitter_misc":{"Written by":"Daniel Westermann","Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.dbi-services.com\/blog\/patching-postgresql-to-a-new-minor-release\/#article","isPartOf":{"@id":"https:\/\/www.dbi-services.com\/blog\/patching-postgresql-to-a-new-minor-release\/"},"author":{"name":"Daniel Westermann","@id":"https:\/\/www.dbi-services.com\/blog\/#\/schema\/person\/8d08e9bd996a89bd75c0286cbabf3c66"},"headline":"Patching PostgreSQL to a new minor release","datePublished":"2015-12-01T13:27:09+00:00","mainEntityOfPage":{"@id":"https:\/\/www.dbi-services.com\/blog\/patching-postgresql-to-a-new-minor-release\/"},"wordCount":187,"commentCount":0,"keywords":["Patching","PostgreSQL"],"articleSection":["Database Administration &amp; Monitoring"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.dbi-services.com\/blog\/patching-postgresql-to-a-new-minor-release\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.dbi-services.com\/blog\/patching-postgresql-to-a-new-minor-release\/","url":"https:\/\/www.dbi-services.com\/blog\/patching-postgresql-to-a-new-minor-release\/","name":"Patching PostgreSQL to a new minor release - dbi Blog","isPartOf":{"@id":"https:\/\/www.dbi-services.com\/blog\/#website"},"datePublished":"2015-12-01T13:27:09+00:00","author":{"@id":"https:\/\/www.dbi-services.com\/blog\/#\/schema\/person\/8d08e9bd996a89bd75c0286cbabf3c66"},"breadcrumb":{"@id":"https:\/\/www.dbi-services.com\/blog\/patching-postgresql-to-a-new-minor-release\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.dbi-services.com\/blog\/patching-postgresql-to-a-new-minor-release\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.dbi-services.com\/blog\/patching-postgresql-to-a-new-minor-release\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Accueil","item":"https:\/\/www.dbi-services.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Patching PostgreSQL to a new minor release"}]},{"@type":"WebSite","@id":"https:\/\/www.dbi-services.com\/blog\/#website","url":"https:\/\/www.dbi-services.com\/blog\/","name":"dbi Blog","description":"","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.dbi-services.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/www.dbi-services.com\/blog\/#\/schema\/person\/8d08e9bd996a89bd75c0286cbabf3c66","name":"Daniel Westermann","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/31350ceeecb1dd8986339a29bf040d4cd3cd087d410deccd8f55234466d6c317?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/31350ceeecb1dd8986339a29bf040d4cd3cd087d410deccd8f55234466d6c317?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/31350ceeecb1dd8986339a29bf040d4cd3cd087d410deccd8f55234466d6c317?s=96&d=mm&r=g","caption":"Daniel Westermann"},"description":"Daniel Westermann is Principal Consultant and Technology Leader Open Infrastructure at dbi services. He has more than 15 years of experience in management, engineering and optimization of databases and infrastructures, especially on Oracle and PostgreSQL. Since the beginning of his career, he has specialized in Oracle Technologies and is Oracle Certified Professional 12c and Oracle Certified Expert RAC\/GridInfra. Over time, Daniel has become increasingly interested in open source technologies, becoming \u201cTechnology Leader Open Infrastructure\u201d and PostgreSQL expert. \u00a0Based on community or EnterpriseDB tools, he develops and installs complex high available solutions with PostgreSQL. He is also a certified PostgreSQL Plus 9.0 Professional and a Postgres Advanced Server 9.4 Professional. He is a regular speaker at PostgreSQL conferences in Switzerland and Europe. Today Daniel is also supporting our customers on AWS services such as AWS RDS, database migrations into the cloud, EC2 and automated infrastructure management with AWS SSM (System Manager). He is a certified AWS Solutions Architect Professional. Prior to dbi services, Daniel was Management System Engineer at LC SYSTEMS-Engineering AG in Basel. Before that, he worked as Oracle Developper &amp;\u00a0Project Manager at Delta Energy Solutions AG in Basel (today Powel AG). Daniel holds a diploma in Business Informatics (DHBW, Germany). His branch-related experience mainly covers the pharma industry, the financial sector, energy, lottery and telecommunications.","sameAs":["https:\/\/x.com\/westermanndanie"],"url":"https:\/\/www.dbi-services.com\/blog\/author\/daniel-westermann\/"}]}},"_links":{"self":[{"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/posts\/6413","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/users\/29"}],"replies":[{"embeddable":true,"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/comments?post=6413"}],"version-history":[{"count":0,"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/posts\/6413\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/media?parent=6413"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/categories?post=6413"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/tags?post=6413"},{"taxonomy":"type","embeddable":true,"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/type_dbi?post=6413"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}