从Postgres迁移到SQL Server 2008 [英] Migrating from Postgres to SQL Server 2008
问题描述
我需要将数据库从Postgres 7迁移到SQL Server2008。我熟悉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:
- Import Data from Postgresql to SQL Server 08 Error
以下是我在该主题上找到的最有用的线索:
- Import data from postgreSQL into SQL server 2005
帮助可能会实现目标的人与我的目标相似。而不是在 SQL Server导入和导出向导的数据源下拉菜单中选择 PostgreSQL OLE DB提供程序,而是选择 .db的.Net Framework数据提供程序。
然后,您必须制作一个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提供程序。
就个人而言,如果我只需要做一次,并且如果我对模式和数据了解得很好,我会尝试:
- 将PostgreSQL中的数据导出为平面文件
- 在SQL Server中创建架构(无PK或约束)
- 使用SSIS导入/导出向导导入平面文件
- 然后创建PK和必要的约束
- export the data from PostgreSQL as flat files
- create the schema in SQL Server (without PKs or constraints)
- use the SSIS Import/Export Wizard to import the flat files
- then create PKs and necessary constraints
花费几天时间比使用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屋!