Migrating from Postgres to SQL Server 2008(从 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:
- 从 Postgresql 导入数据到 SQL Server 08 错误
这是我发现的有关该主题的最有用的主题:
- 从 postgreSQL 导入数据进入 SQL Server 2005
帮助可能试图实现与我类似目标的人.在 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.
就我个人而言,如果这是我只需要做一次的事情,并且如果我对架构和数据相当了解,我会尝试:
- 将数据从 PostgreSQL 导出为平面文件
- 在 SQL Server 中创建架构(无 PK 或约束)
- 使用 SSIS 导入/导出向导导入平面文件
- 然后创建 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的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:从 Postgres 迁移到 SQL Server 2008


基础教程推荐
- MySQL 5.7参照时间戳生成日期列 2022-01-01
- 如何在 CakePHP 3 中实现 INSERT ON DUPLICATE KEY UPDATE aka upsert? 2021-01-01
- while 在触发器内循环以遍历 sql 中表的所有列 2022-01-01
- 带有WHERE子句的LAG()函数 2022-01-01
- 使用 VBS 和注册表来确定安装了哪个版本和 32 位 2021-01-01
- MySQL根据从其他列分组的值,对两列之间的值进行求和 2022-01-01
- ORA-01830:日期格式图片在转换整个输入字符串之前结束/选择日期查询的总和 2021-01-01
- 从字符串 TSQL 中获取数字 2021-01-01
- 带更新的 sqlite CTE 2022-01-01
- CHECKSUM 和 CHECKSUM_AGG:算法是什么? 2021-01-01