SQL SERVER – Fix Error 7202 Could not find server in sys.servers. Verify that the correct server name was specified

The other day I received following error when I tried to restore a database from one server to another server.

Msg 7202, Level 11, State 2, Line 1
Could not find server ‘MyLinkedServer’ in sys.servers. Verify that the correct server name was specified.

Well, this is quite a popular error one receive when they attempt to restore database containing references of the linked server. The solution is to create a link server and restore database. Here is the quick script which can fix your error.

EXEC sp_addlinkedserver @server='MyLinkedServer'
EXEC sp_addlinkedsrvlogin 'MyLinkedServer', 'false', NULL, 'MyUserName', 'MyPassword'

Well, that’s it. Sometimes the solution is much simpler, even though the original problem looks complicated.

Reference: Pinal Dave (https://blog.sqlauthority.com)

Previous Post
SQL Authority News – Secret Tool Box of Successful Bloggers: 52 Tips to Build a High Traffic Top Ranking Blog
Next Post
SQL SERVER – Query to Find Seed Values, Increment Values and Current Identity Column Value of the Table with Max Value of Datatype

Related Posts

10 Comments. Leave new

  • Fix SQL error=7202

    Reply
    • Did it help you?

      Reply
      • No, still same issue.

        Msg 7202, Level 11, State 2, Line 1
        Could not find server ‘servername.domain.com ‘ in sys.servers. Verify that the correct server name was specified. If necessary, execute the stored procedure sp_addlinkedserver to add the server to sys.servers.
        Msg 7202, Level 11, State 2, Line 1

  • Hi, I try to excute your script but return this error:

    OLE DB provider “SQLNCLI10” for linked server “XXXXXXXXXXX” returned message “Multiple-step OLE DB operation generated errors. Check each OLE DB status value, if available. No work was done.”.
    Msg 7202, Level 11, State 2, Line 1
    Impossibile trovare il server ‘XXXXXXXXXXX’ in sys.servers. Verificare che sia stato specificato il nome corretto del server. Se necessario, eseguire la stored procedure sp_addlinkedserver per aggiungere il server a sys.servers.

    Reply
  • Thank you

    Reply
  • Is this script supposed to be run on the destination server or the source server?

    Reply
  • Msg 15028, Level 16, State 1, Procedure sp_addlinkedserver, Line 82
    The server ‘GUANGZHOU’ already exists.

    Reply
  • phillipwolf91
    May 12, 2016 12:02 am

    I was having this same issue – I found out that I had screwed up the SqlCommand.CommandText value and had accidentally put the SqlCommand object as the CommandText value — but this was in PowerShell so a strongly typed language would have caught that.

    Reply
  • The link server already exists with successful connection test. But still I am getting this error.

    Reply
  • Which version of SQL you are using?

    Reply

Leave a Reply

Menu