如何在本地打开 .sql 文件?

发布于 2024-12-02 19:51:33 字数 603 浏览 2 评论 0原文

我有一个大约 2 GB 大小的 .sql 文件。我想在我的笔记本电脑上本地打开数据库。

为此,我想我必须在笔记本电脑上安装 SQL 服务器和 SQL 客户端应用程序。

您能否指导我找到适当的安装包和文档,了解如何获得这一切(我欢迎任何有关 Windows 或 Linux 的答案)?

我确信答案是否定的,但我仍然可以使用 MS Access 打开 .sql 文件吗?

这是 .sql 文件的前几行

--
-- PostgreSQL database dump
--

SET statement_timeout = 0;
SET client_encoding = '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;

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_encoding = '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;

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

有木有妳兜一样 2024-12-09 19:51:33

您获得的 2gb 文件是 PostgreSQL 转储文件(即整个数据库、模式、数据等的转储)。

我建议你安装 PostgreSQL(注意,你可以使用任何数据库,但由于它是从 Postgres 转储的,我们可以安全地尝试恢复到相同的引擎)

: postgresql.org/download/windows">http://www.postgresql.org/download/windows <- 如果您使用的是 Windows,只需下载并安装一键安装程序

然后您将需要恢复将文件转储到数据库:

此页面将引导您完成它: http://www.postgresql.org/docs/8.1 /static/backup.html#BACKUP-DUMP-RESTORE

但它本质上是运行以下内容:

psql db_to_restore_to < yourdump.sql

然后您将准备好完整的数据库设置以供查询(并且您也可以通过 Access 连接到 PostreSQL 数据库)如果你习惯了Access或者不熟悉写SQL)

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)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文