Schema compare with MS Data Tools in VS2008
        Posted  
        
            by rdkleine
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by rdkleine
        
        
        
        Published on 2010-05-06T13:16:48Z
        Indexed on 
            2010/05/18
            8:40 UTC
        
        
        Read the original article
        Hit count: 701
        
When performing a schema compare having db_owner rights on the target database results in the following error:
The user does not have permission to perform this action.
Using the SQL Server Profiler I figured out this error occurs executing a query targeting the master db view: [sys].[dm_database_encryption_keys]
While specifically ignoring all object types but Tables one would presume the SQL Compare doesn't need access to the db encryption keys. Also note:
http://social.msdn.microsoft.com/Forums/en-US/vstsdb/thread/c11a5f8a-b9cc-454f-ba77-e1c69141d64b/
One solution would be to GRANT VIEW SERVER STATE to the db user, but in my case I'm not hosting the database services and won't get the rights to the server state.
Also tried excluding DatabaseEncryptionKey element in the compare file.
 <PropertyElementName>
    <Name>Microsoft.Data.Schema.Sql.SchemaModel.SqlServer.ISql100DatabaseEncryptionKey</Name>
    <Value>ExcludedType</Value>
 </PropertyElementName>
Anyone has an workaround this?
© Stack Overflow or respective owner