I made a full database backup. I wanted to restore this database in another distant machine.
However, database restoration failed with:
Msg 7202, Level 11, State 2, Server MySERVER\SQLEXPRESS, Procedure _SBOF_FOO1, Line 17
Could not find server 'svr1' 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.
Aparently, there is a store procedure that has a reference to a server 'svr1' which cannot find. How to work around this error?
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 am using SQL Server 2014 and I need to access the database using a VPN. I have no issue logging on the SQL Server using my VPN but I can't expand the database or query it.
When I click the database to expand it, I get the following message:
The database XXXX is not accessible. (ObjectExplorer)
------------------------------
Program Location:
at Microsoft.SqlServer.Management.UI.VSIntegration.ObjectExplorer.DatabaseNavigableItem.get_CanGetChildren()
at Microsoft.SqlServer.Management.UI.VSIntegration.ObjectExplorer.NavigableItem.RequestChildren(IGetChildrenRequest request)
at Microsoft.SqlServer.Management.UI.VSIntegration.ObjectExplorer.ExplorerHierarchyNode.BuildChildren(WaitHandle quitEvent)
If I query a table from the database, I get the following message:
Msg 916, Level 14, State 1, Line 2
The server principal "Bi" is not able to access the database "HMS_ARL" under the current security context.
Any kind of help would be much appreciated.
I've read up on how to do a cross-server query:
serverName.DBName.SchemaName.TableName
I do just this and I get an error telling me that the server is not found on sys.servers. I queried sys.servers but I just see my own server's name and nothing else.
--Am I missing something? The error message also gives me a stored procedure's name. But I am just not sure why this is not working, shouldn't it be working just fine?? I do have credentials/permissions on BOTH servers to read and write. So I don't think it's a permission thing.
Error message:
Could not find server 'targetServerName' 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.
You need to create a link to the other servers. You can do this with the sp_addlinkedserver stored procedure or via the Sql Server Management Studio gui.
I'm trying to set up transactional replication in SQL Server 2012 using AdventureWorks 2012. And right at the end of the publications setup i get the following error:
SQL Server could not start the Snapshot Agent.
Additional Information:
An exception occurred while executing a Transact-SQL statement or batch.
(Microsoft.SqlServer.ConnectionInfo)
SQL ServerAgent is not currently running so it cannot be modified of this action.
Changed database context to 'AdventureWorks2012'.(Microsoft SQL Server,Error 22022)
I'm guessing this error isn't allowing me to execute the following code:
USE ADRepl;
SELECT * FROM Person.BusinessEntity
As every time I do execute this I get the following error:
Msg 208, Level 16, State 1, Line 2
Invalid object name 'Person.BusinessEntity'.
Make your sql agent property as automatic.
Set the SQL server agent service Automatically.
Press windows key+R
type services.msc
right Click on sql server agent
properties >> startup >> select automatically.
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.