How to find SQL Server Cluster information

Here I am trying to explain how to find SQL server cluster information.

SELECT SERVERPROPERTY('IsClustered'), SERVERPROPERTY('ComputerNamePhysicalNetBIOS')
	,SERVERPROPERTY('MachineName') ,SERVERPROPERTY('InstanceName') ,SERVERPROPERTY('ServerName')


;With ClusterActiveNode as (
SELECT SERVERPROPERTY('ComputerNamePhysicalNetBIOS') as NodeName, Cast('Active' as varchar(10)) as Active
), ClusterNodes as (
SELECT NodeName FROM sys.dm_os_cluster_nodes
)
Select b.nodename, isnull(active,'Passive') as NodeStatus 
from ClusterNodes as b 
left join ClusterActiveNode as a on a.NodeName = b.nodename

Machine Name: – Windows computer name on which the server instance is running. For a clustered instance, an instance of SQL Server running on a virtual server on Microsoft Cluster Service, it returns the name of the virtual server.
Instance Name: – Name of the instance to which the user is connected.
Server Name: – Both the Windows server and instance information associated with a specified instance of SQL Server.

The below query shows you where the SQL Server failover cluster diagnostic log is located (SQL Server Error Log)
Knowing this information is important for troubleshooting purposes
Also shows you the location of other error and diagnostic log files


SELECT is_enabled, [path], max_size, max_files
FROM sys.dm_os_server_diagnostics_log_configurations WITH (NOLOCK) OPTION (RECOMPILE);


Below query help to find storage information.

/* Using In-Built Function Identify Nodes of SQL Server Failover Cluster */
SELECT * FROM fn_virtualservernodes()
GO
EXEC XP_FIXEDDRIVES

/* Using DMV Identify Nodes of SQL Server Failover Cluster */
SELECT * FROM sys.dm_os_cluster_nodes
GO
SELECT * FROM fn_servershareddrives()

/* Using DMV Function Identify Shared Drives Used by SQL Server Failover Cluster Instance */
SELECT * FROM sys.dm_io_cluster_shared_drives

 EXEC master.dbo.xp_readerrorlog 1, 1, N'NETBIOS', NULL, NULL, NULL, N'desc'
Spread the love

1 thought on “How to find SQL Server Cluster information”

  1. Pingback: Read specific errors using temp table Himanshu Patel SQL Server Consultant developer & Administrator -

Leave a Comment