none
SQL Server Jobs failing with Unable to perform a SETUSER

    Question

  • We just recently completed a database migration from Windows Server 2003 SP2 with SQL Server 2005 Enterprise SP4 (32 bit) to Windows Server 2008 R2 with SQL Server 2005 Enterprise SP4 (64 bit).

    Basically, we built the new environment from scratch, and restored database backups.  Created the SQL Agent jobs using the old servers as a guide.

    On the 64 bit server, we are getting the following error: Unable to perform a SETUSER to the requested username 'dbo' because the username is invalid for database 'XXXXXX'.  The step failed. 

    In the advance properties of the job step, we have Run as user set to dbo.  If we remove dbo from this property the step works.

    On the 32bit server, the job step has dbo, and runs just fine. 

    The only difference that I am aware of is the 32 bit environment was upgraded from SQL Server 2000 to SQL Server 2005 SP4, where as the 64 bit SQL Server 2005 SP4 was installed directly, no upgrade.

    Was the fact that the 32 bit environment was upgraded from SQL Server 2000 was that the reason why the SETUSER worked, or is there something else that I am missing?

    Thanks.

    DJ

    Wednesday, September 25, 2013 11:43 AM

Answers

  • On the 64 bit server, we are getting the following error: Unable to perform a SETUSER to the requested username 'dbo' because the username is invalid for database 'XXXXXX'.  The step failed. 

    Perhaps the database owner mapping is incorrect due to the restore.  Try changing the database owner to a valid account.  For example:

    ALTER AUTHORIZATION ON DATABASE:SomeDatabase TO sa;


    Dan Guzman, SQL Server MVP, http://www.dbdelta.com

    • Marked as answer by donsjones Wednesday, September 25, 2013 1:06 PM
    Wednesday, September 25, 2013 11:53 AM

All replies

  • On the 64 bit server, we are getting the following error: Unable to perform a SETUSER to the requested username 'dbo' because the username is invalid for database 'XXXXXX'.  The step failed. 

    Perhaps the database owner mapping is incorrect due to the restore.  Try changing the database owner to a valid account.  For example:

    ALTER AUTHORIZATION ON DATABASE:SomeDatabase TO sa;


    Dan Guzman, SQL Server MVP, http://www.dbdelta.com

    • Marked as answer by donsjones Wednesday, September 25, 2013 1:06 PM
    Wednesday, September 25, 2013 11:53 AM
  • Dan,

    thanks for the reply.  I think you you're right. 

    I'll give it a try and respond back.

    Wednesday, September 25, 2013 12:26 PM
  • Dan,

    Thanks for the information, it worked.  Jobs working fine with DBO.

    DJ

    Wednesday, September 25, 2013 1:07 PM