7202: Could not find server 'name' in sys.servers(在 sys.servers 中找不到服务器 'name')
SQL Server含义
查询中通过链接服务器或四部分名称(server.database.schema.object)引用的服务器名不在已配置的链接服务器中。SQL Server 无法解析该名称。
原因
链接服务器从未定义;名称拼写错误;在其他环境(dev/prod)中存在的链接服务器在生产环境中缺失;或 OPENQUERY/四部分名称指向了错误的服务器名。在服务器之间迁移脚本时很常见。
解决方法
列出已定义的链接服务器:SELECT name FROM sys.servers; 或 EXEC sp_linkedservers。如有需要则添加:EXEC sp_addlinkedserver @server='SERVER', ...; 并用 sp_addlinkedsrvlogin 设置登录映射。确认查询中的四部分名称使用了正确的链接服务器名;如果只访问本地对象,去掉服务器前缀。
同一数据库的其他条目
- 18452Login failed. The login is from an untrusted domain and cannot be used with Windows authentication(登录失败。该登录名来自不受信任的域,不能用于 Windows 身份验证)
- 605Attempt to fetch logical page belongs to a different allocation unit(尝试获取的逻辑页属于另一个分配单元)
- 4922ALTER TABLE ALTER COLUMN failed because one or more objects access this column(ALTER TABLE ALTER COLUMN 失败,因为有一个或多个对象访问此列)
- 40501The service is currently busy. Retry the request after 10 seconds(服务当前繁忙。请在 10 秒后重试请求)
- 8645A time out occurred while waiting for memory resources to execute the query(等待执行查询所需的内存资源时超时)
- 8651Could not perform the operation because the requested memory grant was not available(无法执行操作,因为请求的内存授予不可用)
- 5061ALTER DATABASE failed because a lock could not be placed on database(ALTER DATABASE 失败,因为无法在数据库上加锁)