如何从 SQL 运行程序? [英] How to run a program from SQL?

查看:38
本文介绍了如何从 SQL 运行程序?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要实现一个工具,当 DB 记录匹配某些条件时,该工具可以从 SQL Server 数据库运行程序.有没有办法做到这一点?

I need to implement a tool that runs programs from SQL Server database when a DB record matches some condition. Is there a way to do it?

推荐答案

我会小心使用 xp_cmdshell,因为它会造成相当大的安全漏洞.查看这篇文章来自http://www.databasejournal.com/features/mssql/article.php/3372131/Using-xpcmdshell.htm

I would be careful with xp_cmdshell because it can create quite a security hole. Check out this article from http://www.databasejournal.com/features/mssql/article.php/3372131/Using-xpcmdshell.htm

如果服务帐户具有本地管理权限,则您可以使用此过程执行任何 Windows 操作系统命令.

If the service account has local administration rights then you can use this procedure to perform any windows operating system command.

看看我前段时间问的这个类似的问题.经过一些研究,我认为安全风险对于生产数据库服务器来说太大了.您的情况可能有所不同,而 xp_cmdshell 可能就是答案.SQL Server xp_cmdshell

Check out this similar question I asked some time ago. After some research I decided the security risk was too great for a production DB server. Your situation might be different and xp_cmdshell might be the answer. SQL Server xp_cmdshell

这篇关于如何从 SQL 运行程序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆