How can I upgrade to postgres 9.5 from 9.3.4? - postgresql

I am new to postgres. I am using postgres 9.3.4. How can I upgrade to postgres 9.5 without losing my data? Please help me.

See the Fine Manual.
Essentially, you can either dump with pg_dumpall (use pg_dumpall from 9.5!) and restore with psql, or you can use pg_upgrade for an in-place upgrade (after you have made a backup).

Related

Restoring a Postgresql 10 dump to Postgres 9.3 server

We are about to upgrade from pgsql 9.3 to 10.x. Part of the requirement is to be able to switch back to 9.3 in the case of some disaster (some massive but of course, unlikely incompatibility).
I tried pg_restoring a dump taken from one of our dev v. 10.x databases to a pgsql9.3 server, and got a lot of errors.
Is there any known "roll back path" from v 10.x to v 9.3?
Actually you can use Pg_Dump will give you a full sql file including all DDL and DML statements to recreate your database in another place (or restore).
You can do statement in cmd for backup use Pg_Dump
pg_dump -U username -d database > filename.sql
For more documentation and command use you can see here Pg_Dump
And you can restore use Psql command like this
psql -U username -d database -f filename.sql
You can use the pg_dump from pg9.3 to backup the pg10 database. Then use that backup and pg_restore from pg9.3 again to restore.

Difference between the similar databases at Postgres 9.1 and Postgres 9.3

I have a database at Postgres 9.1 which is well optimised (indexes). When I make dump from it and restore it to another server with Postgres 9.3, it works very slow. What is the difference between these versions? Should I disable any features in Postgres 9.3?

How to migrate data from non-bdr pgsql to bdr pgsql

I have fusionpbx with simple pgsql working ... Now i have created HA fusionpbx with bdr pgsql and it is working fine but I don't know how to migrate data from non-bdr pgsql to bdr pgsql ...
pg_dump worked for me.
pg_dump $non_bdr_db > db.sql
psql $bdr_db < db.sql
Although if you have some fancy extensions (in my case it's PostGIS) you might want to restore the database from the backup first (separately on each and every node of your BDR cluster) and then enable the BDR extension.

pg_restore: Its not restoring my db

What does it mean I'm trying to restore my postgresql db and here is what I'm getting but I do not see it restore tables/data/
C:\Program Files\PostgreSQL\9.4\bin\pg_restore.exe --host
123-97.compute-1.amazonaws.com --port 5432 --username "username"
--dbname "mydb" --no-password --section pre-data --section data --section post-data --schema public --verbose "C:\db\employee.backup"
pg_restore: connecting to database for restore pg_restore: implied
data-only restore
Process returned exit code 0.
I'm using Windows 8.1
I was getting this error while restoring schema backup with different name. When i restored the schema with same name it worked like a charm and then later I renamed it.
Alternative: do pg_restore from a carefully-restricted pg_dump dump and avoid --schema (and possibly even --table) options when using pg_restore.
i faced same issue when tried to restore psql 12 backup into psql 12 database but with newer ubuntu version (backup was on ubuntu 18 and restore on ubuntu 20 ,both are psql 12).
when i downgraded ubuntu from 20 to 18 it restored just normally, not sure why ubuntu version should make problem. my advice just make sure environment of backup and restore are exactly the same.
For backup purposes, rename your old schema eg. schema_old and create a new schema with the same name, and try to restore it again.

pgAdmin III Restore PLAIN Backup

New to PostgreSQL database, I found column names were automatically converted to lowercase. I created a PLAIN backup, manually edited the column names to proper case. When I tried to restore the edited PLAIN backup, the OK button of pgAdmin3 Restore was disabled.
Is there a way run the edited plain backup file? Please help.
Use the client program psql to restore, works fine. The installers of pgAdmin and PostgreSQL also install psql, so you should have it on your pc or your database server.
psql -f backup.sql postgres