May 13, 2016 at 11:00 am
Hi
I am looking for a way to determine if the server is Physical or Virtual using SQL Server 2008. Can you please let me know if there any easy way to find out without using xp_readerrorlog? Also this info is available in DMV from SQL 2008 R2. Any help or input will be useful for me.
Thank you
May 13, 2016 at 11:16 am
there's a DMV with that info:
select s.virtual_machine_type,
s.virtual_machine_type_desc
FROM sys.dm_os_sys_info s
Lowell
May 13, 2016 at 11:21 am
This works from SQL 2008 R2 onwards. But in SQL 2008 it doesnt work.
May 13, 2016 at 12:33 pm
You can try doing something like this:
CASE
WHEN RTrim(@@VERSION) LIKE '%(VM)' + CHAR(10) THEN 'Virtual'
WHEN RTrim(@@VERSION) LIKE '%(Hypervisor)' + CHAR(10) THEN 'Virtual'
ELSE 'Physical'
END AS Machine_Type
...but I can't vouch for the reliability of this.
May 13, 2016 at 1:10 pm
Thank you. It works for me.
May 15, 2016 at 1:22 pm
usually the error log will identify virtual machines as the instance starts, look for the hardware info
-----------------------------------------------------------------------------------------------------------
"Ya can't make an omelette without breaking just a few eggs" 😉
Viewing 6 posts - 1 through 5 (of 5 total)
You must be logged in to reply to this topic. Login to reply