No error for missing Linked Server?

  • Scenario: Restored backup of database to new environment. Getting wonky results from external process.

    Running a single proc simply gets me:

    Command(s) completed successfully.

    Running individual components of said proc:

    Msg 7202, Level 11, State 2, Line 1

    Could not find server 'L_CRM' 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.

    Quick doublecheck confirms I'm running both in the same context of server and database.

    Now, it's right, I never did build this linked server like I was supposed to when I moved it into this testing environment... primarily because I'm playing a game of 'find the bug' at the moment. I expected a proc with a linked server built into it that doesn't exist would complain.

    What gives? Anyone run into this before?


    - Craig Farrell

    Never stop learning, even if it hurts. Ego bruises are practically mandatory as you learn unless you've never risked enough to make a mistake.

    For better assistance in answering your questions[/url] | Forum Netiquette
    For index/tuning help, follow these directions.[/url] |Tally Tables[/url]

    Twitter: @AnyWayDBA

  • Found problem.

    Please note: If you're not familiar with how to properly escape unexpected errors out of your Try/Catch, please learn before using it in production code and driving some poor beggar who's inheriting it later crazy.


    - Craig Farrell

    Never stop learning, even if it hurts. Ego bruises are practically mandatory as you learn unless you've never risked enough to make a mistake.

    For better assistance in answering your questions[/url] | Forum Netiquette
    For index/tuning help, follow these directions.[/url] |Tally Tables[/url]

    Twitter: @AnyWayDBA

  • Sorry for your troubles Craig...your avatar <edit>your old avatar anyway :-)</edit> is very fitting on this thread 😀

    I have fought with missing or incorrect Linked Servers in non-prod environments and it's not fun. At one stop the "System DBAs" were in a separate group the "Development DBAs" (group I was running with) and they handled all non-prod DB "refreshes" and Linked Server configs. I could not do anything about the problems except provide a script for them to run after they restored a database to recompile every object in the database, essentially highlighting all missing and broken Linked Servers by way of a failed compilation 😛

    There are no special teachers of virtue, because virtue is taught by the whole community.
    --Plato

  • This script from Lowell is pretty slick:

    http://www.sqlservercentral.com/Forums/FindPost1140415.aspx

    It's better than what I had in place. It only needs a few tweaks. I gave it a spin and the I saw it needed some help with the string replacements to pickup procs that use 'CREATE PROC' instead of 'CREATE PROCEDURE', and to account for whitespace after CREATE.

    There are no special teachers of virtue, because virtue is taught by the whole community.
    --Plato

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply