Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.
Drupal database Mssql
to MySQL migration
Anton Ivanov
Customer choice

Nginx + MySQL + PHP

or

IIS + Mssql + PHP

??
What we need first

Working Mssql server

&

Working MySQL server
Mssql server on Linux

Docker container

or

Local installation
Installation process

Go to Microsoft site

Use HowTo

Command line tools

Test site …
But site not works :(

SQLSTATE[HY010]: [unixODBC]
[Driver Manager] Function sequence
error: …
But site not works :(

SQLSTATE[HY010]: [unixODBC]
[Driver Manager] Function sequence
error: …

Because PHP driver not s...
Use Windows, Luke

Machine with Windows or VM:

Mssql Server Express

SQL Server Management Studio SSMS

WAMP + Fresh ...
Converting database

2 separated ways available:

for Drupal 7

for Drupal 8
MySQL Workbench

Simple multistep form

Result: Converted database

But not works with Drupal 7
(unserialization error)
DBTNG Migrator

Simple module
(Schema API + DBTNG)

Actual Schema in code

Result: Converted database

But not works w...
Conclusion

Drupal 7:

DBTNG Migrator

Drupal 8:

??
Conclusion

Drupal 7:

DBTNG Migrator

Drupal 8:

MySQL Workbench
Helpful info
Tricks

SQL Server authentication
(don't use Windows authentication)

use Adminer
(to test connection and structure)

i...
Importing dump with sqlcmd

sqlcmd -H localhost -U SA

RESTORE FILELISTONLY FROM DISK = '/path/to/dump.bak'

Drupal_Dat...
Useful links, Linux
Download Mssql server :
https://www.microsoft.com/en-us/sql-server/sql-server-2017#resource
SQL Server...
Useful links, Windows
Download Mssql server Express edition :
https://www.microsoft.com/en-us/sql-server/sql-server-editio...
Useful links, Tools
DBTNG Migrator : https://www.drupal.org/project/dbtng_migrator
Download MySQL Workbench :
https://dev....
Thank you! Questions?
Anton Ivanov
Upcoming SlideShare
Loading in …5
×

Mssql to mysql - Anton Ivanov

191 views

Published on

DrupalCampKyiv 2017

Published in: Internet
  • Be the first to comment

  • Be the first to like this

Mssql to mysql - Anton Ivanov

  1. 1. Drupal database Mssql to MySQL migration Anton Ivanov
  2. 2. Customer choice  Nginx + MySQL + PHP  or  IIS + Mssql + PHP  ??
  3. 3. What we need first  Working Mssql server  &  Working MySQL server
  4. 4. Mssql server on Linux  Docker container  or  Local installation
  5. 5. Installation process  Go to Microsoft site  Use HowTo  Command line tools  Test site …
  6. 6. But site not works :(  SQLSTATE[HY010]: [unixODBC] [Driver Manager] Function sequence error: …
  7. 7. But site not works :(  SQLSTATE[HY010]: [unixODBC] [Driver Manager] Function sequence error: …  Because PHP driver not stable
  8. 8. Use Windows, Luke  Machine with Windows or VM:  Mssql Server Express  SQL Server Management Studio SSMS  WAMP + Fresh sqlsrv drivers  Comment wincache_*() calls
  9. 9. Converting database  2 separated ways available:  for Drupal 7  for Drupal 8
  10. 10. MySQL Workbench  Simple multistep form  Result: Converted database  But not works with Drupal 7 (unserialization error)
  11. 11. DBTNG Migrator  Simple module (Schema API + DBTNG)  Actual Schema in code  Result: Converted database  But not works with Drupal 8 (no Drupal 8 version)
  12. 12. Conclusion  Drupal 7:  DBTNG Migrator  Drupal 8:  ??
  13. 13. Conclusion  Drupal 7:  DBTNG Migrator  Drupal 8:  MySQL Workbench
  14. 14. Helpful info
  15. 15. Tricks  SQL Server authentication (don't use Windows authentication)  use Adminer (to test connection and structure)  in Drupal 7 comment wincache_*() (/includes/database/sqlsrv/database.inc)
  16. 16. Importing dump with sqlcmd  sqlcmd -H localhost -U SA  RESTORE FILELISTONLY FROM DISK = '/path/to/dump.bak'  Drupal_Data01 ... H:PROD_DATADrupal_Site_Data01.mdf  Drupal_Data02 ... H:PROD_DATADrupal_Site_Data02.ndf  Drupal_TLog01 ... J:PROD_LOGDrupal_Site_TLog01.ldf  RESTORE DATABASE Drupal_Site FROM DISK='/path/to/dump.bak' WITH MOVE 'Drupal_Data01' to '/var/opt/mssql/data/drupal_data01.mdf', MOVE 'Drupal_Data02' to '/var/opt/mssql/data/drupal_data02.ndf', MOVE 'Drupal_TLog01' to '/var/opt/mssql/data/drupal_tlog01.ldf' GO
  17. 17. Useful links, Linux Download Mssql server : https://www.microsoft.com/en-us/sql-server/sql-server-2017#resource SQL Server command-line tools : https://docs.microsoft.com/en-us/sql/linux/sql-server-linux-setup-tools Mssql backup and restore db : https://docs.microsoft.com/en-us/sql/linux/sql-server-linux-backup-an Mssql PHP driver for Linux : https://github.com/Microsoft/msphpsql
  18. 18. Useful links, Windows Download Mssql server Express edition : https://www.microsoft.com/en-us/sql-server/sql-server-editions-expres Download SQL Server Management Studio (SSMS) : https://docs.microsoft.com/en-us/sql/ssms/download-sql-server-manag Restore database from dump with SSMS : https://www.howtogeek.com/50354/restoring-a-sql-database-backup-u Mssql PHP driver for Windows : https://github.com/Microsoft/msphpsql (php_pdo_sqlsrv_7_ts.dll, php_sqlsrv_7_ts.dll)
  19. 19. Useful links, Tools DBTNG Migrator : https://www.drupal.org/project/dbtng_migrator Download MySQL Workbench : https://dev.mysql.com/downloads/workbench Migrate with MySQL Workbench : http://mysqlworkbench.org/2012/07/migrating-fro
  20. 20. Thank you! Questions? Anton Ivanov

×