SQL SERVER creates a remote database link

Source: Internet
Author: User
Tags ole

/*mssql--Create remote link exec sp_addlinkedserver@server= ' pacs_link ',--the server alias being accessed @srvproduct= ',--sqls Erver default does not need to write, or oracle@provider= ' SQLOLEDB ',--different libraries are not the same, the OLE db character @datasrc= ' 59.110.5.215,51800 '--the server to be accessed goexec sp_ Addlinkedsrvlogin @rmtsrvname = ' Pacs_link ',--the server alias being accessed @useself= ' false ',--fixed so write @locallogin= ' sa ',--local operation account name @rmtuser = ' Testpass ',--the server user name @rmtpassword= ' [email protected] '--the server accessed with password go----//delete connection server--exec sp_dropserver "Pacs_ LINK "--select * from Pacs_link. [Newnanningsystemdb]. [dbo]. [V_devicelist]*//*mysql--Establish database link server exec sp_addlinkedserver@server =n ' Lis_link ',--the linked server alias to be created @srvproduct=n ' M Ysql ',--product name @provider=n ' Msdasql ',--ole DB drive name (fixed) @datasrc =n ' MySQL '--data source (requires modification, format IP: Port/service_name) goexec sp_ Addlinkedsrvlogin@rmtsrvname= ' Lis_link ',--Established link server name @useself= ' false ',--fixed * @locallogin = NULL,--For each login SQL Server users use this linked server, write user name * fixed @rmtuser= ' root ',--account (need to modify) @rmtpassword = ' inteall '--password (need to modify) GO----//Delete connection server--EXEC sp_ Dropserver "Lis_link"--select * from OPENQUERY ([Lis_link], ' select * from Lisinterface.temp ')*//*oracle--establishing a database link server exec sp_addlinkedserver@server =n ' His_link ',--the linked server alias to be created @srvproduct=n ' ORACLE ',--product name (fixed) @provider =n ' oraoledb.oracle ',--ole DB driver name (fixed) @datasrc =n ' ORCL1 '--data source (requires modification, format IP: Port/service_name ) goexec sp_addlinkedsrvlogin ' His_link ',--Established link server name ' false ',--fixed * NULL,--write username * PIN for each user logging in to SQL Server  Hisdata ',--account (Oracle) (requires modification) ' inteall2012 '--Password (Oracle) (need to be modified) GO----//Delete connection server--EXEC sp_dropserver "His_link"--Select * FROM OPENQUERY ([His_link], ' select * from V_intefacecosedetail ')--select * from OPENQUERY (his_link, ' select * from Temp ')*/

SQL SERVER creates a remote database link

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.