我想打开始终对SSIS的支持。我可以使用UI来执行此操作(右键单击Integration Services目录,单击“始终启用支持”)。我想看看是否有一种方法可以使用microsoft.sqlserver.management.integrationservices在Power Shell或C#中执行此操作

这是“始终支持”启用的用户界面

c# - 通过C#或powershell的SSIS的“Enable Always on support…”-LMLPHP

最佳答案

Powershell解决方案

首先要在实例上启用始终在线可用性组功能,您可以使用:

Enable-SqlAlwaysOn -Path SQLSERVER:\SQL\Computer\Instance
  • Enable or Disable Always On availability group feature
  • Enable-SqlAlwaysOn

  • 然后,您应该创建一个Always on可用性组,并将SSISDB数据库添加到该组:
  • Create an Always On availability group using PowerShell(带有示例)
  • Add-SqlAvailabilityDatabase

  • 从上面的链接,您应该按照以下步骤操作:



    上面链接中提供的示例
    # Backup my database and its log on the primary
    Backup-SqlDatabase `
        -Database "SSISDB" `
        -BackupFile "\\share\backups\SSISDB.bak" `
        -ServerInstance "PrimaryComputer\Instance"
    
    Backup-SqlDatabase `
        -Database "SSISDB" `
        -BackupFile "\\share\backups\SSISDB.log" `
        -ServerInstance "PrimaryComputer\Instance" `
        -BackupAction Log
    
    # Restore the database and log on the secondary (using NO RECOVERY)
    Restore-SqlDatabase `
        -Database "SSISDB" `
        -BackupFile "\\share\backups\SSISDB.bak" `
        -ServerInstance "SecondaryComputer\Instance" `
        -NoRecovery
    
    Restore-SqlDatabase `
        -Database "SSISDB" `
        -BackupFile "\\share\backups\SSISDB.log" `
        -ServerInstance "SecondaryComputer\Instance" `
        -RestoreAction Log `
        -NoRecovery
    
    # Create an in-memory representation of the primary replica.
    $primaryReplica = New-SqlAvailabilityReplica `
        -Name "PrimaryComputer\Instance" `
        -EndpointURL "TCP://PrimaryComputer.domain.com:5022" `
        -AvailabilityMode "SynchronousCommit" `
        -FailoverMode "Automatic" `
        -Version 12 `
        -AsTemplate
    
    # Create an in-memory representation of the secondary replica.
    $secondaryReplica = New-SqlAvailabilityReplica `
        -Name "SecondaryComputer\Instance" `
        -EndpointURL "TCP://SecondaryComputer.domain.com:5022" `
        -AvailabilityMode "SynchronousCommit" `
        -FailoverMode "Automatic" `
        -Version 12 `
        -AsTemplate
    
    # Create the availability group
    New-SqlAvailabilityGroup `
        -Name "MyAG" `
        -Path "SQLSERVER:\SQL\PrimaryComputer\Instance" `
        -AvailabilityReplica @($primaryReplica,$secondaryReplica) `
        -Database "SSISDB"
    
    # Join the secondary replica to the availability group.
    Join-SqlAvailabilityGroup -Path "SQLSERVER:\SQL\SecondaryComputer\Instance" -Name "MyAG"
    
    # Join the secondary database to the availability group.
    Add-SqlAvailabilityDatabase -Path "SQLSERVER:\SQL\SecondaryComputer\Instance\AvailabilityGroups\MyAG" -Database "SSISDB"
    

    关于c# - 通过C#或powershell的SSIS的“Enable Always on support…”,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/55349599/

    10-11 03:03