Options

Command line batch file not working

quangquang Posts: 2
edited April 25, 2016 4:38AM in SQL Data Compare 11
I have two databases on my local network on separate servers. Server1 - SQL Express 2014. Server2 - SQL Express 2008 R2. My goal is to sync data from server1's db to server2's db without deleting data in server2's db. I have redgate sql data compare 11 installed on server1. Here is script that I used:

"C:Program Files (x86)Red GateSQL Data Compare 11sqldatacompare" /s1:192.168.1.30MSSQLSERVER /db1:TestDB /s2:192.168.1.20SQLEXPRESS /db2:TestDB2 /u2:testuser /p2:password /Synchronize /Include:Additional /Exclude:Missing /Exclude:Different /LogLevel:Verbose


When I checked the log, I saw this error:

10:19:13.444|Verbose|Command Line |1 |Comparing database 192.168.1.30mssqlserver.TestDB with database 192.168.1.20sqlexpress.TestDB2...
10:19:28.334|Fatal |Command Line |1 |Comparison of '192.168.1.30mssqlserver.TestDB' and '192.168.1.30sqlexpress.TestDB2' failed: A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: SQL Network Interfaces, error: 25 - Connection string is not valid)
RedGate.Shared.Utils.CommandLine.FatalExecutionException: Comparison of '192.168.1.30mssqlserver.TestDB' and '192.168.1.30sqlexpress.TestDB2' failed: A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: SQL Network Interfaces, error: 25 - Connection string is not valid) ---> System.Data.SqlClient.SqlException: A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: SQL Network Interfaces, error: 25 - Connection string is not valid) ---> System.ComponentModel.Win32Exception: The parameter is incorrect
--- End of inner exception stack trace ---

Server stack trace:
at System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity identity, SqlConnectionString connectionOptions, SqlCredential credential, Object providerInfo, String newPassword, SecureString newSecurePassword, Boolean redirectedUserInstance, SqlConnectionString userConnectionOptions, SessionData reconnectSessionData, DbConnectionPool pool, String accessToken, Boolean applyTransientFaultHandling)
at System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions options, DbConnectionPoolKey poolKey, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection, DbConnectionOptions userOptions)
at System.Data.ProviderBase.DbConnectionFactory.CreateNonPooledConnection(DbConnection owningConnection, DbConnectionPoolGroup poolGroup, DbConnectionOptions userOptions)
at System.Data.ProviderBase.DbConnectionFactory.TryGetConnection(DbConnection owningConnection, TaskCompletionSource`1 retry, DbConnectionOptions userOptions, DbConnectionInternal oldConnection, DbConnectionInternal& connection)
at System.Data.ProviderBase.DbConnectionInternal.TryOpenConnectionInternal(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource`1 retry, DbConnectionOptions userOptions)
at System.Data.SqlClient.SqlConnection.TryOpenInner(TaskCompletionSource`1 retry)
at System.Data.SqlClient.SqlConnection.TryOpen(TaskCompletionSource`1 retry)
at System.Data.SqlClient.SqlConnection.Open()
at RedGate.SQLCompare.Engine.Registration.ReadFromSql.LiveDMVModel.OpenConnection(SqlConnection connection)
at System.Runtime.Remoting.Messaging.StackBuilderSink._PrivateProcessMessage(IntPtr md, Object[] args, Object server, Object[]& outArgs)
at System.Runtime.Remoting.Messaging.StackBuilderSink.AsyncProcessMessage(IMessage msg, IMessageSink replySink)

Exception rethrown at [0]:
at System.Runtime.Remoting.Proxies.RealProxy.EndInvokeHelper(Message reqMsg, Boolean bProxyCase)
at RedGate.SQLCompare.Engine.Registration.ReadFromSql.LiveDMVModel.ConnectionOpeningDelegate.EndInvoke(IAsyncResult result)
at RedGate.SQLCompare.Engine.Registration.ReadFromSql.LiveDMVModel.PrepareConnection()
at RedGate.SQLCompare.Engine.Registration.ReadFromSql.LiveDMVModel.GetVersionInformation()
at System.Lazy`1.CreateValue()
at System.Lazy`1.LazyInitValue()
at RedGate.SQLCompare.Engine.Registration.ReadFromSql.LiveDMVModel.get_VersionInformation()
at RedGate.SQLCompare.Engine.Registration.ModelFactory.DatabaseFactory.PopulateVersionInformation()
at RedGate.SQLCompare.Engine.Registration.ModelFactory.DatabaseFactory.LightWeightPopulate(DBPopulationOptions popOptions)
at RedGate.SQLCompare.Engine.Database.RegisterForDataCompare(ConnectionProperties connectionProperties, Options options)
at RedGate.SQLDataCompare.Common.DataCompareEngineExecutor.DoRegisterDatabaseForDataCompare(IDatabase database, IDataSource dataSource)
at RedGate.SQLDataCompare.CommandLine.CommandLineDataCompareEngineExecutor.DoRegisterDatabaseForDataCompare(IDatabase database, IDataSource dataSource)
at RedGate.SQLDataCompare.Common.DataCompareEngineExecutor.DoRegisterDatabase1ForDataCompare()
at RedGate.Shared.Utils.ProgressTasks.ProgressTask.ExecuteSubTasks()
at RedGate.Shared.Utils.ProgressTasks.SimpleProgressTaskExecutor.DoTasks()
--- End of inner exception stack trace ---
at RedGate.SQLToolsCommandLine.CommandProcessor.FatalExceptionHelper(String message, Exception ex)
at RedGate.SQLToolsCommandLine.CommandProcessor.ProcessThreadException(Exception e)
at RedGate.SQLDataCompare.CommandLine.CommandProcessor.ProcessThreadException(Exception e)
at RedGate.SQLToolsCommandLine.CommandProcessor.ProcessThreadException()
at RedGate.SQLToolsCommandLine.CommandProcessor.RunComparison()
at RedGate.SQLToolsCommandLine.CommandProcessor.ProcessCommands()
at RedGate.SQLToolsCommandLine.CommandProcessor.Run()
10:19:28.350|Debug |Fur |1 |Waiting 00:00:02 for outstanding FUR events to be sent ..

Comments

  • Options
    Eddie DEddie D Posts: 1,781 Rose Gold 5
    Hi

    Thank you for your forum post.

    I believe we already have a support call with you.

    Can you please replace MSSQLSERVER in your syntax with (local) and reattempt the comparison, using your example code so it becomes:
    "C:Program Files (x86)Red GateSQL Data Compare 11sqldatacompare" /s1:192.168.1.30(local) /db1:TestDB /s2:192.168.1.20SQLEXPRESS /db2:TestDB2 /u2:testuser /p2:password /Synchronize /Include:Additional /Exclude:Missing /Exclude:Different /LogLevel:Verbose
    

    Many Thanks
    Eddie
    Eddie Davis
    Senior Product Support Engineer
    Redgate Software Ltd
    Email: support@red-gate.com
Sign In or Register to comment.