Bug in SQL Server?

Found a little bug in SQL Server 2008. Maybe just a Management Studio bug, but still...

Restored a database from a server in another domain to my local instance of SQL Server.
Start running integration tests against the local copy and getting the following error:
Could not obtain information about Windows NT group/user  'domain2\Administrator' error code 0x5.
Some tests are passing, some not.  So I debug one that does not.  Turns out it is inserting records into a table with a trigger that inserts a record into an Audit table.

Nothing peculiar about that, have seen this pattern used in the wild, but never seen this error before.  I start looking at my local copy of the DB and first check the owner.  That is set to my login in the local domain 'domain3\MyUsername'.  Leave it alone for a while, have a look at the logins for the Database, No 'domain2\Administrator' to be found.  Try adding 'domain2\Administrator' as a user and get an error, user already exists.  WTF! I can't see this user anywhere.  Some serious head scratching going on...

Finally I decide to change the owner to 'sa', run the tests and they all work.  Then go and check the database in the 'domain2' domain and there it is the database owner is 'domain2\Administrator'.

So if anyone else runs into this issue, check your database owner first.

Don't ask about the domains, there are many (they are there to replicate our clients environment). And I did not have user access to domain2, but I did have access to the database server.

Comments

Popular Posts