Command line synchronization error - Cannot find the user

Compares and synchronizes SQL Server databases, backups and scripts.

Moderators: JonathanWatts, Chris Auckland, David Atkinson, eddie davis, Anu Deshpande, Michelle Taylor, alice.easey, james.billings, chengvoon.tong

Command line synchronization error - Cannot find the user

Postby instalectual » Wed May 21, 2014 8:46 pm

I am attempting to automatically synchronize a database on a test server as part of our build process which is executed for every commit to SVN. We use CruiseControl to execute the builds and I have been successfully generating change scripts using this process for other environments. This is the first time I have tried to deploy changes using the /synchronize switch on the command line.

I receive the following error when the command is executed by CruiseControl running under the Localy System Account:

Error: Synchronization of '.' and '[removed server info]' failed: Cannot
find the user '[removed user name]', because it does not exist or you do not
have permission.


The user it seems to be tripping over doesn't exist in the DB anymore and if I execute the command manually at a command prompt as an administrator it works without issue and changes are synchronized. I'm at a loss here. I would believe it to be a permissions issue if the user in the error actually existed. The cleansed command is below, the settings marked as [removed] are verified and correct:

sqlcompare /sourcecontrol1 /revision1:72023 /versionusername1:[removed] /versionpassword1:[removed] /Server2:[removed] /Database2:[removed] /synchronize /scriptsfolderxml:[removed] /filter:[removed] /include:StaticData /options:AddDatabaseUseStatement,IgnoreUsers,IgnorePermissions,IgnoreUsersPermissionsAndRoleMemberships


The source is the revision in SVN being built, the target is the database on the test server, the differences are to be synchronized by sql compare.

I appreciate any feedback on this error.
instalectual
 
Posts: 13
Joined: Wed Sep 04, 2013 7:42 pm
Location: United States

Postby Brian Donahue » Tue May 27, 2014 3:50 pm

My best guess is the answer lies in the filter.

Presumably, like most people you are trying to avoid synchronizing Windows users, which cause problems when going from one environment to another.

If you set the options to ignore users, user permissions, and role memberships, it should be safe to filter out users. I guess the key would be to try to work out the particular SQL query SQL Compare ran which caused the error message to appear. the only practical way to do that AFAIK is to try running a SQL Profiler session on the server at the same time as the job runs.

At least then we would know what user and object(s) are involved in the query. Without that, it's impossible to say why you have a problem and how you can adjust the filter and/or command-line.
Brian Donahue
 
Posts: 6670
Joined: Mon Aug 23, 2004 10:48 am

Postby instalectual » Tue May 27, 2014 6:16 pm

I can run a trace while the synchronization happens. I don't think it's the filters however because I am able to run the command manually at the command line and it works. It's the exact same command using the same filters on which the automatic task is failing. Also, the user it fails to synchronize does not exist in the source or target, I think the issue would be related to whatever is causing the synchronization task to try and synchronize a object that is not in either database.
instalectual
 
Posts: 13
Joined: Wed Sep 04, 2013 7:42 pm
Location: United States

Postby Brian Donahue » Wed May 28, 2014 9:03 am

it's probably trying to add the user to a role or assign a permission. But like I said, with the options it should not be doing that, so it's a mystery.

The only thing I can think of is someone tried to create or edit the .scpf file by-hand and that causes unpredictable results.

Possibly the "user" complaint it's making is related to cruise control rather than SQL Compare... maybe it can't impersonate a user or something? In the command-line arguments, you do not use SQL auth, so it is trying to run as LocalSystem, which is more than likely not allowed to do operations on the database. There would have to be some impersonation taking place so the task runs as some other Windows user.
Brian Donahue
 
Posts: 6670
Joined: Mon Aug 23, 2004 10:48 am

Postby instalectual » Wed Jul 02, 2014 7:33 pm

It turns out that one of the table creation scripts in SVN was trying to grant permissions to the user and since the user no longer exists we encountered the error. I'm still not clear why that grant statement was in the table creation script but editing the script and committing seemed to resolve the issue. Hopefully editing the script directly doesn't have any unintended consequences.

-D
instalectual
 
Posts: 13
Joined: Wed Sep 04, 2013 7:42 pm
Location: United States

Postby iil888 » Sun Jul 06, 2014 12:03 pm

I had the same problem and got it solved editing the script and commiting.

Thanks for your help.

Regards

iil888
iil888
 
Posts: 1
Joined: Sun Jul 06, 2014 11:58 am
Location: España


Return to SQL Compare 10

Who is online

Users browsing this forum: No registered users and 0 guests