Using pg_dump files from 9.3 on 9.5 - postgresql

Before migrating from an old laptop I created dumpfiles for all of my postgresql/postgis databases using pg_dump. However after migrating I'm having problems with a lot of errors on import to the new database. I've realized that my old and new machine are running different versions of postgresql/postgis. The dumps were created on a machine running postgresql 9.3.13 and postgis version 2.1; I'm trying to recreate the databases on a machine running postgresql 9.5.4 and postgis version 2.2
Any suggestions for getting the data from my dumps to load without problems? Or for creating new dumps on the old machine which will work across versions?

Related

AWS RDS PostgreSQL Upgrade from 9.6.22 to 10.17

Good day. I just finished upgrading my AWS RDS database engine from 9.6.22 to 10.17. I used these steps to make the upgrade using the AWS Console:
Create snapshot of target database to upgrade
Restore snapshot
Upgrade the restored snapshot's (which is now a new instance) DB Engine version.
After I did all of this, everything seems fine but when I access the database, this warning message appears
WARNING: psql major version 9.6, server major version 10.
Some psql features might not work.
I did not continue on my testing because I want to know what is the meaning of this first. Because I am fairly new in AWS as a whole. Thanks!
The meaning is that just because you are connecting to an upgraded database on some machine run by Amazon, the PostgreSQL installation on your local machine was not magically updated. psql from version 9.6 doesn't know what metadata tables were changed in v10, what features were removed and so on.
It would be a good idea to install a more recent version of PostgreSQL on your machine. By the way, upgrading to v10 was not the smartest move, as that version will go out of support in less than a year. You should upgrade to the latest version that your service provider offers.
The client program psql you are using to connect to the database is from an older version than the database it is connecting to. Some of the introspection features might not work. For example, psql from 9.6 won't know how to do tab completion for commands that were added to the server after 9.6.
This is generally not a major problem for psql (unless the server wants to use SCRAM authentication), but for optimal experience it would be good to install a newer client. Other tools like pg_dimp might not with at all against a server newer than they are.

postgresql: Accidentally i upgraded the package. How to restore the old data

I am using archlinux. I didnt have much idea of pre postgresql upgrade related things.
I just upgraded the postgresql package from 9.x to 10.0 using pacman.
Now i cant open my databases.
Now is there any way i can restore my databases back which i have created.

Need to move postgis database to new linux machine...best method?

We're running out of room on our hard drive, and we're forced to move our postgis database to a new linux redhat machine. When our IT person copies the directories over to the new machine, I assume the entire database structure won't copy over perfectly.
We are running Red Hat 6 on the old and new machine. The postgresql version is 9.4.9 and the postgis version is 2.1.8.
Do you have suggestions for steps to take to successfully move our postgis-enabled PostgreSQL database to the new machine, keeping of course all data, structure, tables, etc.
I have seen some tutorials on this, but nothing really recent online.
Thanks for any help!
If the architecture is the same on both machines (e.g., both are x86_64), the PostgreSQL version is the same (the third digit can be different) and the RedHat version is the same (so that the same version of glibc guarantees that the collations are the same), you can simply copy the data directory (and all tablespaces) to the new machine and you are good.
Otherwise, use pg_dumpall to dump the old cluster and restore to the new machine.

Postgres Upgrade Interrupted, pg_version now inconsistent

Recently attempted an upgrade from 9.3 to 9.4 on an Ubuntu 14.04 Postgres installation, something went awry and the system lost power midway through the upgrade. Now the cluster won't start and when I try to move the data file to a new system and start it, there are inconsistencies in the data files and PG_VERSIONs are varied between 9.3 and 9.4.
Is there any way to recover and make consistent the files to launch under a new cluster?

Migrating Postgresql 9.1 to 9.2 from an old server to a new server

In my old server, Postgresql 9.1 is installed and it contains a large scale of data. Now, I have got a new server and installed the latest version of Postgresql which is 9.2. I want to migrate the whole data from the old server to the new server. I looked at Postgresql documentation and there is a command to upgrade but it seems to explain upgrading in the same server. How could I approach for this matter?
I would be very careful about changing both hardware and major versions of PostgreSQL at the same time. If something goes wrong, it will greatly complicate figuring out what the problem is.
I do this as a two step process, first restore the database to the new server as the same version, then run pg_upgrade. That means you have to have both versions of the software installed on the new server simultaneously.
Dump the database with pg_dump and load it at the new server with psql. I think pg_upgrade is better as an in place procedure.