You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

SSMS中无法打开Azure托管实例数据库GCDCalculation的属性选项卡

问题描述

我正在使用Azure托管实例执行迁移任务,该实例中的多个数据库均运行正常。但尝试打开名为GCDCalculation的数据库的属性选项卡时,出现错误。

打开数据库属性时的错误截图

完整错误信息
Cannot show requested dialog.

===================================

Cannot show requested dialog. (SqlMgmt)

------------------------------
Program Location:

   at Microsoft.SqlServer.Management.SqlMgmt.DefaultLaunchFormHostedControlAllocator.AllocateDialog(XmlDocument initializationXml, IServiceProvider dialogServiceProvider, CDataContainer dc)
   at Microsoft.SqlServer.Management.SqlMgmt.DefaultLaunchFormHostedControlAllocator.Microsoft.SqlServer.Management.SqlMgmt.ILaunchFormHostedControlAllocator.CreateDialog(XmlDocument initializationXml, IServiceProvider dialogServiceProvider)
   at Microsoft.SqlServer.Management.SqlMgmt.LaunchForm.InitializeForm(XmlDocument doc, IServiceProvider provider, ISqlControlCollection control)
   at Microsoft.SqlServer.Management.SqlMgmt.LaunchForm..ctor(XmlDocument doc, IServiceProvider provider)
   at Microsoft.SqlServer.Management.UI.VSIntegration.ObjectExplorer.ToolMenuItemHelper.OnCreateAndShowForm(IServiceProvider sp, XmlDocument doc)
   at Microsoft.SqlServer.Management.SqlMgmt.RunningFormsTable.RunningFormsTableImpl.ThreadStarter.StartThread()

===================================

Subquery returned more than 1 value. This is not permitted when the subquery follows =, !=, <, <= , >, >= or when the subquery is used as an expression. (.Net SqlClient Data Provider)

------------------------------
Server Name: my-project-database.database.windows.net, 3342
Error Number: 512
Severity: 16
State: 1
Line Number: 7


------------------------------
Program Location:

   at Microsoft.SqlServer.Management.SqlManagerUI.DBPropGeneralData.InitProp()
   at Microsoft.SqlServer.Management.SqlManagerUI.DBPropGeneralData..ctor(CDataContainer context)
   at Microsoft.SqlServer.Management.SqlManagerUI.DBPropGeneral..ctor(CDataContainer dataContainer, DatabasePrototype prototype)
   at Microsoft.SqlServer.Management.SqlManagerUI.DBPropSheet.Init(CDataContainer dataContainer)
   at Microsoft.SqlServer.Management.SqlManagerUI.DBPropSheet..ctor(CDataContainer context)
错误原因与排查方向

核心错误是SQL Server错误512:子查询返回多个值,但在需要单一值的场景中使用(如跟在=、!=等比较运算符后)。该错误触发于SSMS加载数据库属性的DBPropGeneralData.InitProp()方法执行过程中,说明获取数据库元数据的后台查询出了问题。

针对GCDCalculation数据库,可能的原因及排查步骤:

  • 元数据异常:执行以下查询检查系统视图是否存在重复记录或异常:
    -- 检查数据库基本状态
    SELECT name, database_id, state_desc, recovery_model_desc FROM sys.databases WHERE name = 'GCDCalculation';
    
    -- 检查数据库级触发器
    SELECT * FROM sys.triggers WHERE parent_class_desc = 'DATABASE';
    
    -- 检查数据库文件信息是否重复
    SELECT * FROM sys.master_files WHERE database_id = DB_ID('GCDCalculation');
    
  • 迁移遗留问题:验证迁移过程中是否修改过该数据库的系统对象,或迁移工具是否引入元数据不一致。
  • 替代操作验证:用T-SQL直接查询数据库属性,避开SSMS界面:
    EXEC sp_helpdb 'GCDCalculation';
    
SSMS打开数据库属性的后台查询说明

当你在SSMS中打开数据库属性选项卡时,后台会自动触发一系列针对系统视图和存储过程的查询,用来获取各类元数据:

  • 基本信息:查询sys.databases、sys.master_files、sys.database_files获取名称、状态、文件配置、恢复模式等
  • 权限配置:查询sys.database_permissions、sys.database_principals获取权限和主体信息
  • 数据库选项:调用sp_dboption或读取sys.databases的配置列
  • 扩展属性:查询sys.extended_properties获取自定义属性

如果需要查看具体执行的语句,可以通过SQL Server Profiler或Extended Events捕获:

  1. 连接Azure托管实例,启动Profiler并选择TSQL_SPs模板,或自定义捕获SQL:BatchCompleted和RPC:Completed事件
  2. 在SSMS中打开数据库属性选项卡,Profiler会记录所有后台执行的查询语句

内容的提问来源于stack exchange,提问作者Robin

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.25 00:54:33