Sql – Change sql windows username after SQL Installation

authenticationsql

I have installed the SQL Server 2014, but then, renamed "administrator" account to "admin"
Now, I can login to SQL server, but some tasks like replication don't work and this is the error.

SQL Server Scheduled Job 'Replication agents checkup' (0xF6BA10F6432FF34CBE0564F07853C4A8) - Status: Failed - Invoked on: 2016-09-03 19:00:00 - Message: The job failed.  Unable to determine if the owner (SERVER\Administrator) of job Replication agents checkup has server access (reason: Could not obtain information about Windows NT group/user 'SERVER\Administrator', error code 0x534. [SQLSTATE 42000] (Error 15404)).

I want to know how can I let sql know the username has been changed (windows authentication)

Best Answer

If replication is the only thing that broke make sure the user has permissions. Here are the required permissions... Required replication permissions

Your jobs need the owner corrected on them or your user Admin needs permissions corrected as noted above. You can edit the owner with the following changing necessary items of course. If this doesn't make since just search how to change job owner in sql 2014.

To give or change ownership of a job with CMD Line

Click new query at the top, type the following commands filling in the required fields, press the execute button at the top or press f5 (execute)

USE MSDB

GO


SELECT 'EXEC msdb.dbo.sp_update_job @job_name=N'''+NAME+''' , @owner_login_name=N''DOMAIN\ThenewOwner''' FROM sysjobs

GO

EDIT.. Added after...

An easier way to do this for you might be from SSMS Sql Server Management Studio, would be the following.

To give or change ownership of a job with GUI

Connect to an instance of the SQL Server Database Engine with SSMS, and then expand that instance.

Expand SQL Server Agent (normally at the bottom), expand Jobs, right-click the job, and then click Properties.

In the Owner list, select a login.

If your new login isn't in the list simply go to the security folder in the object explorer list and add a user under users. You can add local SQL users or select a windows or domain login. After you add it, come back to jobs and make the change.

Related Topic