Restore Gene : Automating SQL Server Database Restores

  • Yes, to start the process off you supply '1' for the initialize parameter, it then uses the full backup and all logs.

    Subsequently, later after more log backups were taken, you supply '0' to just restore the new log backups.


  • Here's the interesting thing while i tested with Log shipping option set to 1, it is throwing an error:

    PS C:\> C:\Automate\TEST\Restore\ps_RestoreGene_v4.0.ps1 -LogShippingInitialize "1"

    cmdlet ps_RestoreGene_v4.0.ps1 at command pipeline position 1

    Supply values for the following parameters:

    RestoreLog: -DBName "BaselineData" `

    PrimaryServer: -PrimaryServer "XXX" `

    StandbyServer: -StandbyServer "ZER" `

    DBName: -FromFileFullUNC "\\XXXF\Prod_Backups\XXX\BaselineData\FULL\" `

    -PrimaryServer "XXX" `

    Error : Connection to Primary server cannot be established

    At C:\Automate\TEST\Restore\ps_RestoreGene_v4.0.ps1:101 char:5

    + throw "Error : Connection to Primary server cannot be established"

    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    + CategoryInfo : OperationStopped: (Error : Connect... be established:String)

    + FullyQualifiedErrorId : Error : Connection to Primary server cannot be established

    Also, i checked to query the primary server from standby and it was success , but not with PSrestoregene.

    Any help would be appreciated?

  • Are there any login failures in the SQL server error log on the primary?

    Is the tcp-ip protocol enabled on the primary?


  • No login failure messages on primary and I checked TCP IP is enabled on primary as well.

  • You might need this installed on the server you are running powershell from -


  • Thanks Paul for the wonderful script.

    I have a requirement where the Primary and Secondary are in totally different domain. Now I am moving files through FTP. Can you help me in syncing the Primary and Secondary in Stand by mode. This is for a reporting application.

    Thanks In Advance.

Viewing 6 posts - 31 through 35 (of 35 total)

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