这可能很简单,但我找了很多次却找不到。
是否有sql查询或在注册服务器上运行的方法可以查找所有运行在ssis、ssas、ssrs、sql、agent、broswer等的sql相关服务的列表?
尝试googling out,可以找到sys.dm_server_services dmv,但它没有显示所有正在运行的服务。
发布于 2017-08-07 16:22:23
SQL->我从本文中获得的Powershell脚本。也许是这样的?http://hubpages.com/technology/Using-xp_cmdshell-to-Query-the-Windows-File-System。
我使用已注册的服务器连接到网络中的服务器,在我的桌面的SSMS上运行这个命令。
**最初是为IPCONFIG测试而制作的,但您只需将其修改为net start即可。
--Enable SQL->PowerShell
EXEC sp_configure 'show advanced options', 1;
GO
Reconfigure;
GO
EXEC sp_configure 'xp_cmdshell',1
GO
Reconfigure
GO
--Run 'net start' command from SQL Server
--1) Create the table
CREATE TABLE #cmdNetStartRun
(outputvalue VARCHAR(3000)
,outputDate DATETIME2 DEFAULT GETDATE());
--2) Run the cmd and insert the output into the table
INSERT INTO #cmdNetStartRun(outputvalue)
exec xp_cmdshell 'net start';
--3) Select from the table
SELECT outputvalue, outputDate
FROM #cmdNetStartRun
WHERE outputvalue LIKE '%SQL%';
--4) Drop the Table
DROP TABLE #cmdNetStartRun;发布于 2017-08-07 16:17:50
Powershell是最简单的。
Get-Service "sql*"https://dba.stackexchange.com/questions/182880
复制相似问题