How to open pgsql file on Windows? [closed]
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 11 years ago.
Improve this questionI downloaded a 7 Gigabyte .pgsql file.
What do I need to download in order to open this file on my开发者_Go百科 Windows 7 machine?
I tried installing PostgreSQL 9.1 for Windows, but when I open the pgAdmin it keeps asking me for a server, and I don't have any. All I want is to open an existing file, how can I configure it?
7 GB - this is probably a backup file either of a (big) database or a whole db cluster. To restore it, you need a working Postgres server installation (and possibly a database to restore to). You would have to tell us more about the file.
Be aware that a 7 GB backup in uncompressed text format typically results in a database with somewhere around 20 GB disk space. But that can vary wildly.
If it is plain SQL (indicated by the file extension .pgsql
) you can restore it by feeding it to the standard command line client psql:
psql -p $PORT $db -U $username -f /path/to/file.pgsql
pgAdmin is a graphical administration tool (you seem to confuse it with the RDBMS itself). It offers restore capabilities, too.
If it is an archive file created with pg_dump
, you need to use pg_restore
.
For a file that big it might pay to optimize restore performance. Here is a Postgres Wiki entry on that.
Postgres version, encoding and locale of the dump and the database (cluster) have to be compatible. If you don't know any of that, I recommend you start by reading about backup and restore. Or more generally, about PostgreSQL.
精彩评论