We are using a SQL Native Client to connect to a local SQL Server 2005 from a Borland application. It will fine for selects, inserts, and updates. When we delete we get the error:
Could not find server
SERVERNAME\SQLEXPRESS in
sys.servers. Verify that the correct
server name was specified. If
necessary, execute the stored
procedure sp_addlinkedserver to add
the server to sys.servers
The default instance, the only instance, is SERVERNAME\SQLEXPRESS, and we are not using linked servers. Any ideas? I believe we moved the MDF and LDF files to a new server for this DB, and then reattached it.
Update 1
There is no SQL. This is all happening through programmatic interaction with cursors. It is an ODBC driver using ADO. You run TableObj->Delete to remove the record.
Got it. I ran
SELECT ##servername
That returned the old host name of the box. I than ran
sp_dropserver 'OLDHOSTNAME\SQLEXPRESS'
go
sp_addserver 'NEWHOSTNAME\SQLEXPRESS', local
I then got
Server 'NEWHOSTNAME\SQLEXPRESS' is not
configured for DATA ACCESS
I ran
sp_serveroption 'ICS-POS3-NEW\SQLEXPRESS', 'data access' , 'true'
This got me the error
Transaction context in use by another
session
Which is because of linked servers. I found that the local option on the add server did not take affect until I restarted the server. I restarted, then it just worked.
Related
We're having trouble with running SQL 'exec' but if we run 'select' we don't have a problem.
We had Win 2012 Servers with SQL Server 2014 -
We are upgrading WinOS and SQL version, so now have identical servers with Win2019 + SQL 2017 Server v14.0.3436.1
We restored the databases from the old servers to the new servers
We have a linked server setup, and we can run the following 'select' command against the remote server and it works fine and returns results.
i.e.:
select * from CSDB23.systemlive.dbo.dt_currency
However when we run the 'exec' command:
exec csdb23.systemlive.dbo.p_transfer 3,'SystemProd1'
we get the following issue:
Msg 7202, Level 11, State 2, Procedure systemlive.dbo.p_transfer, Line 31 [Batch Start Line 0]
Could not find server 'CSDb23' in sys.servers. Verify that the correct server name was specified."
We see support issues suggested we drop and add the server using commands from SQL Server 2016 (but the commands given are depreciated from SQL 2016 so not relevant in 2017
sp_dropserver 'Server_A'
GO
sp_addserver 'Server',local
GO
but the linkserver is already setup:
[
A bit lost on how or what I need to check so we don't get this issue?
Thank you
We found the issue to be with the Server Name.
When the server was created in Azure, it was created with a Market Place image with SQL already a part of the image.
The server was named (just an example) "Sever-DB10". Once the servers were deployed, the name of the sever was changed to "MainDB10" - However, the SQL instance was still seeing the server as "Server-DB10" when we looked up the names of the SQL instances using:
select name from sys.syservers
We see the server was referencing the old name of the server and not the new name. We manually dropped the name and readded it back via the linked server with the correct name. - we no longer then had the main issue "Cannot find server X)
(We hada raft of other Access issues after this and eventually reinstalled SQL which seemed to completely resolve all issues we had.)
I have cloned our Microsoft SQL to a new server. The server contains a few databases and "SQL Server Agent" jobs that run on a scheduled basis. I have tried changing all existing references to this new server name and use accounts on this new server. However I am still getting the following error in my error log and my jobs fails to run (btw, this is through Microsoft SQL Management Studio),
[298] SQLServer Error: 15404, Could not obtain information about Windows NT group/user 'DOMAIN\user_account', error code 0x534. [SQLSTATE 42000] (ConnIsLoginSysAdmin)
I've got a couple of Maintenance Plans which are pointing to the old server. For some unknown reason I can't edit the existing connection and I can't delete it. I can add a new one but the other connection can not be removed.
I need to know where I need to change for this error to go away and the jobs start running.
This may be because SQL has the wrong server name in Master. Here is another article on the subject.
SQL Server Central Article
In order to fix this, run a search on Master with the following code:
use master
select SERVERPROPERTY('servername')
select ##SERVERNAME
select SERVERPROPERTY('machinename')
go
If you see the old server name in the list you will have to drop the server and add the new one
use master
exec sp_dropserver "OldServerNmae"
go
use master
exec sp_addserver "NewServerName","local"
go
I am facing server name problem in SQL Server 2012. When I click on configure distribution I get an error:
Unable to connect to server. Specify the actual server name.
I changed my server name and restarted the services but unable to connect through new server name.
Basically, I am doing this on local domain based server.
Kindly suggest a suitable solutions.
After you rename a SQL Server machine, you will also need to rename the SQL Server instance itself using:
sp_dropserver <old_name>;
GO
sp_addserver <new_name>, local;
GO
For more information, see Microsoft's article called Rename a Computer that Hosts a Stand-Alone Instance of SQL Server.
I think what your probably finding is that changing the Windows server hostname doesn't actually change the original SQL Server instance name which still gets used for certain services. Run the following on the DB engine:
SELECT ##SERVERNAME
You'll probably find a different value to what your expecting from the OS.
There isn't really a solution to this that I'm aware of without re-installing SQL Server on the newly named box.
Also be careful with names that exceed to the 15 character NetBIOS limit.
I have two SQL Servers which have been linked using sp_addlinkedserver 'ServerB\Instance' from ServerA and sp_addlinkedserver 'ServerA\Instance' from ServerB.
If I execute the following query from ServerA then everything is okay:
SELECT *
FROM [ServerB\Instance].Database.dbo.Table
If I execute the following query from ServerB an error occurs:
SELECT *
FROM [ServerA\Instance].Database.dbo.Table
Error:
Msg 18456, Level 14, State 1, Line 1
Login failed for user 'NT
AUTHORITY\ANONYMOUS LOGON'.
The service accounts that SQL Server runs under on ServerA and ServerB have been given elevated permissions on both servers in an attempt to solve the issue but no success.
I have done research but want to avoid a convoluted process when communication one way is okay.
I have solved this by following the process:
Deleted both linked servers.
Executed sp_addlinkedserver for ServerA from ServerA RDP (SSMS) and for ServerB from ServerB RDP (SSMS).
Previously I had executed sp_addlinkedserver for both servers from the one server RDP (SSMS) session only. Executing from each server has solved the problem. If someone can add comments as to why this is then I will be very grateful.
In SQL Management Studio, view the properties for the linked server from Server B to Server A. There's a security "tab" that you can view from there. That will tell you the security context the connection from B to A is using. The error you are getting normally occurs when you don't have a valid security context set for the linked server.
The reason that it can work from A to B and not B to A is that you need to set up the linked server correctly on each side. Just doing it for one is not going to work to go both ways.
You have to map your local user to a remote user on the other server.
Do can do this by calling sp_addremotelogin() as explained here: http://msdn.microsoft.com/en-us/library/ms186338.aspx
To work around this problem, use one of the following methods:
Map the clients on server A to a standard security login on server B, by using either the sp_addlinkedsrvlogin stored procedure or the Security tab of the Linked Server Properties dialog box in Enterprise Manager.
If you are running the distributed query on an instance of SQL Server that is running on a Microsoft Windows 2000-based computer, configure SQL Server to listen for client requests by using the Named Pipes Server network library, instead of using the TCP/IP Server network library or the Multiprotocol Server network library. To configure the Server network libraries for SQL Server, use the Server Network Utility.
Take a look at:
http://support.microsoft.com/kb/238477
After I renamed my PC, I couldn't create new paublications, for database replication in SQL Server 2005.
I receive un error "SQL Server replication requires the actual server name to make connection to the server."
When I returned my old PC name, the problem solved. How could I make use of replication after renaming the PC?
The SQL Service itself still thinks it has the old server name, and since it has the habit of referring to itself in the third person, this causes problems when the underlying server name has changed. You need to take the following steps to correct it:
Run "Select ##ServerName" to verify the servername - it should be the old name.
sp_dropserver ‘OLDSERVERNAME’
sp_addserver ‘NEWSERVERNAME’, local
Restart both the SQL Service and the Agent Service
Run step 1 again to confirm that the server name is now correct