SQL Server阻止访问组件’Ole Automation Procedures’的过程’sys.sp_OACreate’

SQL Server阻止访问组件“Ole Automation Procedures”的过程sys.sp_OACreate ,因为此组件已作为此服务器的安全配置的一部分关闭。 系统管理员可以使用sp_configure启用“Ole Automation Procedures”。 有关启用“Ole Automation Procedures”的详细信息,请参阅SQL Server联机丛书中的“Surface Area Configuration”。

我试图启用Ole Automation Procedures:

 sp_configure 'show advanced options', 1 GO RECONFIGURE; GO sp_configure 'Ole Automation Procedures', 1 GO RECONFIGURE; GO sp_configure 'show advanced options', 1 GO RECONFIGURE; 

当我执行查询时,我成功获得输出。 但是在尝试通过Windows窗体时,我收到了这个错误。 请帮我

启用Ole Automation程序只是问题的一部分。 您需要授予执行权限:

 GRANT EXECUTE ON master..sp_OACreate to [??] GRANT EXECUTE ON master..sp_OASetProperty to [??] GRANT EXECUTE ON master..sp_OAMethod to [??] GRANT EXECUTE ON master..sp_OADestroy to [??] 

[??]必须是具有master访问权限的用户/角色。

以下示例显示如何查看OLE自动化过程的当前设置。

 EXEC sp_configure 'Ole Automation Procedures'; GO 

以下示例说明如何启用OLE自动化过程。

 sp_configure 'show advanced options', 1; GO RECONFIGURE; GO sp_configure 'Ole Automation Procedures', 1; GO RECONFIGURE; GO 

Ole Automation Procedures选项也可通过SSMS进行配置,方法是右键单击感兴趣的服务器实例,选择Facets打开View Facets对话框。 在“常规”页面的“构面”下拉列表中,选择“表面区域配置”。 OleAutomationEnabled是显示的Facet属性列表中的一个选项。 真=开。 (根据您正在做的事情,您可能还需要启用XPCmdShellEnabled设置。)正如其他人所写,我并不是建议应该启用此设置,只是如何通过界面执行此操作。

尝试运行这个3

 sp_configure 'show advanced options', 1 GO RECONFIGURE; GO sp_configure 'Ole Automation Procedures', 1 GO RECONFIGURE; GO sp_configure 'show advanced options', 1 GO RECONFIGURE;