![]() ![]() The second script just deletes the old 9.2.x PGDATA directory, which I decided to do manually (see step 5 below). The first script just does a progressive vacuumdb on the new database (which you can run manually if needed). You don’t need to run either of these scripts. Running this script will delete the old cluster's data files: Once you start the new server, consider running: Optimizer statistics are not transferred by pg_upgrade so, Upon completion, you should see the following message: Upgrade Complete B /usr/local/Cellar/postgresql/9.3.0/bin/ \ ![]() Using pg_upgrade is straightforward: specify the old data and binaries ( -d and -b), the new data and binaries ( -D and -B), and it does its thing. ![]() Luckily PostgreSQL ships with a command to migrate to the new data directory format, as explained here. initdb /usr/local/var/postgres9.3 -E utf8 Since homebrew had already upgraded and linked the new version of the PostgreSQL 9.3 binaries, the initdb in this command is creating a 9.3 data directory. The upgrade process involves migrating data from an old data directory to a new one, so I had to create the new data directory first. Create a new PostgreSQL 9.3 data directory The first step is to tell launchd to stop the old version of PostgreSQL: launchctl unload ~/Library/LaunchAgents/Ģ. Since my PostgreSQL was installed via homebrew, it was being managed by Apple’s launchd system. Solution? Turn off launchd, migrate the data directory to the new 9.3 format, and start it back up. I also found these messages in the Console app, as launchd stubbornly tried to keep restarting the server: 9/21/13 10:36:37.864 AM .501: () Exited with code: 1ĩ/21/13 10:36:37.864 AM .501: () Throttling respawn: Will start in 10 seconds But when I tried restarting PostgreSQL, the new 9.3 version never started up, and I found these errors in /usr/local/var/postgres/server.log: FATAL: database files are incompatible with serverĭETAIL: The data directory was initialized by PostgreSQL version 9.2, which is not compatible with this version 9.3.0. Everything continued operating as normal. I didn’t notice the problem at first, since my old version of PostgreSQL was still running. Don’t uninstall PostgreSQL 9.2.4 yet: it’s required for the upgrade process! Identifying the problem Note: These instructions assume you have already installed PostgreSQL 9.3 using brew upgrade postgresql. Here’s how I migrated my databases from 9.2 to 9.3. This morning a brew upgrade duly installed PostgreSQL 9.3, which uses an incompatible data format. I have been happily running PostgreSQL 9.2, installed via homebrew. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |