Reputation: 33
I am a newbie and I have a postgresql large dump of type .sql and i want to import it. I am on Windows 10 and haven't been able to find solution.
I tried to restore using pgAdmin3 but it doesn't show .sql file while restoring. I also found few commands and tried them but nothing seems to work. I also tried loading the datasource in IntelliJ DataGrid but it doesn't show the correct driver during the loading settings.
Can someone help?
Upvotes: 3
Views: 12192
Reputation: 247800
First, figure out if the dump was created with pg_dumpall
or pg_dump
.
Dumps from pg_dumpall
start with:
--
-- PostgreSQL database cluster dump
--
If the dump was created with pg_dump
, find out if the -C
option was used.
If yes, the dump will contain a line with a CREATE DATABASE
statement.
To restore, use psql
from the DOS box. I assume that psql
is on your PATH.
A dump from pg_dumpall
or pg_dump -C
is restored with
psql -U postgres -d postgres -f dumpfile.sql
A dump from pg_dump
without -C
is restored with
psql -U postgres -d mydatabase -f dumpfile.sql
where mydatabase
should be replaced with the name of the target database into which the dump should be restored.
Upvotes: 9