Closed (won't fix)
Project:
Drupal driver for SQL Server and SQL Azure
Version:
7.x-1.x-dev
Component:
Documentation
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
22 Dec 2010 at 15:23 UTC
Updated:
4 Sep 2018 at 20:06 UTC
Jump to comment: Most recent
Comments
Comment #1
damien tournoud commentedIt's not crazy at all. It's actually pretty easy to export any Drupal database in a format that can be imported in any other database engine. We did that while building a demo during Drupalcon Copenhagen and this type of normalized data import/export could be added as a feature to Drush.
Comment #2
jfha73 commentedCool, can you tell me how to do this, just to be prepared and I don't have to look for it later on.
Thanks.
Comment #3
verta commentedChanged title, component and category, as I think this might be handled in documentation.
Comment #4
ashayc commentedWhile a tool/module to do this is probably the most convenient for a broad audience, it wouldn't hurt to have documentation too. Here is some generic documentation for transfering data from MySQL to SQL Server.
************************************************************
The fastest way to copy the data from MySQL tables to SQL Server tables is to use the SQL Server Import and Export Data Wizard. For connectivity with MySQL server, install MySQL ODBC Connector, which can be downloaded from:
http://dev.mysql.com/downloads/connector/odbc/5.1.html
Here are the steps to perform the data migration using the wizard interface:
1. On the SQL Server machine, create system ODBC data source for MySQL database using MySQL ODBC Connector.
2. Set SQL_MODE to ANSI_QUOTES on MySQL Server.
3. In SQL Server Management Studio, right-click the target database in Object Explorer, click Tasks, and then click Import Data. The SQL Server Import and Export Wizard appears.
4. On the next page, the wizard requests the data source. Select the.NET Data Provider for ODBC and specify the DSN created at the step 1.
5. Next, set up the destination. Select SQL Server Native Client 10, specify your instance of SQL Server and your database, and then click Next.
6. Click Copy data from one or more tables or views, and then click Next.
7. Select source and target tables for the migration. If a target table has an identity field, you can enable identity insert using the Column Mappings dialog box.
8. Execute the created package. If necessary, the package can be saved and reused later.
Validating Migration Results
After the data transfer is complete, you might want to verify that all the data have been migrated correctly. It can be done using the SQL Server linked server mechanism. The following commands illustrate this method. They should be executed in Query window of SQL Server Management Studio:
1. First, you need to create the linked server pointing to MySQL database.
EXEC sp_addlinkedserver '<ServerName>','MySQL','MSDASQL', '<DSN>'where
<ServerName>is name of linked server and<DSN>is the ODBC data source name.2. Specify the login for this linked server.
EXEC master.dbo.sp_addlinkedsrvlogin @rmtsrvname = N'<ServerName>', @locallogin = NULL , @useself = N'False', @rmtuser = N'<User>', @rmtpassword = N'<Password>'Here
<ServerName>is name of the linked server, and<User>and<Password>are MySQL credentials that provide read access to the databases being transferred.3. The following query returns the invalid rows where differences between MySQL and SQL Server tables exist. Change
<database>, <schema>, and <table>so that they specify the location of the table for which you want the migration to be verified.************************************************************
This can be tweaked for Drupal 6 to Drupal 7, or Drupal 7 to Drupal 7 as appropriate.
Hope this helps.
Comment #5
damien tournoud commentedThe problem is that the content of the database might be slightly different, because different database engines implement Drupal database types and concepts in a slightly different way (for exemple, on SQL Server we have to explicitly filter out the NULL values from unique keys because SQL Server has a NULL = NULL semantic).
The only practical path to do that is to generate a Drupal portable version of the database, and reimport it in the second implementation. That's what the Rails world has been doing for years (in the form of YAMLDB). We have nearly all the code necessary to do that, it just need to be packaged in the Drush module.
Comment #6
ashayc commentedAgree with you Damien, the automated tested solution for D6->D7 and D7->D7 is the best option.
Those familiar with SQL Server can use the Export/Import wizard and advanced options to do it manually. The reason to add it here is because the issue has been marked for documentation. :)
Comment #7
greg.1.anderson commentedIs this issue still needed in the "Drupal 7 driver for SQL Server" queue, or can it be moved to the drush issue queue as a feature request? I can post a new issue if you want to keep this one here.
Are there any docs / records on what you did while building the demo you mentioned in #1? That information would be very useful here.
Comment #8
damien tournoud commentedThis issue has a corresponding feature request in the Drush queue: #1052244: DBTNG-format database dump and import.
Comment #9
dave007 commentedI just had success migrating my MySQL data to an MSSQL version of the database using the SQL Server Migration Assistant: (Team blog site) http://blogs.msdn.com/b/ssma/
It shows some warnings about keys over 900 bytes, but migrated 100% of my data from MySQL to an MSSQL (2008) database.
I had ODBC driver issues with SSIS, this way was much easier.
Comment #10
joseph.olstadIf you don't have much time to do this, try SQLyog Enterprise edition, its got an import wizard that works well, I've converted /migrated a Drupal mssql db to mysql with this without errors.
STEP 1)
First you use MySQL Workbench to migrate only the tables over from mssql to MySQL (skip the data migration).
STEP 2)
then you use SQLyog to migrate the data over from mssql to MySQL.
STEP 3)
do this only AFTER step 2 is complete.
To make the migrated (from MSSQL to MySQL) database work properly you will have to look at the dump file from the newly created MySQL database, locate all tables with '__pk'
then for each of those tables , drop the '__pk' column as follows:
Example:
and so on and so forth.
Our db had these tables that contained the '__pk' field , drop all of the ones you find and you'll be good.
the __pk and __unique fields are junk that MSSQL creates to handle tables that don't have primary keys. MySQL doesn't need these and should not have them.
Converting/migrating to MySQL worked great for us. Good luck.
Comment #11
easyfrom commentedESF Database Migration Toolkit can do this job in 3 steps:
https://www.easyfrom.net/articles/mysql_to_sql_server/
It is quickly and simply.
Comment #12
imclean commentedI've had success with SQL Server Migration Assistant (SSMA) for MySQL. Current version 7.7: https://www.microsoft.com/en-us/download/details.aspx?id=54257
I use use plain SQL connections within SSMA for MySQL and MS SQL Server. After setting up MS SQL server and MySQL/MariaDB correctly with appropriate users and permissions, within SSMA project:
This seems to handle field conversions seamlessly. Drupal versions 8.4 and 8.5
Comment #13
joseph.olstadWe saved 300,000$ in high availability cluster annual license fees by converting our Drupal database from MSSQL to MySQL and were able to re-utilise our licenses for other applications. Ended up creating a MySQL cluster using a master-master-slave configuration although this is overkill for most organizations.
We also put to use the autoslave module https://drupal.org/project/autoslave for automatic failover.
This also increased our compatibility with contrib and allowed us to use the native drivers in Drupal rather than the less popular sqlsrv drivers.