您好,欢迎来到三六零分类信息网!老站,搜索引擎当天收录,欢迎发信息
免费发信息
三六零分类信息网 > 晋城分类信息网,免费分类信息发布

sqlserver2008连接oracle11g

2024/4/21 17:31:01发布28次查看
use sp_add link ed server procedure to create the link ed server , specifying msdaora as provider_name , and the sql *net alias name for the oracle database instance as data_ source . sp_add link ed server @ server = 'orasrv' , @ srvproduc  
use sp_addlinkedserver procedure to create thelinkedserver, specifyingmsdaora as provider_name, and thesql*net alias name for theoracle database instance as data_ source.
   sp_addlinkedserver @server = 'orasrv', @srvproduct = 'oracle', @provider = 'msdaora', @datasrc = 'orcl'
@server specifies the server name that will be used in the sqlstatements.
@datasrc is an alias from tnsnames.ora file (%oracle_nome%\network\admin):
    orcl =     (description =       (address_list =         (address = (protocol = tcp)(host = dbsrv)(port = 1521))       )       (connect_data =         (service_name = orcl.domain.com) ) )
then use sp_addlinkedsrvlogin to create a login tooracle:
   sp_addlinkedsrvlogin @rmtsrvname = 'orasrv', @useself = 'false', @locallogin = null,        @rmtuser = 'scott', @rmtpassword ='tiger'
after you have created the linked server and login, you can query an oracle table fromsqlserver:
   select * from orasrv..scott.dept
note. if the table and column names were created in oracle without quoted identifiers, use them in uppercase. otherwise you will receive “the table either does not exist or the current user does not have permissions on that table” error.
晋城分类信息网,免费分类信息发布

VIP推荐

免费发布信息,免费发布B2B信息网站平台 - 三六零分类信息网 沪ICP备09012988号-2
企业名录