In this blog we will be learning how to load any PostgreSQL database
into PostgreSQL database server.
We will be keeping our blogs short and easy to read for making them simple. Hence, we will be targeting one thing at a time in our blog series.
I am assuming, you have PostgreSQL installed on your system.
First, we will launch our psql tool, using following command
>psql
After that, Enter required credentials.
Server [localhost]:
Database [postgres]:
Port [5432]:
Username [postgres]:
Password for user postgres:
then create data base using following statement
postgres=# CREATE DATABASE database_name;
CREATE DATABASE
then exit psql tool by typing exit
.
then, navigate to bin folder of your Postgres installation.
after that write following command to load your data into the data you created(assuming we created database named database_name).
pg_restore -U postgres -d database_name C:\sampledb\database_file.tar
here -U postgres
identifies postgres user, it would be different if you are using different user.
now, enter password for your user.
Password:
Hurray!!!
We are done!!
Top comments (0)