Exec sp_droplinkedsrvlogin DBVIP,Null       --删除映射(录与链接服务器上远程登录之间的映射)

Exec sp_dropserver DBVIP                         --删除远程服务器链接

EXEC  sp_addlinkedserver

      @server='DBVIP',--被访问的服务器别名 
      @srvproduct='',
      @provider='SQLOLEDB',
      @datasrc="/Server2"   --要访问的服务器

EXEC sp_addlinkedsrvlogin
     'DBVIP', --被访问的服务器别名
     'false',
     NULL,
     'sa', --帐号
     'thankyoubobby' --密码

Select   *   from DBVIP.pubs.dbo.orders   
/ORACLE
Exec sp_droplinkedsrvlogin demo,Null
Exec sp_dropserver demo
go

EXEC sp_addlinkedserver

        @server ='demo',
        @srvproduct='Oracle',
  @provider='MSDAORA',
  @datasrc="/ServiceName" 
  

EXEC sp_addlinkedsrvlogin

     'demo',
     'false',
     NULL,
     'userid',
     'password'
go

SELECT * FROM OPENQUERY(demo ,'select * from tbdemo' )

UPDATE OPENQUERY (demo, 'SELECT id FROM tbdemo WHERE id = 101')

SET name = 'hello';

INSERT OPENQUERY (demo, 'SELECT id FROM tbdemo')

S ('hello');

DELETE OPENQUERY (demo, 'SELECT id FROM tbdemo WHERE name = ''hello''');