Error when Getting Migration SQL: Missing .idx file
dwilliams
Posts: 6
When attempting to Get the migration sql for execution, I am getting a "Could not find file" error. It appears to be looking for an .idx file. Shorter data comparisons do not generate this error. It appears if the number of changes are large (as they are in this case) GetMigrationSql attempts to write to a specific file, however this file is not found? I also tried setting the environment variable to write to a differenct location (c:\temp) however the same error occured (with the new file location).
The error and abreviated stack trace are below.
Could not find file 'C:\Documents and Settings\(username)\Local Settings\Temp\RGDC-f5d43482-dfbc-4976-bebd-31e224f6e5f8.2.idx'.
at System.IO.__Error.WinIOError...
at System.IO.FileStream.Init...
at System.IO.FileStream..ctor...
...
at RedGate.SQLDataCompare.Engine.SqlProvider.GetMigrationSQL...
...
The code I am running is as follows. This appears to fail when calling GetMigrationSQL
The error and abreviated stack trace are below.
Could not find file 'C:\Documents and Settings\(username)\Local Settings\Temp\RGDC-f5d43482-dfbc-4976-bebd-31e224f6e5f8.2.idx'.
at System.IO.__Error.WinIOError...
at System.IO.FileStream.Init...
at System.IO.FileStream..ctor...
...
at RedGate.SQLDataCompare.Engine.SqlProvider.GetMigrationSQL...
...
The code I am running is as follows. This appears to fail when calling GetMigrationSQL
private void ExecuteDataSyncScript(ComparisonSession cmpSession) { SqlProvider provider = new SqlProvider(); using (ExecutionBlock block = provider.GetMigrationSQL(cmpSession, true)) { // Update Changes BlockExecutor executor; executor = new BlockExecutor(); executor.ExecuteBlock(block, _ServerName, _DatabaseName); } }The session is created as follows:
cmpSession = new ComparisonSession(); cmpSession.CompareDatabases(dbSource, dbTarget, mappings);
Comments
The last time this happened, it was because the user was running the dispose() method on the session before invoking the method that produces the synchronization script. In this case, the temporary files needed to generate the SQL are deleted and this error results.