Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Creating a Linked Server and Database Alias

I have two servers Server1 and Server2

On both servers i have a Database called QAI

is there a way that i can create a linked server with an alias from Server2 to Server1 but instead of Server1.QAI.dbo.tbBlah

Have it aliased as QAI.dbo.tbBlah

This is needed due to the QAI DB on server2 failing and needing to fall back to the Server1 instance while it is fixed

Thanks

like image 990
telsokari Avatar asked Jul 24 '12 09:07

telsokari


1 Answers

This works. Tested on a 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.

like image 89
Julle Avatar answered Oct 06 '22 01:10

Julle