0

I am trying to run a command that looks like this:

Create ASSEMBLY [AssemblyName]
AUTHORIZATION [dbo]
From ...

When this runs, it returns an error message: Could not obtain information about Windows NT group/user 'oldMachineName\username', error code 0x534.

In this case oldMachineName is the old machine name for my computer. I changed the computer's machine name to newMachineName before every installing Sql Server, but there are obviously some vestiges of it hanging around.

When I log into Sql Server using SSMS, it correctly lists the logged-in user as newMachineName\username. Yet when running this command with Authorization dbo it is trying to use oldMachineName.

So, how can I convince Sql Server that oldMachineName doesn't exist anymore and teach it the correct group/user of the current dbo (ie: my logged in user)?

1 Answer 1

1

It seems the database was created/restored/attached by a Windows account user that no longer exists. Change the database owner to a valid existing login using ALTER AUTHORIZATION

ALTER AUTHORIZATION ON DATABASE::YourDatabase TO SomeValidLogin;

Consider creating a login, perhaps one per database, without CONNECT permissions for database ownership purposes. That will avoid this sort of problem going forward.

7
  • The database was created yesterday, I have not used the oldMachineName account since the first time I logged into the computer two years ago and changed the machine name. Commented Jan 25, 2018 at 13:00
  • Regarding the machine name change, what does SELECT @@SERVERNAME return?
    – Dan Guzman
    Commented Jan 25, 2018 at 13:10
  • It returns my current machine name (newMachineName) Commented Jan 25, 2018 at 13:22
  • Do you get the error if you turn off the clr strict security config option?
    – Dan Guzman
    Commented Jan 25, 2018 at 13:28
  • It works when I turn off clr strict security Commented Jan 25, 2018 at 13:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.