sql - 创建链接服务器和数据库别名

标签 sql sql-server linked-server

我有两台服务器 Server1 和 Server2

在两台服务器上我都有一个名为 QAI 的数据库

有没有一种方法可以让我创建一个别名为 Server2 到 Server1 的链接服务器,而不是 Server1.QAI.dbo.tbBlah

将其别名为 QAI.dbo.tbBlah

这是必需的,因为 server2 上的 QAI DB 发生故障,需要在修复时回退到 Server1 实例

谢谢

最佳答案

这有效。在 SQL2012 上测试

http://alexpinsker.blogspot.se/2007/08/how-to-give-alias-to-sql-linked-server.html

There are no problems to add SQL linked server to the specific host running it. But what if you need to give it an alias, rather than use hostname as linked server name? Here is how to do it:

1) Step 1:
• In SQL Server Management Studio open Linked Servers and then 'New Linked Server'.
• Inside of appeared wizard – Select the General tab.
• Specify alias name in "Linked server" field.
• Select SQL Native Client as provider.
• Add sql_server in "Product Name" field (that's the magic).
• In "Data Source" – specify name of the host to be used as linked server.

2) Step 2:
• In Security tab – specify proper security options (e.g. security context)

3) Step 3:
• In Server Options tab – put "Data Access", RPC, "Rpc Out" and "Use Remote Collaboration" to be true.

4) Step 4:
• Enjoy.

关于sql - 创建链接服务器和数据库别名,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11628061/

相关文章:

MySQL 查询返回意外结果

sql - 如何将一个表的每条记录中的数据复制到与第一个表相关的另一个表的多个记录中?

sql - SSIS 性能与带有从 SQL Server 到 Oracle 的链接服务器的 OpenQuery 的比较

sql - 如何从 sql 语句或存储过程连接到外部数据库?

sql - 关系代数中 "theta join"的清晰解释?

java - 编译apache james server 2.3.1时无法使用HashMap

SQL : Split one row into two rows depending on column

SQL Server DELETE 使用索引时速度较慢

sql-server - 唯一标识符(guid)作为数据库设计中的主键

sql-server - Azure SQL 表 -> SQL Server View -> 链接 Access 表 : can't update