Linked Server problem~!

  • Folks, I need to create a linked server between two SQL servers.. one is on my local machine, other one is at a remote location. I've connected to both servers on SSMS, i need to create the linked server on the remote server in order to be able to import some data from local to remote.

    The following is my add linked server query.

    EXECsp_addlinkedserver

    @server = 'D_Link',

    @provider = 'SQLNCLI',

    @srvproduct = '',

    @datasrc='xxx.xxx.x.xx\A31',--ip address\instance name

    @provstr='SERVER=xxx.xxx.x.xx\A31',

    @catalog='DService' -- DB name

    Could you tell me what I'm doing wrong as I'm getting an error on executing :

    select * from D_Link.DService.dbo.device

    edit:

    The error says:

    [OLE/DB provider returned message: Login timeout expired]

    [OLE/DB provider returned message: An error has occurred while establishing a connection to the server. When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections.]

    [OLE/DB provider returned message: SQL Network Interfaces: Error Locating Server/Instance Specified [xFFFFFFFF]. ]

    OLE DB error trace [OLE/DB Provider 'SQLNCLI' IDBInitialize::Initialize returned 0x80004005: ].

    Msg 7399, Level 16, State 1, Line 1

    OLE DB provider 'SQLNCLI' reported an error.

  • Ok I figured out what my problem was!

    I mentioned only the IP Address rather than IP\instance name

    and then I did the following:

    LinkedServer>> Properties>> Server Options >> Use Remote Collation >> FALSE It is set to True by default.

    Now, what I need to know is, when I try to exec sp_addlinkedserver,

    I get an error that says :

    The user does not have permission to perform this action.

    What permissions would I need for this and how can I set it?

  • Should I be posting this in 'administration' now?

    Please help, people!

    I need to send a request to the client to grant me necessary permissions. So what exactly is it that I need to ask for?

  • you will need to have execute rights to the sp_addlinkedserver procedure.

    kgunnarsson
    Mcitp Database Developer.

  • I tried using openrowset. Do I need permissions for that too?

    I executed the following query on the remote server with IP of my local server in place of xxx.xxx.x.xx :

    SELECT a.*

    FROM OPENROWSET('SQLOLEDB','Server=xxx.xxx.x.xx;Trusted_Connection=yes;',

    'SELECT *

    FROM DService.dbo.device') AS a;

    I get the following error message:

    Msg 7416, Level 16, State 2, Line 1

    Access to the remote server is denied because no login-mapping exists.

    Really... what is it I'm missing out on?

    I'm going nuts here!

  • SELECT a.*

    FROM OPENROWSET('SQLOLEDB','xxx.xxx.x.xx';'sa';'sa',

    'SELECT *

    FROM DService.dbo.device') AS a;

    Error:

    Msg 17, Level 16, State 1, Line 2

    [DBNETLIB][ConnectionOpen (Connect()).]SQL Server does not exist or access denied.

    What does this mean now?

  • did you enable "open rowset" on both instances ?

    Johan

    Learn to play, play to learn !

    Dont drive faster than your guardian angel can fly ...
    but keeping both feet on the ground wont get you anywhere :w00t:

    - How to post Performance Problems
    - How to post data/code to get the best help[/url]

    - How to prevent a sore throat after hours of presenting ppt

    press F1 for solution, press shift+F1 for urgent solution 😀

    Need a bit of Powershell? How about this

    Who am I ? Sometimes this is me but most of the time this is me

  • On my local server, yes.. but on the remote one, I wouldn't be able to check, right?

    EDIT:

    I found some info here:

    http://www.alagad.com/go/blog-entry/one-solution-to-this-error-sql-server-does-not-exist-or-access-denied">

    http://www.alagad.com/go/blog-entry/one-solution-to-this-error-sql-server-does-not-exist-or-access-denied

    But this seems to be a resolution for SQL Server 2000. What about 2005??

    By the way, my local machine is 2005, remote 2000.

  • y the way, my local machine is 2005, remote 2000.

    That's another story :doze:

    Did you apply http://support.microsoft.com/default.aspx?scid=kb;en-us;906954 at the sql2000 instance ?

    Johan

    Learn to play, play to learn !

    Dont drive faster than your guardian angel can fly ...
    but keeping both feet on the ground wont get you anywhere :w00t:

    - How to post Performance Problems
    - How to post data/code to get the best help[/url]

    - How to prevent a sore throat after hours of presenting ppt

    press F1 for solution, press shift+F1 for urgent solution 😀

    Need a bit of Powershell? How about this

    Who am I ? Sometimes this is me but most of the time this is me

  • Ok.. forget I even mentioned one is on 2000 and the other on 2005.

    I can have both on 2000, that's barely even an issue.

    I executed instcat.sql.... no difference.

    Let me get this clear first....

    1) Remote server (say in FL,USA) is on SQL2k

    2) Local Server (say in CA,USA) is on SQL2k

    3) I need to import data from Local Server into the corresponding Remote Server tables.

    4) When i try executing sp_addlinkedserver on remote server, it says I have no permission to perform this action.

    5) So I tried using openrowset on the remote server, as mentioned in the above post. And now it says the Server (Local Server IP in the query) does not exist or Access is denied.

    6) I'm so sure there's something I'm doing wrong but I juts can't put a finger on it!

    What am I expected to do if I need to perform this operation and have no way of accessing the Remote macine except through SSMS/Enterprise Manager.. whichever.

    I'm lost and confused now.

    EDIT:

    When I execute the openrowset on local server with remote server IP, I can query the reqd. tables... WHAT IS HEPPENING? I'm tearing my hair out!!!!

    SELECT a.*

    FROM OPENROWSET('SQLOLEDB','xxx.xxx.xx.x';'da';'4da2',

    'SELECT *

    FROM dcorpdb.dbo.tbl_Designation') AS a;

  • - if you don't need to use the linked server for direct querying, don't

    define it, but switch to SQLDTS or SSIS !

    IMO one should avoid linked servers because you are

    actualy connecting systems in an online-realtime mode.

    If the other server is down, that may have a direct impact to your

    local db system if used by applications. So they will get errors !

    - Do you use domain accounts for service account of your sqlserver instance ?

    - can both servers "see" eachother ? (ping local at the server)

    - are you using the correct accounts/account mapping ?

    Johan

    Learn to play, play to learn !

    Dont drive faster than your guardian angel can fly ...
    but keeping both feet on the ground wont get you anywhere :w00t:

    - How to post Performance Problems
    - How to post data/code to get the best help[/url]

    - How to prevent a sore throat after hours of presenting ppt

    press F1 for solution, press shift+F1 for urgent solution 😀

    Need a bit of Powershell? How about this

    Who am I ? Sometimes this is me but most of the time this is me

  • - if you don't need to use the linked server for direct querying, don't

    define it, but switch to SQLDTS or SSIS !

    This is as simple as right-clicking on the source database --> tasks --> export data. You can then save this package and run it anytime you want.

    There is no need to create a linked server just to move data.

  • Geez!! I feel so foolish! Thanks ALZDBA, thanks Adam!

    The export took me like 5 mins!!!!

    See post

    http://www.sqlservercentral.com/Forums/Topic462157-146-1.aspx?Update=1

    if any one needs to know exactly why I was doing all this 🙂

    Thanks again, people!

    Good day!

  • and sqlserver is getting equipped with such a broad scale toolset,

    it's getting hard to just know it all 😉

    HTH

    Johan

    Learn to play, play to learn !

    Dont drive faster than your guardian angel can fly ...
    but keeping both feet on the ground wont get you anywhere :w00t:

    - How to post Performance Problems
    - How to post data/code to get the best help[/url]

    - How to prevent a sore throat after hours of presenting ppt

    press F1 for solution, press shift+F1 for urgent solution 😀

    Need a bit of Powershell? How about this

    Who am I ? Sometimes this is me but most of the time this is me

  • Geez!! I feel so foolish! Thanks ALZDBA, thanks Adam!

    NP, glad I could help.

    and sqlserver is getting equipped with such a broad scale toolset,

    it's getting hard to just know it all

    Totally agree.

Viewing 15 posts - 1 through 14 (of 14 total)

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