当前位置:网站首页>跨服务器数据访问的创建链接服务器方法
跨服务器数据访问的创建链接服务器方法
2022-07-02 10:59:00 【迪丽热爱】
SQL数据库创建链接服务,不止在SQL数据库,也可以Oracle其他,本文针对于SQL的操作说明
1.对跨服务器进行临时访问,直接用 OPENROWSET的方式
--查询语句范例
--select top 1 *from openrowset('SQLOLEDB','服务名';'账号';'密码',数据库.dbo.表)a
select top 1 *
from openrowset('SQLOLEDB','192.168.1.1';'sa';'111',TEST.dbo.TEST)a
where NO ='1'本查询的时候时候会提示错误“提示:SQL Server 阻止了对组件'Ad Hoc Distributed Queries '的STATEMENT 'OpenRowset/OpenDatasource'”,请参考下一篇博文的针对性说明的解决办法。
2.跨服务器数据访问,创建链接服务器
2.1 语句创建
--跨服务器数据访问
--如果经常访问或数据量大,建议用链接服务器
--创建链接服务器
--创建范例如下
--SQLOLEDB 默认为SQL数据库
--SER_REMOTEERP 为你取得服务名,可以写192.168.1.2 也可以任意取其他
-------------------------------------------------------------------
--创建语句
EXEC sp_addlinkedserver 'SER_REMOTEERP','','SQLOLEDB','192.168.1.2'
--本地用户名,远程服务登入名,远程服务的密码
--一般创建用 null 或SA
EXEC sp_addlinkedsrvlogin 'SER_REMOTEERP','false',null,'sa','密码'
EXEC sp_serveroption 'SER_REMOTEERP','rpc out','true'
--查询语句
select top 1 * from SER_REMOTEERP.数据库名.dbo.表名
--删除链接服务
EXEC sp_dropserver 'SER_REMOTEERP','droplogins'如果创建时候遇到问题:没有从远程服务器‘‘映射到本地用户‘(null)/sa‘的远程用户‘sa‘及服务主密码解密错误”,则参考我的下一篇博文进行解决,连接如下
没有从远程服务器‘‘映射到本地用户‘(null)/sa‘的远程用户‘sa‘及服务主密码解密错误的解决办法_迪丽热爱的博客-CSDN博客
2.2 SQL画面操作

输入远程登入的账号和密码

RFC和RFC OUT 选择TRUE

测试连接进行验证

边栏推荐
- OpenHarmony笔记-----------(四)
- [Hongke technology sharing] how to test DNS server: DNS performance and response time test
- 路由(二)
- 693. Travel sequencing (map + topology)
- The evolution process of the correct implementation principle of redis distributed lock and the summary of redison's actual combat
- Packet capturing tool Fiddler learning
- MySQL45讲——学习极客时间MySQL实战45讲笔记—— 04 | 深入浅出索引(上)
- Dangbei projection 4K laser projection X3 Pro received unanimous praise: 10000 yuan projector preferred
- Data Lake (11): Iceberg table data organization and query
- Design of non main lamp: how to make intelligent lighting more "intelligent"?
猜你喜欢

HMS core machine learning service helps zaful users to shop conveniently

Do you know that there is an upper limit on the size of Oracle data files?
![[deep learning] simple implementation of neural network forward propagation](/img/a6/9b4896c62e9b77f9d528c3c9efc58f.jpg)
[deep learning] simple implementation of neural network forward propagation

<口算练习机 方案开发原理图>口算练习机/口算宝/儿童数学宝/儿童计算器 LCD液晶显示驱动IC-VK1621B,提供技术支持

Dangbei projection 4K laser projection X3 Pro received unanimous praise: 10000 yuan projector preferred

每日学习3

Pycharm连接远程服务器

瀏覽器驅動的下載

腾讯云 TStor 统一存储通过信通院首批文件存储基础能力评测

全屋Wi-Fi:一个谁也解决不好的痛点?
随机推荐
[template] longest common subsequence ([DP or greedy] board)
P1042 [NOIP2003 普及组] 乒乓球
c# 水晶报表打印
C crystal report printing
Origin plots thermogravimetric TG and differential thermogravimetric DTG curves
浏览器驱动的下载
关于Flink框架窗口(window)函数最全解析
万物生长大会在杭召开,当贝入选2022中国未来独角兽TOP100榜单
你的 Sleep 服务会梦到服务网格外的 bookinfo 吗
P1347 sorting (topology + SPFA judgment ring or topology [inner judgment ring])
YOLOv3&YOLOv5输出结果说明
[development environment] 010 editor tool (tool download | binary file analysis template template installation | shortcut key viewing and setting)
Use of swagger
How to set QT manual layout
freemarker的使用
Some interview suggestions for Android programmers "suggestions collection"
Custom events, global event bus, message subscription and publishing, $nexttick
Browser driven Download
Golang quickly generates model and queryset of database tables
Launcher startup process