开发者

How to open an .sql file locally?

I have an .sql file which is around 2 gb of size. I want to open the database locally on my laptop.

To do so I guess I have to install both the SQL server and the SQL client application on my laptop.

Can you please direct me to the appropriate installation packages and documentation on how to obtain this all (I will welcome any answer concerning Windows or Linux)?

I am sure the answer is not, but still, can I open the .sql file with MS Access?

Here are the first few lines of the .sql file

--
-- PostgreSQL database dump
--

SET statement_timeout = 0;
SET client_encodin开发者_Python百科g = 'SQL_ASCII';
SET standard_conforming_strings = off;
SET check_function_bodies = false;
SET client_min_messages = warning;
SET escape_string_warning = off;

SET search_path = public, pg_catalog;

SET default_tablespace = '';

SET default_with_oids = false;


The 2gb file you've got is a PostgreSQL Dump File (ie a dump of their entire database, schema, data and all).

I'd suggest you install PostgreSQL (note, you could use any database, but since it was dumped from Postgres, we can play it safe and try to restore to the same engine):

http://www.postgresql.org/download/windows <- Just download and install the One Click Installer if you're on windows

And then you will need to restore that dump file to a database:

This page will walk you through it: http://www.postgresql.org/docs/8.1/static/backup.html#BACKUP-DUMP-RESTORE

But it is essentially running the following:

psql db_to_restore_to < yourdump.sql

You'll then have the full database setup ready to be queried (and you can hook up to the PostreSQL database via Access too if you are used to Access or aren't familiar with writing SQL)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜