Weird behavior of powershell cmdlet Enable-SqlAlwaysOn

  • I'm having the following issue while using powershell cmdlet Enable-SqlAlwaysOn to enable AlwaysOn availability groups on SQL-2012 instances in a Windows cluster.

    I run this command from sqlps window (as administrator):

    Enable-SqlAlwaysOn -ServerInstance "SERVER1\INSTANCE1" -force

    The command completes successfully (no errors) and when I check the AlwaysOn setting in Config Manager for that SQL instance, the setting is indeed turned on.

    However, there is no SQL-instance restart (as there is supposed to be, per BOL) and the following still returns 0, indicating that the setting is not enabled:

    SELECT SERVERPROPERTY ('IsHadrEnabled');

    Funny thing is that when I run the following, I don't get any "are-you-sure" confirmation question, which, according to BOL, I am supposed to be getting:

    Enable-SqlAlwaysOn -ServerInstance "SERVER1\INSTANCE1"

    Anyone else seen this?

    (I'm on build 11.0.2100.)

    __________________________________________________________________________________
    SQL Server 2016 Columnstore Index Enhancements - System Views for Disk-Based Tables[/url]
    Persisting SQL Server Index-Usage Statistics with MERGE[/url]
    Turbocharge Your Database Maintenance With Service Broker: Part 2[/url]

  • I got it to work, but I am puzzled why... 🙂

    I ran the following to disable AlwaysOn:

    Disable-SqlAlwaysOn -ServerInstance "SERVER1\INSTANCE1" -force

    This caused a service restart this time.

    Then reran this to re-enable AlwaysOn:

    Enable-SqlAlwaysOn -ServerInstance "SERVER1\INSTANCE1" -force

    Another service restart and "SELECT SERVERPROPERTY ('IsHadrEnabled')" returned "1" this time.

    Weird...

    __________________________________________________________________________________
    SQL Server 2016 Columnstore Index Enhancements - System Views for Disk-Based Tables[/url]
    Persisting SQL Server Index-Usage Statistics with MERGE[/url]
    Turbocharge Your Database Maintenance With Service Broker: Part 2[/url]

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply