从 Postgres 迁移到 SQL Server 2008 [英] Migrating from Postgres to SQL Server 2008

查看:60
本文介绍了从 Postgres 迁移到 SQL Server 2008的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要将数据库从 Postgres 7 迁移到 SQL Server 2008.我熟悉 SSIS 导入和导出向导,但我对如何定义数据源或定义数据提供程序感到困惑.

I need to migrate a database from Postgres 7 to SQL Server 2008. I am familiar with the SSIS Import and Export wizard but I am stumped about how to define the data source or define the data provider.

将 Postgres 迁移到 SQL Server 的最佳方法是什么,以及如何为 postgres 定义数据源/驱动程序?

What is the best way to migrate Postgres to SQL Server, and how do I define data sources/drivers for postgres?

推荐答案

祝您在尝试使用 SQL Server 导入和导出向导从 PostgreSQL 导入到 SQL Server 时好运.但是,我已经阅读了许多留言板线程,人们在使用它时遇到了麻烦.例如:

I wish you the best of luck in trying to import from PostgreSQL into SQL Server using SQL Server Import and Export Wizard. However, I have read numerous message board threads with people having trouble getting it to work. For example:

这是我发现的有关该主题的最有用的主题:

帮助可能试图实现与我类似目标的人.在 SQL Server 导入导出向导的数据源下拉菜单中,不要选择PostgreSQL OLE DB Provider",而是选择.Net Framework Data Provider for Odbc"

然后你必须制作一个 DSN 并提供一个 ConnectionString.以下 ConnectionString 对我有用

Driver={PostgreSQL};Server=localhost;Port=5432;Database=TestMasterMap;Uid=postgres;Pwd=;

要创建 DSN,您必须进入管理工具à数据源 (ODBC) 并创建一个用户 DSN.完成此操作后,您可以在 SQL Server 导入和导出向导的 DSN 文本框中提供 DSN 名称.

一位评论者声称它有效,但他在大表上遇到了读取元组时内存不足"的错误.因此,对于超过 300 万行的表,他必须将导入分成 300 万行块.

One commenter claimed that it worked, but that he got "Out of memory while reading tuples" errors on big tables. So for tables with more than 3 million rows, he had to break the import up into 3 million row chunks.

此外,该线程中有一个指向 PostgreSQL 的本机 .NET 提供程序的链接.

Also, there's a link to the native .NET provider for PostgreSQL in that thread.

就我个人而言,如果这是我只需要做一次的事情,并且如果我对架构和数据相当了解,我会尝试:

  1. 将数据从 PostgreSQL 导出为平面文件
  2. 在 SQL Server 中创建架构(无 PK 或约束)
  3. 使用 SSIS 导入/导出向导导入平面文件
  4. 然后创建 PK 和必要的约束

执行上述操作可能比在几天内使用 SSIS 导入/导出向导和 PostgreSQL 花费更少的时间(但如果这些工具有效,那就太好了!)

It might take you less time to do the above than messing with SSIS Import/Export Wizard and PostgreSQL for days (but it would be nice if those tools worked!)

这篇关于从 Postgres 迁移到 SQL Server 2008的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆