1

When I run a Profiler trace on our SQL Server cluster, I've noticed that it executes "SELECT @@SERVERNAME" every minute. I always figured the Failover Cluster service did something with it, or just used it to confirm that the network name and IP combinations were set up correctly. This doesn't happen every minute on my non-clustered instances, only on those that are part of a failover cluster.

What makes this even more curious is that I overrode the name of a cluster instance using sp_dropserver/sp_addserver, and there were no ill effects at all - even though the clustered instance name doesn't match the expected network/instance combination, both the cluster manager and SQL Server seem totally fine with this.

This just doubly-begs the question - why constantly query it if you're not going to do anything with/about it? Can anybody shed some light on the plumbing here?

SqlRyan
  • 33,116
  • 33
  • 114
  • 199
  • I'm a much more casual user of SO than I used to be - does this question belong on one of the child sites now? There's a request to close, but since they didn't leave a comment, I'm not sure the remedy. – SqlRyan Sep 06 '11 at 19:05
  • Someone believes it belongs on serverfault, that's all. If you click on the link `close (1)` under the tags, you will see that it is checked as "off topic" and if you drill in you will see the site where they thought it would be more appropriate. I'm on the fence, I didn't really think about it until your comment. – Aaron Bertrand Sep 06 '11 at 20:04
  • @Aaron Bertrand: Thanks for the tip - I'd seen the "Off Topic" vote, but didn't realize I could drill in. Maybe it's been longer since I was active on the site than I thought... – SqlRyan Sep 06 '11 at 23:02

1 Answers1

6

This is a heartbeat / uptime check, making sure the node is healthy. This is one of the factors it uses to determine when it's time to failover (because if it can't get a result, there's something wrong with the SQL Server service on that node).

Aaron Bertrand
  • 272,866
  • 37
  • 466
  • 490
  • So there's nothing particularly special about doing the @@SERVERNAME check, but it's just a proxy for "can I get a response from the instance"? In that case, maybe it doesn't matter that I've overridden the name of the instance internally - I was concerned that I'd cause problems with the failover, and when it seemed to have no impact, I was concerned I was missing something. – SqlRyan Sep 06 '11 at 18:53
  • That's right, it just makes sure it gets an answer, it doesn't care what the answer is. However, I would change your servername back to the correct name, as it could cause issues elsewhere. – Aaron Bertrand Sep 06 '11 at 18:55
  • We have to do it for license compliance with a product we still use but for which we don't have the source code (See Question 1146113 for my initial foray into this). I agree that it's ideal to not have to do this, but you've answered my question, so +12 to you! – SqlRyan Sep 06 '11 at 19:04