How to stop adding users and other security stuff

Brian DonahueBrian Donahue Posts: 6,590 Bronze 1
Hi Ian,

Right, do not migrate the users, filter them out by not selecting the
difference for migration:

obDatabaseDifferences = dbSourceDatabase.CompareWith(dbTargetDatabase,
enOptions);


foreach (Difference d in obDatabaseDifferences)

{

if (d.Type==ObjectType.User || d.Type==ObjectType.Role) d.Selected = false;

else d.Selected=true;

}

Regards,

Brian Donahue

Red Gate Technical Support

P.S. -- This question really belongs in the SQLCompare or Toolkit newsgroup!
:-)



"Ian Spence" <ian.spence@ebooks.com> wrote in message
news:l%23pQZ%23vQEHA.2140@server53...

> This problem has come about from the following error:
>
> Unhandled Exception: System.Data.SqlClient.SqlException: User does not
have
> permission to perform this action.
> at System.Data.SqlClient.SqlCommand.ExecuteNonQuery()
> at RedGate.SQL.Shared.Utils.ExecuteBlock(ExecutionBlock block, String
> server, String database, Boolean integratedSecurity, String userName,
String
> password)
> at Sync.CompareStructure.Synchronize(Database db1DatabaseParams,
Database
> db2DatabaseParams, IList tableNames)
> at Sync.Sync.Main(String[] args)
>
> "Ian Spence" <ian.spence@ebooks.com> wrote in message
> news:kVwBrmvQEHA.1508@server53...
> > The RedGate.SQLCompare.Engine is attempting to create users and roles.
> How
> > can I stop this ? I have tried different Options e.g.
> >
> > Differences differences=db1.CompareWith(db2,
> > Options.Default|Options.IgnorePermissions);
> >
> > The output SQLServer commands are listed here.
> >
> > ---
> > if not exists (select * from master.dbo.syslogins where loginname =
> N'ian')
> > exec sp_addlogin N'ian'
> > GO
> > sp_grantdbaccess N'ian', N'ian'
> > GO
> > sp_addrolemember 'db_owner', 'ian'
> > GO
> > sp_droprolemember 'db_owner', 'EBLUser'
> > GO
> > sp_droprolemember 'db_accessadmin', 'EBLUser'
> >
> >
>
>
This discussion has been closed.