How to script out linked in servers from sql 7.0

Can someone help me with the syntax of scripting out the linked server. Thanks

Hi Suresh,
In addition to other post, you can use the detailed T-SQL scripts below to script out all linked and remote servers on SQL 7.0.
--Script to script out all linked/remote servers
--Works on 7.0 and 2000 servers
--remote password decrypt only works on 7.0
declare
@status smallint, -- server status
@server sysname, -- server name
@srvid smallint, -- server id
@srvproduct nvarchar(128), -- product name (dflt to ss)
@allsetopt int, --sum of all settable options
@provider nvarchar(128), -- oledb provider name
@datasrc nvarchar(4000), -- oledb datasource property
@location nvarchar(4000), -- oledb location property
@provstr nvarchar(4000), -- oledb provider-string property
@catalog sysname, -- oledb catalog property
@netname varchar(30), -- Server net name
@srvoption varchar(30), -- server options
@loclogin varchar(30), -- Local user
@rmtlogin varchar(30), -- Remote user
@selfstatus smallint, -- linked server login status
@rmtpass varbinary(256), -- linked server login password
@pwdtext nvarchar(128), -- linked server decrypted password
@i int, -- linked server pswd decrypt var
@lsb tinyint, -- linked server pswd decrypt var
@msb tinyint, -- linked server pswd decrypt var
@tmp varbinary(256) -- linked server pswd decrypt var
select @allsetopt=number from master.dbo.spt_values
where type = 'A' and name = 'ALL SETTABLE OPTIONS' -- Only 7.0 else use 4063
declare d cursor for SELECT srvid,srvstatus, srvname, srvproduct, providername, datasource,
location, providerstring, catalog, srvnetname
from master..sysservers
where srvid > 0 -- Local Server
open d
fetch next from d into @srvid, @status, @server, @srvproduct, @provider, @datasrc,
@location, @provstr, @catalog, @netname
SET NOCOUNT ON
while (@@FETCH_STATUS<>-1) begin
PRINT '--------------------------------'
Print '-- ' + @server
PRINT '--------------------------------'
If @status in (64,65) --Remote Server
Begin
Print 'sp_addserver'
Print ' @server = '''+ @server + ''''
Print ' GO'
If @status = 64
Begin
Print 'sp_serveroption'
Print ' @server = '''+ @server + ''','
Print ' @optname = ''rpc'','
Print ' @optvalue = ''false'''
Print ' GO'
End
exec ('declare r cursor for
select l.name, r.remoteusername from
sysremotelogins r join sysservers s on
r.remoteserverid = s.srvid
join syslogins l on
r.sid = l.sid
where s.srvname = '''+ @server + '''')
open r
fetch next from r into @loclogin, @rmtlogin
while (@@FETCH_STATUS<>-1)
begin
Print 'sp_addremotelogin'
Print ' @remoteserver = '''+ @server + ''','
Print ' @loginame = '''+ @loclogin + ''','
Print ' @remotename = '''+ @rmtlogin + ''''
Print ' GO'
fetch next from r into @loclogin, @rmtlogin
end
close r
deallocate r
End
Else --Linked server
Begin
If exists (select * from tempdb..sysobjects where name like '#tmpsrvoption%')
Begin
drop table #tmpsrvoption
End
Create Table #tmpsrvoption
srvoption varchar(30)
insert #tmpsrvoption
select v.name
from master.dbo.spt_values v, master.dbo.sysservers s
where srvid = @srvid
and (v.number & s.srvstatus)=v.number
and (v.number & isnull(@allsetopt,4063)) <> 0
and v.number not in (-1, isnull(@allsetopt,4063))
and v.type = 'A'
PRINT 'sp_addlinkedserver'
Print ' @server = '''+ @server + ''''
Print ', @srvproduct = ''' + @srvproduct + ''''
If @srvproduct <> 'SQL Server' --Cannot specify additional info for SQL Server Product
Begin
Print ', @provider = ''' + @provider + ''''
Print ', @datasrc = ''' + @datasrc + ''''
Print ', @location = ''' + @location + ''''
Print ', @provstr = ''' + @provstr + ''''
Print ', @catalog = ''' + @catalog + ''''
End
Print ' GO'
-- Set all servers options to false, then reset correct server options
Print 'sp_serveroption'
Print ' @server = '''+ @server + ''','
Print ' @optname = ''rpc'','
Print ' @optvalue = ''false'''
Print ' GO'
Print 'sp_serveroption'
Print ' @server = '''+ @server + ''','
Print ' @optname = ''rpc out'','
Print ' @optvalue = ''false'''
Print ' GO'
Print 'sp_serveroption'
Print ' @server = '''+ @server + ''','
Print ' @optname = ''data access'','
Print ' @optvalue = ''false'''
Print ' GO'
declare s cursor for SELECT srvoption
from #tmpsrvoption
open s
fetch next from s into @srvoption
while (@@FETCH_STATUS<>-1)
begin
Print 'sp_serveroption'
Print ' @server = '''+ @server + ''','
Print ' @optname = '''+ @srvoption + ''','
Print ' @optvalue = ''true'''
Print ' GO'
fetch next from s into @srvoption
End
close s
deallocate s
--Script linked server logins
If exists (select * from tempdb..sysobjects where name like '#tmplink%')
Begin
drop table #tmplink
End
create table #tmplink
rmtserver sysname,
loclogin sysname null,
selfstatus smallint,
rmtlogin sysname null
insert #tmplink
exec ('sp_helplinkedsrvlogin '''+ @server + '''')
declare ll cursor for
select loclogin, selfstatus, rmtlogin from #tmplink order by rmtlogin
open ll
fetch next from ll into @loclogin, @selfstatus, @rmtlogin
while (@@FETCH_STATUS<>-1)
begin
-- Use self no remote user/password
If (@selfstatus = 1 and @loclogin is null)
Begin
Print 'sp_addlinkedsrvlogin'
Print ' @rmtsrvname = '''+ @server + ''','
Print ' @useself = ''true'''
Print ' GO'
End
Else
If (@selfstatus = 1 and @loclogin is not null) Begin
Print 'sp_addlinkedsrvlogin'
Print ' @rmtsrvname = '''+ @server + ''','
Print ' @useself = ''true'','
Print ' @locallogin = '''+ @loclogin + ''','
Print ' @rmtuser = NULL,'
Print ' @rmtpassword = NULL'
Print ' GO'
End
Else
If (@selfstatus = 0 and @rmtlogin is null) Begin
Print 'sp_addlinkedsrvlogin'
Print ' @rmtsrvname = '''+ @server + ''','
Print ' @useself = ''false'','
Print ' @locallogin = NULL,'
Print ' @rmtuser = NULL,'
Print ' @rmtpassword = NULL'
Print ' GO'
End
Else
If (@selfstatus = 0) Begin -- Check for Use self mappings
exec ('declare pwd cursor for
select l.password from master..sysservers s
join master..sysxlogins l on s.srvid = l.srvid --where l.sid is not null
where s.srvname = '''+ @server + ''' and l.name = '''+ @rmtlogin + '''')
-- Decrypt passwords
-- Only works for 7.0 server
-- Encrypt algorithm changed in 2000
open pwd
fetch next from pwd into @rmtpass
while @@fetch_status = 0
begin
set @i = 0
set @pwdtext = N''
while @i < datalength(@rmtpass)
begin
set @tmp = encrypt(@pwdtext + nchar(0))
set @lsb = convert(tinyint, substring(@tmp, @i + 1, 1))
^ convert(tinyint, substring(@rmtpass, @i + 1, 1))
set @i = @i + 1
set @tmp = encrypt(@pwdtext + nchar(@lsb))
set @msb = convert(tinyint, substring(@tmp, @i + 1, 1))
^ convert(tinyint, substring(@rmtpass, @i + 1, 1))
set @i = @i + 1
set @pwdtext = @pwdtext + nchar(convert(smallint, @lsb)
+ 256 * convert(smallint, @msb))
end
Print 'sp_addlinkedsrvlogin'
Print ' @rmtsrvname = '''+ @server + ''','
Print ' @useself = ''false'','
If (@loclogin is null)
Begin
Print ' @locallogin = NULL,'
End
Else
Begin
Print ' @locallogin = '''+ @loclogin + ''','
End
If (@rmtlogin is null)
Begin
Print ' @rmtuser = NULL,'
End
Else
Begin
Print ' @rmtuser = '''+ @rmtlogin + ''','
End
If (@pwdtext is null)
Begin
Print ' @rmtpassword = NULL'
End
Else
Begin
print ' @rmtpassword = '''+ @pwdtext + ''''
End
Print ' GO'
fetch next from pwd into @rmtpass
end
close pwd
deallocate pwd
End
fetch next from ll into @loclogin, @selfstatus, @rmtlogin
End
close ll
deallocate ll
End
If @netname <> @server -- If the srvnetname.sysservers is different from srvname.sysservers
Begin
Print 'sp_setnetname'
Print ' @server = '''+ @server + ''','
Print ' @network_name = '''+ @netname + ''''
End
fetch next from d into @srvid,@status, @server, @srvproduct, @provider, @datasrc,
@location, @provstr, @catalog, @netname
End
close d
deallocate d
Reference:
http://www.sqlservercentral.com/scripts/Miscellaneous/30620/
Thanks,
Lydia Zhang
Lydia Zhang
TechNet Community Support

Similar Messages

  • How to script out to connect to Active Directory specific domain controller server?

    How to script out a script that enable us to connect to the specific domain controller server, it is because I have 2 different servers version and both of them have been communicate with powershell, thus, I wanted to powershell to communicate with one
    server version. How to script this out? 

    Please see the Posting Guidlines:
    http://social.technet.microsoft.com/Forums/en-US/a0def745-4831-4de0-a040-63b63e7be7ae/posting-guidelines?forum=ITCG
    and this article on how to ask questions in a technical forum:
    http://sincealtair.blogspot.com/2010/04/how-to-ask-questions-in-technical-forum.html
    [string](0..33|%{[char][int](46+("686552495351636652556262185355647068516270555358646562655775 0645570").substring(($_*2),2))})-replace " "

  • How to find out web-inf path from the physical drive?

    How to find out web-inf path from the physical drive?
    I have some user profiles in web-inf directory.SO I want to know the path from root directory like
    d:/program files/allaire/jrun/appname/web-inf/profiles/username like that.
    Presently I am able to get the path upto the application directory and from that I am concatinationg web-inf/profiles/username .
    But it is giving problems when it is deployed under unix or linux.Because web-inf there it treats as WEB_INF
    SO I want to get the path of web-inf directory with out hard coding.
    Thanku

    String path = application.getRealPath("/WEB-INF/profiles/username");
    Note sure why you need this, but you don't need the real path to read the file - you can get an InputStream using the relative path. See ServletContext getResource() and getResourceAsStream().

  • How to send active links in email from firefox. Works in IE but not Firefox... Is there a setting to change?

    how to send active links in email from firefox. Works in IE but not Firefox... Is there a setting to change?
    == This happened ==
    Every time Firefox opened
    == Always

    Check with your web mail service provider for help with that issue.

  • How to send active links in email from firefox

    how to send active links in email from firefox. Works in IE but not Firefox... Is there a setting to change?
    == Operating system ==
    Windows 7

    Check with your web mail service provider for help with that issue.

  • SQL 2012 Linked Server connection from SQL 2000

    Hi,
    Does anyone know if it's possible to create a linked server connection in SQL 2000 to a SQL 2012 instance?
    If so, which provider should I use?
    Many Thanks,
    Phil

    Hi Shanky,
    I'm afraid you misunderstood my Q. The above posts show how to create a linked server connection FROM SQL2012 --> SQL 2000.
    I'm trying to create a linked server connection FROM SQL 2000 --> SQL 2012.
    Does anyone know if it's possible?
    Many Thanks,
    Phil
    I guess you dont read posts patiently below link ,which i also posted in my first reply, has details about the same
    http://social.msdn.microsoft.com/Forums/en-US/2e02c603-e28d-49eb-b073-548c59732b5d/linked-server-from-sql2012-to-sql2000?forum=sqlsetupandupgrade
    Please mark this reply as the answer or vote as helpful, as appropriate, to make it useful for other readers

  • How to delete/drop all the tables from SQL Server Database without using Enterprise Manager?

    How to delete/drop all the tables from SQL Server Database without using Enterprise Manager?
    I tried using DROP Tables, Truncate Database, Delete and many more but it is not working.  I want to delete all tables using Query Analyzer, i.e. through SQL Query.
    Please help me out in this concern.
    Nishith Shah

    Informative thread indeed. Wish I saw it early enough. Managed to come up with the code below before I saw this thread.
    declare @TTName Table
    (TableSchemaTableName
    varchar
    (500),
    [status] int
    default 0);
    with AvailableTables
    (TableSchemaTableName)
    as
    (select
    QUOTENAME(TABLE_SCHEMA)
    +
    +
    QUOTENAME(TABLE_NAME)
    from
    INFORMATION_SCHEMA.TABLES)
    insert into @TTName
    (TableSchemaTableName)
    select *
    from AvailableTables
    declare @TableSchemaTableName varchar
    (500)
    declare @sqlstatement nvarchar
    (1000)
    while 1=1
    begin
    set @sqlstatement
    =
    'DROP TABLE '
    + @TableSchemaTableName
    exec
    sp_executeSQL
    @sqlstatement
    print
    'Dropped Table : '
    + @TableSchemaTableName
    update @TTName
    set [status]
    = 1
    where TableSchemaTableName
    = @TableSchemaTableName
    if
    (select
    count([Status])
    from @TTName
    where [Status]
    = 0)
    = 0
    break
    end

  • How to find out sub site name from which sub site template is created - in solution gallery

    hi,
     i am having an issue in my "save site as a template". i have created  a subsite few weeks back with doc libs and  splists, disc.forum and  based on the template subsite I have created new subsites. now 
    as  per my new requirement i need to add new  doclibs and few columns in these doc lib. But I am unable to find which sub site was taken as a template.since i have many  subsites with different names, I forgott
    to make meaningful names, i gave some datetime for the templatesubsites,
    like project_27_jul_2pm,project_20_jul_7pm, etc etc.
    So would like to know, is it possible to find out from which subsite I have taken/prepared  the template subsite.
    any APIs are available or any power shell scripts. such that i can find  out from which subsite i have created this  sub site template.

    check this
    http://social.msdn.microsoft.com/Forums/en-US/3c492adb-e7cb-4f5c-8c29-386a21c3498e/how-to-find-out-a-list-of-sites-created-from-a-template?forum=sharepointgeneralprevious

  • How to find out what was imported from a dump file

    Hi.
    I got the dump file from a group and they told me to import it. Import job went successfully without errors as following:
    Import: Release 9.2.0.6.0 - Production on Mon Oct 16 20:53:12 2006
    Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved.
    Connected to: Oracle9i Enterprise Edition Release 9.2.0.6.0 - 64bit Production
    With the Partitioning, OLAP and Oracle Data Mining options
    JServer Release 9.2.0.6.0 - Production
    Export file created by EXPORT:V09.02.00 via conventional path
    Warning: the objects were exported by OPS$ORACLETS, not by you
    import done in US7ASCII character set and UTF8 NCHAR character set
    import server uses WE8ISO8859P1 character set (possible charset conversion)
    export server uses AL16UTF16 NCHAR character set (possible ncharset conversion)
    . importing OPS$ORACLETS's objects into SYS
    . importing BDS_APP's objects into BDS_APP
    Import terminated successfully without warnings.
    How do i find out what was imported from a dump file?

    another way would be to just list the contents of the dump file
    imp user/pass file=dumpfile show=Y

  • How to find out the batches released from ASCP

    hello gurus,
    Please let me know how to find out the batches which is released from the ASCP in the OLTP OPM instance, like for the Discrete in the WIP Order in the others tabe we can see that there will be a message like " Job mass loadded on......". So is there any way that we can findout whether the batch is released from the ASCP or is it manually created.
    Thanx & Regards

    Hi,
    You can check it in SM59 if there are any RFC destinations for the above systems.
    Alternatively ,check the table RFCDEST if any entries are maintained
    Regards,
    Lakshman.

  • How to fill out POST HTML forms from my Java Application?

    Hi -
    I am writing a little Java GUI program that will allow a user to fill out data from the GUI and then submit that data. When they submit the data (two text fields) I want to take the two text fields and submit them via the POST form method of a HTML document over the web.
    Here is what I got so far:
    host = new URL("http", "<my_address>", web port, "/query.html");
                InputStream in = host.openStream();
                BufferedInputStream bufIn = new BufferedInputStream(in);
                for (;;)
                    int data = bufIn.read();
                    // Check for end of file
                    if (data == -1)
                        break;
                    else
                        System.out.print ( (char) data);
                }What that code does is makes a URL, opens a stream, and reads the HTML source of the file at the specified URL. There is a form that submits data via the POST method, and I would like to know how to write data to specific forms and specific input types of that form.
    Then, I'd like to be able to read the response I get after submitting the form.
    Is this possible?
    Thanks,

    Here is how one of my e-books go about Posting
    I tryied in one of my projects and it works ok
    (Tricks of the Java Programming Gurus)
    There's another reason you may want to manipulate a URLConnection object directly: You may want to post data to a URL, rather than just fetching a document. Web browsers do this with data from online forms, and your applets might use the same mechanism to return data to the server after giving the user a chance to supply information.
    As of this writing, posting is only supported to HTTP URLs. This interface will likely be enhanced in the future-the HTTP protocol supports two ways of sending data to a URL ("post" and "put"), while FTP, for example, supports only one. Currently, the Java library sidesteps the issue, supporting just one method ("post"). Eventually, some mechanism will be needed to enable applets to exert more control over how URLConnection objects are used for output.
    To prepare a URL for output, you first create the URL object just as you would if you were retrieving a document. Then, after gaining access to the URLConnection object, you indicate that you intend to use the connection for output using the setDoOutput method:
    URL gather = new URL("http://www.foo.com/cgi-bin/gather.cgi");
    URLConnection c = gather.openConnection();
    c.setDoOutput(true); Once you finish the preparation, you can get the output stream for the connection, write your data to it, and you're done:
    DataOutputStream out = new DataOutputStream(c.getOutputStream());
    out.writeBytes("name=Bloggs%2C+Joe+David&favoritecolor=blue");
    out.close();
    //MY COMMENT
    //This part can be improved using the URLEncoder
    //******************************************************You might be wondering why the data in the example looks so ugly. That's a good question, and the answer has to do with the limitation mentioned previously: Using URL objects for output is only supported for the HTTP protocol. To be more accurate, version 1.0 of the Java library really only supports output-mode URL objects for posting forms data using HTTP.
    For mostly historical reasons, HTTP forms data is returned to the server in an encoded format, where spaces are changed to plus signs (+), line delimiters to ampersands (&), and various other "special" characters are changed to three-letter escape sequences. The original data for the previous example, before encoding, was the following:
    name=Bloggs, Joe David
    favoritecolor=blue If you know enough about HTTP that you are curious about the details of what actually gets sent to the HTTP server, here's a transcript of what might be sent to www.foo.com if the example code listed previously were compiled into an application and executed:
    POST /cgi-bin/gather.cgi HTTP/1.0
    User-Agent: Java1.0
    Referer: http://www.foo.com/cgi-bin/gather.cgi
    Accept: text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2
    Content-type: application/x-www-form-urlencoded
    Content-length: 43name=Bloggs%2C+Joe+David&favoritecolor=blue
    Java takes care of building and sending all those protocol headers for you, including the Content-length header, which it calculates automatically. The reason you currently can send only forms data is that the Java library assumes that's all you will want to send. When you use an HTTP URL object for output, the Java library always labels the data you send as encoded form data.
    Once you send the forms data, how do you read the resulting output from the server? The URLConnection class is designed so that you can use an instance for both output and input. It defaults to input-only, and if you turn on output mode without explicitly setting input mode as well, input mode is turned off. If you do both explicitly, however, you can both read and write using a URLConnection:
    c.setDoOutput(true);
    c.setDoInput(true); The only unfortunate thing is that, although URLConnection was designed to make such things possible, version 1.0 of the Java library doesn't support them properly. As of this writing, a bug in the library prevents you from using a single HTTP URLConnection for both input and output.
    //MY COMMENTS
    When you doing URL encoding
    you should not encode it as one string becouse then it will encode the '=' signes and '&' signes also
    you should encode all the field names and values seperatly and then join them using '&'s and '='s
    Ex:-
    public static void addField(StringBuffer sb,String name, String value){
       if (sb.length()>0){
          sb.append("&");
       sb.append(URLEncoder.encode(name,"UTF-8"));
       sb.append("=");
       sb.append(URLEncoder.encode(value,"UTF-8"));
    }

  • HOw to find out the RFC destination from BW system to ISU

    Hi,
    Currently my requirement is to call a function module which is written in ISU (remote enabled) from BW system.
    I am unable to find out the rfc destination from BW to ISU system.
    In CRM we have table like smofparsfa1. Is there any table in BW which can provide me the ISU destination?
    I need to compare the records stored in isu as well as in BW system.
    I need to call a function module which will provide me the data from isu.
    please help me in this regard.
    Krishna

    Hi,
    You can check it in SM59 if there are any RFC destinations for the above systems.
    Alternatively ,check the table RFCDEST if any entries are maintained
    Regards,
    Lakshman.

  • How to use circular linked list in pl/sql?

    Hi all,
    how to use the circular linked list on pl/sql programming.
    thanks in advance
    Rgds,
    B@L@

    d balamurugan wrote:
    Hi,
    I needed this concept for the below example
    TABLE_A have the columns of
    ID COL_1 COL_2 COL_3 COL_4 COL_5 COL_6 COL_7
    1....Y.........N........N.........Y........ N........N........ N
    2....N.........N....... N.........Y.........N........N.........Y
    in the above data
    for id 1 i will need to take the value for COL_4, then i will check the next availability of Y through out through out the remaining columns, so next availability is on COL_1 so, i need to consider COL_4 which already Y and also i need to consider COL_5, COL_6, COL_7 as Y.
    for id 2 if i need COL_7 then i need to come back on circular way and need to check the next availability of Y and need to take the columns having N before the next availability of YAnd... even after all that description... you haven't given any indication of what the output should look like.
    Taking a wild guess on my part... something like this would do what you appear to be asking...
    SQL> ed
    Wrote file afiedt.buf
      1  with t as (select 1 as id, 'Y' as col1, 'N' as col2, 'N' as col3, 'Y' as col4, 'N' as col5, 'N' as col6,'N' as col7 from dual union all
      2             select 2, 'N', 'N', 'N', 'Y', 'N', 'N', 'Y' from dual)
      3  --
      4  -- END OF TEST DATA
      5  --
      6  select id
      7        ,rcol
      8        ,case when instr(cols,'Y',rcol+1) = 0 then instr(cols,'Y')
      9              else instr(cols,'Y',rcol+1)
    10         end as next_Y_col
    11  from   (select id, rcol, col1||col2||col3||col4||col5||col6||col7 as cols
    12          from t, (select &required_col as rcol from dual)
    13          where id = &required_id
    14*        )
    SQL> /
    Enter value for required_col: 4
    old  12:         from t, (select &required_col as rcol from dual)
    new  12:         from t, (select 4 as rcol from dual)
    Enter value for required_id: 1
    old  13:         where id = &required_id
    new  13:         where id = 1
            ID       RCOL NEXT_Y_COL
             1          4          1
    SQL> /
    Enter value for required_col: 7
    old  12:         from t, (select &required_col as rcol from dual)
    new  12:         from t, (select 7 as rcol from dual)
    Enter value for required_id: 2
    old  13:         where id = &required_id
    new  13:         where id = 2
            ID       RCOL NEXT_Y_COL
             2          7          4
    SQL>If that's not what you want... then it's time you started learning how to ask questions properly.

  • How to create database link between oracle and SQL Server

    Hello Everyone,
    Here i have Oracle Database 9i and SQL Server 2005 databases.
    I have some tables in sql server db and i want to access from Oracle.
    How to create a database link between these two servers
    Thanks,

    Thanks for Everyone,
    I was struggle with this almost 10 days....
    I created Database link from Oracle to SQL Server
    Now it is fine.........
    Here i am giving my servers configuration and proceedure how i created the db link...@
    Using Generic Connectivity (HSODBC) we can create db link between Oracle and SQL server.
    Machine (1)
    DB Version : Oracle 9.2.0.7.0
    Operating System : HP-UX Itanuim 64 11.23
    IP : 192.168.0.31
    Host : abcdbt
    Machine (2)
    Version : SQL Server 2005
    Operating System : Windows server 2003 x86
    IP : 192.168.0.175
    Host : SQLDEV1
    User/PW : sa/abc@123! (Connect to database)
    Database : SQLTEST (exsisting)
    Table : T (“ T “ is the table existing in SQLTEST database with 10 rows)
    Prerequisites in Machine (2):
    a)     Oracle 10g software
    b)     User account to access SQL Server database (sa/abc@123!)
    c)     Existing SQL Server Database (SQLTEST)
    d) Tables (testing purpose) (T)
    Steps:
    1)     Install Oracle 10.2.0.1 (Only SW,No need of database) *(Machine 2)*
    2)     Create a DSN where your windows Oracle 10g SW resides *(Machine 2)*
    Control panel >> Administrative Tools >> Data Source (ODBC) >> System DSN ADD
    You can follow this link also.....
    http://www.databasejournal.com/features/oracle/article.php/3442661/Making-a-Connection-from-Oracle-to-SQL-Server.htm
    I created DSN as
    DSN name : SQLTEST
    User : SA/abc@123! (Existing user account)
    Host : 192.168.0.175 (machine 2)
    Already I have 1 database in SQL Server with the name SQLTEST
    You can create DSN with different name also (not same as db name also)
    3)     Create a hsodbc init file in $ORACLE_HOME\hs\admin *(Machine 2)*
    Create init<DSN NAME> file
    Ex: initSQLTEST
    Copy inithsodbc to initSQLTEST
    And edit
    initSQLTEST file
    HS_FDS_CONNECT_INFO = SQLTEST    <DSN NAME>*
    HS_FDS_TRACE_LEVEL = OFF*
    save the file....@
    4)     Configure Listener.ora *(Machine 2)*
    LISTENER_NEW =
    (DESCRIPTION_LIST =
    (DESCRIPTION =
    (ADDRESS_LIST =
    (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.0.175)(PORT = 1525))
    SID_LIST_LISTENER_NEW =
    (SID_LIST =
    (SID_DESC =
    (SID_NAME = SQLTEST) *+< Here SQLTEST is DSN NAME >+*
    (ORACLE_HOME = G:\oracle 10g\oracle\product\10.2.0\db_1)
    (PROGRAM = hsodbc))
    (SID_DESC =
    (SID_NAME = PLSExtProc)
    (ORACLE_HOME = G:\oracle 10g\oracle\product\10.2.0\db_1)
    (PROGRAM = extproc) )
    :> lsnrctl start LISTENER_NEW
    5)     Configure tnsname.ora *(Machine 2)*
    SQLTEST11 =
    (DESCRIPTION =
    (ADDRESS_LIST =
    (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.0.175)(PORT = 1525))
    (CONNECT_DATA =
    (SERVER = DEDICATED)
    (SERVICE_NAME = SQLTEST))
    (HS=OK)
    :> tnsping SQLTEST11
    If No errors then conti….
    6)     Configure a file *(Machine 1)*
    Cd $TNS_ADMIN ($ORACLE_HOME/network/admin)
    Create a file
    $ vi TEST_abcdbt_ifile.ora
    something=
    (DESCRIPTION=
    (ADDRESS=(PROTOCOL=tcp)(HOST =192.168.0.175) (PORT=1525))
    (CONNECT_DATA=
    (SID=SQLTEST))
    (HS=OK)
    $ tnsping something
    $ sqlplus system/manager
    Your connected to Oracle database *(machine 1)*
    create database link xyz connect to “sa” identified by “abc@123!” using ‘SOMETHING’;
    select * from t@xyz;10 rows selected.
    Thanks,
    Edited by: ram5424 on Feb 10, 2010 7:24 PM

  • How to connect to SP2010 content database from SQL Management Studio?

    I would like to migrate the SP 2010 Foundation content to 2013 Foundation.
    Both default installations with no external SQL server.
    When trying to connect from SQL Management Studio Express 2008 I get the error below.
    I'm using windows authentication and my domain admin account.
    tried all the steps  from
    this guide.
    What am I doing wrong here?
    Cannot connect to (local).
    ADDITIONAL INFORMATION:
    A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider:
    TCP Provider, error: 0 - No connection could be made because the target machine actively refused it.) (Microsoft SQL Server, Error: 10061)

    Hi,
    According to your description, my understanding is that you could not connect from SQL Management Studio Express 2008.
    Please try to connect to <MACHINENAME>\SQLEXPRESS or .\SQLEXPRESS instead of (local).
    A similar post for your reference:
    http://nali.org/post/96133108434/sql-server-a-network-related-or-instance-specific-error
    Best Regards,
    Wendy
    Forum Support
    Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Subscriber Support, contact
    [email protected]
    Wendy Li
    TechNet Community Support

Maybe you are looking for

  • Can't Delete Java 2 Runtime Env 1.4.1_03

    EXORCIST NEEDED! I desperately need some help to preserve my sanity. I installed Netscape and Java and immediately started having problems with Netscape locking up my computer. After troubleshooting, I determined that it was Java that was screwing ev

  • Where is the button folder located in Mac?

    I have gone to Computer > Macintosh HD > Applications > Adobe and that is where the Captivate program files appear to be...

  • Creedit check on number of days

    hi, how can i configure credit check on basis of only payment terms(i.e number of days) like if payment terms is 10 days and payment not received from customer next sales order should get blocked automatically. thanks

  • PATCH_FILE_READ_ERROR

    Hello gurus, when I import a queue in TEST mode with transaction SPAM, I get the following error "PATCH_FILE_READ_ERROR". I am logged in the OS with <SID>adm and I logged into SAP with DDIC user. Any ideas what is wrong?

  • Premiere CC Playback Image Uncompressed MOV BMCC

    Hi, I I was using CS6 with and importing quicktime uncompressed RGB video via resolve, no problems on CS6 (with black magic video desktop installed). I installed Premiere CC and the video does this in the  monitors: Not sure why, works perfectly in C