Thread: Import .sql file

Import .sql file

From
Sudhakar Kurumella
Date:
Hello,
 
I extracted an entire postgreSQL database using EMS PostgreSQL Extract and it saved the extraction as "XXX.sql" file. How can i restore or import into a postgreSQL server.
 
thanks,
kuru


Do you Yahoo!?
Yahoo! Mail - Find what you need with new enhanced search. Learn more.

Re: Import .sql file

From
"Vishal Kashyap @ [SaiHertz]"
Date:
Dear Sudhakar ,

>How can i restore or import into
> a postgreSQL server.
>
>

From command line

psql -U <user> <database> -f <file_name.sql>

--
With Best Regards,
Vishal Kashyap.
http://vishalkashyap.tk

Re: Import .sql file

From
"Vishal Kashyap @ [SaiHertz]"
Date:
Dear Sudhakar ,

Please do CC mails to the list also as their are much more PoetgreSQL
enlightened individuals out their than me.


>
> When i run the sql command, i am getting into the following errors. I'll
> appreciate if you guide me.
>
> [C:\Program Files\PowerGres\bin]psql -U postgres cms -f Metadata.sql
> psql:Metadata.sql:5: ERROR:  namespace "public" already exists
> COMMENT
> psql:Metadata.sql:14: ERROR:  function public.plpgsql_call_handler() doesn't
> exist

It looks as if you are restoring a database schema.
In this case you would have to seperate your Languages, Functions ,
Tables , Seqeneces , types from the Metadata file.

Then execute the before mentioned command with the sequence mentioned above.

--
With Best Regards,
Vishal Kashyap.
http://vishalkashyap.tk