-- Identify Virtual Processors in for SQL Server 2005, 2008, 2008R2, 2012
SELECT cpu_count FROM sys.dm_os_sys_info GO
-- Identify Virtual Processors in for SQL Server 2000
CREATE TABLE #TempTable ([Index] VARCHAR(2000), [Name] VARCHAR(2000), [Internal_Value] VARCHAR(2000), [Character_Value] VARCHAR(2000)) ; INSERT INTO #TempTable EXEC xp_msver; SELECT Internal_Value AS VirtualCPUCount FROM #TempTable WHERE Name = 'ProcessorCount'; DROP TABLE #TempTable GO
上述的只能看CPU數,下面則還可檢視記憶體大小。
SELECT cpu_count AS [Logical CPU Count], hyperthread_ratio AS Hyperthread_Ratio, cpu_count/hyperthread_ratio AS Physical_CPU_Count, physical_memory_in_bytes/1048576 AS Physical_Memory_in_MB, sqlserver_start_time, affinity_type_desc -- (affinity_type_desc is only in 2008 R2) FROM sys.dm_os_sys_info
SELECT cpu_count FROM sys.dm_os_sys_info GO
-- Identify Virtual Processors in for SQL Server 2000
CREATE TABLE #TempTable ([Index] VARCHAR(2000), [Name] VARCHAR(2000), [Internal_Value] VARCHAR(2000), [Character_Value] VARCHAR(2000)) ; INSERT INTO #TempTable EXEC xp_msver; SELECT Internal_Value AS VirtualCPUCount FROM #TempTable WHERE Name = 'ProcessorCount'; DROP TABLE #TempTable GO
上述的只能看CPU數,下面則還可檢視記憶體大小。
SELECT cpu_count AS [Logical CPU Count], hyperthread_ratio AS Hyperthread_Ratio, cpu_count/hyperthread_ratio AS Physical_CPU_Count, physical_memory_in_bytes/1048576 AS Physical_Memory_in_MB, sqlserver_start_time, affinity_type_desc -- (affinity_type_desc is only in 2008 R2) FROM sys.dm_os_sys_info
![]() | ||||||