Reputation: 105
I am trying to import / restore a PostgreSQL database in pgAdmin on a Mac. I am doing this on a new machine that did not previously have a database on it. I installed and set up pgAdmin on the machine just recently and created a database with no files in it.
Specifically, I am trying to figure out where to enter the restore commands found on various forums.
On other forums, I see that others are saying to try the following commands:
psql [dbname] < [infile]
or
pg_restore [option...] [filename]
I have never used pgAdmin before so I have no idea where to enter them. I cannot enter anything in the SQL Pane of the database, nor can I enter it as a query (which I tried despite knowing it did not really make any sense >_>).
If it helps, my backup file is on my desktop and is in .dmp format (similar to Oracle). I might be able to get it in a different format if needed but the people I am talking to say that should suffice.
Please let me know if anything comes to mind or if you need any more information. I appreciate any help or pointers anyone has. :)
Upvotes: 0
Views: 3497
Reputation: 3287
I have worked in WINDOWS , I can tell you what i did, you may get the point and do it in MAC .the pg_restore command and others like this i.e pg_dump and others are ther commands which can be run from the pgsql terminal which can be found in the postgres installation folder or may be in the start menu .
From the pgsql terminal following syntax may be used: pg_restore -i -h localhost -p 5432 -U username -d database name -v filename Commands can also be run from inside the Command Prompt cmd , in WINDOWS i did it like this :
'set path=C:\apache2triad\pgsql\bin C:\apache2triad\pgsql\bin\psql.exe -h localhost -p 5432 -U username-d database_name -f filename.sql pause.. '
For restoring database backup of .backup file from terminal: pg_restore -i -h localhost -p 5432 -U username -d database name -v filename
hope you may get some help here.
Upvotes: 2
Reputation: 656714
Specifically, I am trying to figure out where to enter the restore commands found on various forums.
This is a misunderstanding. pgAdmin is a GUI. You are referring to command line invocations. You do not need pgAdmin to run those. Just open a shell and execute the commands. But read the manual on pg_restore
and psql
first.
Upvotes: 1
Reputation: 4934
You can open terminal window here... http://blog.teamtreehouse.com/introduction-to-the-mac-os-x-command-line
Upvotes: 0