Bug #82456 SQL Server DB migration : generated script error
Submitted: 4 Aug 2016 12:20 Modified: 5 Oct 2017 0:20
Reporter: Fabrizio Carrai Email Updates:
Status: No Feedback Impact on me:
None 
Category:MySQL Workbench: Migration Severity:S2 (Serious)
Version:6.3.7 OS:Windows (Microsoft Windows 10 Pro)
Assigned to: CPU Architecture:Any
Tags: WBBugReporter

[4 Aug 2016 12:20] Fabrizio Carrai
Description:
The "bulk_copy_tables.cmd" script generated by the "Create a shell script to use native server dump and load abilities for fast migration" option during an SQL Server database migration has a few bugs/issue that avoid its execution.

1) arg_source_password

Line 4 set the "arg_source_password" variable, but the rest of the script wrongly uses "arg_source_passwords" (with an ending "s").
In the references of the variable the ending "%" is missing.

The correct line should looks like:

bcp "SELECT * FROM mytable" queryout mytable.csv -c -t, -S myservername\myinstanceid -U sa -P %arg_source_password% 2>> "%MYPATH%bulk_copy_errors.log"

2) Source server

The script refers to .\<SQL server instance name> and this is correct when the script is executed on the source computer. If the -S parameter of the "bcp" program would include the server name (e.g. "MYSERVER\SQLSRV001") then the script could be executed on any computer with access to the source SQL server.

3) Trusted access

The -T parameter must be alternative to -S/-P params.

How to repeat:
From the main menu:
1) Database
2) Migration Wizard ... 
3) Select any SQL server table to migrate to a MYSQL server 
3) At the "Data transfer" step : Select "Create a shell script to use native server dump and load abilities for fast migration" 

The bulk_copy_tables.cmd is created with the reported errors.
[4 Aug 2016 18:52] MySQL Verification Team
When you execute the generated file what are the errors printed?. Thanks.

C:\tmp>bulk_copy_tables.cmd
[0 %] Creating directory dump_test
        1 file(s) copied.
[25 %] Start dumping tables

Starting copy...

11 rows copied.
Network packet size (bytes): 4096
Clock Time (ms.) Total     : 1      Average : (11000.00 rows per sec.)
[50 %] Dumped table tb
        1 file(s) copied.
[75 %] Generated import script import_test.cmd
Microsoft (R) Windows Script Host Version 5.812
Copyright (C) Microsoft Corporation. All rights reserved.

[100 %] Zipped all files to dump_test.zip file
C:dump_test.zip
1 File(s) copied
Now you can copy C:\tmp\dump_test.zip file to the target server and run the import script.
Press any key to continue . . .
[5 Aug 2016 7:44] Fabrizio Carrai
Hello Miguel,
here the generated script execution printout:

C:\Temp>bulk_copy_tables.cmd
[0 %] Creating directory dump_MYDATABASE
        1 file copiati.
[8 %] Start dumping tables
SQLState = 08001, NativeError = -1
Error = [Microsoft][SQL Server Native Client 10.0]Interfacce di rete di SQL Server: Errore nell'individuazione del server/dell'istanza specificati [xFFFFFFFF].
SQLState = 08001, NativeError = -1
Error = [Microsoft][SQL Server Native Client 10.0]Si รจ verificato un errore specifico dell'istanza o relativo alla rete durante il tentativo di stabilire una connessione a SQL Server. Server non trovato o non accessibile. Verificare che il nome dell'istanza sia corretto e che il server sia configurato in modo da consentire connessioni remote. Per ulteriori informazioni, vedere la documentazione online di SQL Server.
SQLState = S1T00, NativeError = 0
Error = [Microsoft][SQL Server Native Client 10.0]Timeout di accesso scaduto
Script has failed. See the log file for details.

(Summary in english: error accessing the SQL server.)

The message makes sense to me, see the first lines of the generated CMD file:

@ECHO OFF
SET MYPATH=%~dp0
IF EXIST %MYPATH%bulk_copy_errors.log del /F %MYPATH%bulk_copy_errors.log
set arg_source_password="<put source password here>"

Indeed, there is no password here and my SQL server requires username and password authentication (no Trusted connection).
[7 Aug 2016 0:57] MySQL Verification Team
Thank you for the feedback. How you could see I didn't have such issue so I wondering if the SQL Server authentication type is the source of issue I use the SQL Server Authetication and not the Windows Authetication for. What kind of authetication have you applied?. Thanks.
[23 Aug 2016 12:09] Fabrizio Carrai
In the specific case I use native SQL connection.
[5 Sep 2017 0:20] MySQL Verification Team
Please try version 6.3.9. Thanks.
[5 Oct 2017 1:00] Bugs System
No feedback was provided for this bug for over a month, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".