Hi Guys !
While running a test server on my local machine i got a problem with LINKED SERVERS
This is the SQL Error !
===================================
The test connection to the linked server failed.
===================================
An exception occurred while executing a Transact-SQL statement or batch. (Microsoft.SqlServer.ConnectionInfo)
------------------------------
Program Location:
at Microsoft.SqlServer.Management.Common.ServerConnec tion.ExecuteNonQuery(String sqlCommand, ExecutionTypes executionType)
at Microsoft.SqlServer.Management.Smo.ExecutionManage r.ExecuteNonQuery(String cmd)
at Microsoft.SqlServer.Management.Smo.LinkedServer.Te stConnection()
at Microsoft.SqlServer.Management.UI.VSIntegration.Ob jectExplorer.LinkedServerConnectionTest.Invoke()
===================================
VIA Provider: The specified module could not be found.
OLE DB provider "SQLNCLI10" for linked server "game" returned message "Login timeout expired".
OLE DB provider "SQLNCLI10" for linked server "game" returned message "A network-related or instance-specific error has occurred while establishing a connection to SQL Server. Server is not found or not accessible. Check if instance name is correct and if SQL Server is configured to allow remote connections. For more information see SQL Server Books Online.". (.Net SqlClient Data Provider)
------------------------------
For help, click:
------------------------------
Server Name: DESKTOP-7LMO514\SQLEXPRESS
Error Number: 126
Severity: 16
State: 1
------------------------------
Program Location:
at Microsoft.SqlServer.Management.Common.ConnectionMa nager.ExecuteTSql(ExecuteTSqlAction action, Object execObject, DataSet fillDataSet, Boolean catchException)
at Microsoft.SqlServer.Management.Common.ServerConnec tion.ExecuteNonQuery(String sqlCommand, ExecutionTypes executionType)
The test connection to the linked server failed.
===================================
An exception occurred while executing a Transact-SQL statement or batch. (Microsoft.SqlServer.ConnectionInfo)
------------------------------
Program Location:
at Microsoft.SqlServer.Management.Common.ServerConnec tion.ExecuteNonQuery(String sqlCommand, ExecutionTypes executionType)
at Microsoft.SqlServer.Management.Smo.ExecutionManage r.ExecuteNonQuery(String cmd)
at Microsoft.SqlServer.Management.Smo.LinkedServer.Te stConnection()
at Microsoft.SqlServer.Management.UI.VSIntegration.Ob jectExplorer.LinkedServerConnectionTest.Invoke()
===================================
VIA Provider: The specified module could not be found.
OLE DB provider "SQLNCLI10" for linked server "game" returned message "Login timeout expired".
OLE DB provider "SQLNCLI10" for linked server "game" returned message "A network-related or instance-specific error has occurred while establishing a connection to SQL Server. Server is not found or not accessible. Check if instance name is correct and if SQL Server is configured to allow remote connections. For more information see SQL Server Books Online.". (.Net SqlClient Data Provider)
------------------------------
For help, click:

------------------------------
Server Name: DESKTOP-7LMO514\SQLEXPRESS
Error Number: 126
Severity: 16
State: 1
------------------------------
Program Location:
at Microsoft.SqlServer.Management.Common.ConnectionMa nager.ExecuteTSql(ExecuteTSqlAction action, Object execObject, DataSet fillDataSet, Boolean catchException)
at Microsoft.SqlServer.Management.Common.ServerConnec tion.ExecuteNonQuery(String sqlCommand, ExecutionTypes executionType)
If i try to config .ini files and run server session doesn't start and logs says " userlog failed connection "
I've used this query to create login and link server
/* Add server link, and Shaiya username */
IF NOT EXISTS (SELECT [name] FROM master.dbo.syslogins WHERE name = 'Shaiya')
BEGIN
EXEC sp_addlogin 'geforce1', 'geforce1', 'PS_GameDefs';
END
EXEC sp_addsrvrolemember 'geforce1', 'sysadmin';
TRUNCATE TABLE PS_UserData.dbo.Users_Master;
TRUNCATE TABLE OMG_GameWEB.dbo.GameAccountTBL;
TRUNCATE TABLE PS_UserData.dbo.Users_Detail;
if exists(select *
from master..sysservers
where isremote=1 and srvname='game')
begin
exec sp_dropserver 'game','droplogins'
end
exec sp_addlinkedserver 'game','','SQLOLEDB','127.0.0.1'
exec sp_addlinkedsrvlogin 'game','false',null,'geforce1','nividia1'
if exists(select *
from master..sysservers
where isremote=1 and srvname='PS_NCASH')
begin
exec sp_dropserver 'PS_NCASH','droplogins'
end
exec sp_addlinkedserver 'PS_NCASH','','SQLOLEDB','127.0.0.1'
exec sp_addlinkedsrvlogin 'PS_NCASH','false',null,'geforce1','nividia1'
if exists(select *
from master..sysservers
where isremote=1 and srvname='PS_USERDB')
begin
exec sp_dropserver 'PS_USERDB','droplogins'
end
exec sp_addlinkedserver 'PS_USERDB','','SQLOLEDB','127.0.0.1'
exec sp_addlinkedsrvlogin 'PS_USERDB','false',null,'geforce1','nividia1'
if exists(select *
from master..sysservers
where isremote=1 and srvname='PS_USERDB01')
begin
exec sp_dropserver 'PS_USERDB01','droplogins'
end
exec sp_addlinkedserver 'PS_USERDB01','','SQLOLEDB','127.0.0.1'
exec sp_addlinkedsrvlogin 'PS_USERDB01','false',null,'geforce1','nividia1'
if exists(select *
from master..sysservers
where isremote=1 and srvname='PS_DEFINEDB')
begin
exec sp_dropserver 'PS_DEFINEDB','droplogins'
end
exec sp_addlinkedserver 'PS_DEFINEDB','','SQLOLEDB','127.0.0.1'
exec sp_addlinkedsrvlogin 'PS_DEFINEDB','false',null,'geforce1','nividia1'
if exists(select *
from master..sysservers
where isremote=1 and srvname='PS_GAMEDB01')
begin
exec sp_dropserver 'PS_GAMEDB01','droplogins'
end
exec sp_addlinkedserver 'PS_GAMEDB01','','SQLOLEDB','127.0.0.1'
exec sp_addlinkedsrvlogin 'PS_GAMEDB01','false',null,'geforce1','nividia1'
IF NOT EXISTS (SELECT [name] FROM master.dbo.syslogins WHERE name = 'Shaiya')
BEGIN
EXEC sp_addlogin 'geforce1', 'geforce1', 'PS_GameDefs';
END
EXEC sp_addsrvrolemember 'geforce1', 'sysadmin';
TRUNCATE TABLE PS_UserData.dbo.Users_Master;
TRUNCATE TABLE OMG_GameWEB.dbo.GameAccountTBL;
TRUNCATE TABLE PS_UserData.dbo.Users_Detail;
if exists(select *
from master..sysservers
where isremote=1 and srvname='game')
begin
exec sp_dropserver 'game','droplogins'
end
exec sp_addlinkedserver 'game','','SQLOLEDB','127.0.0.1'
exec sp_addlinkedsrvlogin 'game','false',null,'geforce1','nividia1'
if exists(select *
from master..sysservers
where isremote=1 and srvname='PS_NCASH')
begin
exec sp_dropserver 'PS_NCASH','droplogins'
end
exec sp_addlinkedserver 'PS_NCASH','','SQLOLEDB','127.0.0.1'
exec sp_addlinkedsrvlogin 'PS_NCASH','false',null,'geforce1','nividia1'
if exists(select *
from master..sysservers
where isremote=1 and srvname='PS_USERDB')
begin
exec sp_dropserver 'PS_USERDB','droplogins'
end
exec sp_addlinkedserver 'PS_USERDB','','SQLOLEDB','127.0.0.1'
exec sp_addlinkedsrvlogin 'PS_USERDB','false',null,'geforce1','nividia1'
if exists(select *
from master..sysservers
where isremote=1 and srvname='PS_USERDB01')
begin
exec sp_dropserver 'PS_USERDB01','droplogins'
end
exec sp_addlinkedserver 'PS_USERDB01','','SQLOLEDB','127.0.0.1'
exec sp_addlinkedsrvlogin 'PS_USERDB01','false',null,'geforce1','nividia1'
if exists(select *
from master..sysservers
where isremote=1 and srvname='PS_DEFINEDB')
begin
exec sp_dropserver 'PS_DEFINEDB','droplogins'
end
exec sp_addlinkedserver 'PS_DEFINEDB','','SQLOLEDB','127.0.0.1'
exec sp_addlinkedsrvlogin 'PS_DEFINEDB','false',null,'geforce1','nividia1'
if exists(select *
from master..sysservers
where isremote=1 and srvname='PS_GAMEDB01')
begin
exec sp_dropserver 'PS_GAMEDB01','droplogins'
end
exec sp_addlinkedserver 'PS_GAMEDB01','','SQLOLEDB','127.0.0.1'
exec sp_addlinkedsrvlogin 'PS_GAMEDB01','false',null,'geforce1','nividia1'






