PostgreSQL pg_dump: error: aborting because of server version mismatch

In this article, we will see reason and solution for below error:

pg_dump: error: server version: 15.2; pg_dump version: 13.10 pg_dump: error: aborting because of server version mismatch

pg_dump: server version: 12.3; pg_dump version: 9.2.24 pg_dump: aborting because of server version mismatch

Continue reading PostgreSQL pg_dump: error: aborting because of server version mismatch

How to download and restore PostgreSQL sample database

In this article, we will see how to download and restore PostgreSQL sample database. We can restore sample database in PostgreSQL server using following methods.

1. Using psql tool on windows.
2. Using Terminal on Linux.

First we have to download PostgreSQL sample database. Go through Download PostgreSQL Sample database

Restore PostgreSQL sample database on windows by using psql utility

Continue reading How to download and restore PostgreSQL sample database

PostgreSQL sample database

In this article, we will see how to download and restore PostgreSQL sample database in PostgreSQL server. We can use PostgreSQL sample database for learning and practice PostgreSQL. We will use the DVD rental database for demonstrating the features of PostgreSQL.

The DVD rental database has many objects including tables, views, trigger, functions, sequences and domain.

Download the PostgreSQL Sample database

Continue reading PostgreSQL sample database

How to do schema only backup and restore in PostgreSQL?

In this article, we will see how to do schema only backup and restore in PostgreSQL.
Schema only backup contains only objects definition like table definition.

To take a schema level backup in PostgreSQL database and restore on the another database, we use pg_dump utility with the option –schema-only or -s. If we gave –schema-only means, it dumps only the object definitions (schema), not data.
Continue reading How to do schema only backup and restore in PostgreSQL?

How to take backup and restore table in PostgreSQL

In this article, we are going to how to take backup and restore table in PostgreSQL. We use pg_dump to take backup of table wiht –table option and psql or pg_restore tools are used to restore the table using existing backup.

1. Syntax to backup table data:

pg_dump -Fc --data-only -h -p -U -W -d -t

> /path_and_filename_forbackup

Continue reading How to take backup and restore table in PostgreSQL

How to take backup of a table(s) in PostgreSQL

In this article, we will see how to take backup of a table(s) in PostgreSQL. We can take the backup of single or multiple tables using pg_dump command with –table or -t option.

Syntax to take backup of table(s) in PostgreSQL:

Following syntax is used to take backup of table with table definition:

pg_dump -d databasename --table=yourTable --column-inserts > file_name.sql

Continue reading How to take backup of a table(s) in PostgreSQL