It’s about database upgrade steps.

Step1. First login in the database and create a test database or tables

/opt/PostgreSQL/10.11/bin/psql
postgres=# \l+
postgres=# create database techservicedoc_db;
postgres=# \c techservicedoc_db
techservicedoc_db=# CREATE SCHEMA techservicedoc_schema;
techservicedoc_db=# \dn
techservicedoc_db=# CREATE TABLE techservicedoc_schema.techservicedoc_teable
( order_id integer CONSTRAINT order_details_pk PRIMARY KEY,
  Product_id integer NOT NULL,
  Delivery_date date,
  quantity integer,
  feedback TEXT
);techservicedoc_db-# techservicedoc_db(# techservicedoc_db(# techservicedoc_db(# techservicedoc_db(# techservicedoc_db(# 
techservicedoc_db=# \dt techservicedoc_schema.*                    

Step2. Install PostgreSQL 11.6 and initialize data

/opt/PostgreSQL/11.6/bin/initdb -D /data11
/opt/PostgreSQL/11.6/bin/pg_ctl -D /data11 -l logfile start

Step3. Now upgrade the database. First, stop running the database and check up-gradation compatibility.

/opt/PostgreSQL/11.6/bin/pg_upgrade --old-bindir=/opt/PostgreSQL/10.11/bin --new-bindir=/opt/PostgreSQL/11.6/bin --old-datadir=/data10 --new-datadir=/data11 --check

Step4. If everything is fine then upgrade the database

/opt/PostgreSQL/11.6/bin/pg_upgrade --old-bindir=/opt/PostgreSQL/10.11/bin --new-bindir=/opt/PostgreSQL/11.6/bin --old-datadir=/data10 --new-datadir=/data11

Step5. Start Postgres Service

/opt/PostgreSQL/11.6/bin/pg_ctl -D /data11 -l logfile start

Step6. Login in database and check data

/opt/PostgreSQL/11.6/bin/psql 
postgres=# \l+
postgres=# \c techservicedoc_db
techservicedoc_db=# \dn
techservicedoc_db=# \dt techservicedoc_schema.*

LEAVE A REPLY

Please enter your comment!
Please enter your name here