locked
Nested Parallel Workflow With Pause RRS feed

  • Question

  • Trying to run SharePoint Upgrade-SPContentDatabase command on two database concurrently per SQL server. We have four SQL servers hosting few terabytes of SharePoint data. Using the powershell workflows I can accomplish it but there are some issues as below.

    1) Upgrade command causes SharePoint to generate log file, since I am executing in parallel, SP generates error message that log file <<filename>> already exist.

    2) I have to upgrade Powershell version on server in order to utilize Workflows.

    Wondering if somebody can help me either with introducing pause in parallel process before each Upgrade command or use a different approach. The second issue is minor.

    The following is the code I am using

    workflow UpgradeContentDB
    {
        Param($csvPath,$throttle,$sleepSec)
    
        $dbColl = Import-Csv $csvPath |
                    Select-Object Server,Name,@{ n = "Size"; e = { [int]($_.Size) } }  |
                    Sort-Object Size -Descending |
                    Group-Object -Property "Server"
    
        foreach -Parallel ($svr in $dbColl)
        {
            foreach -Parallel -throttlelimit $throttle ($db in $svr.Group)
            {
                Sequence
                {  
                    InlineScript {
                        Add-PSSnapin Microsoft.Sharepoint.Powershell;
                        Get-Date -Format G
                        " Server: " + $using:db.Server + " Database: " + $using:db.Name +  " Size: " + $using:db.Size;
                        Upgrade-SPContentDatabase $using:db.Name -Confirm:$false;
                        Start-Sleep -Seconds $using:sleepSec;
                    }
                }
            }
        }
     }
    • Edited by adhanju Tuesday, July 31, 2018 6:25 PM
    Tuesday, July 31, 2018 6:25 PM

Answers

  • Hi,

    I am glad that you have solved your issue.

    You could mark your reply as an answer. It will help others who meet the similar question in this forum.

    Best regards,

    Allen Bai


    Please remember to mark the replies as answers if they helped. If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com.


    Click here to learn more. Visit the dedicated forum to share, explore and talk to experts about Microsoft Teams.

    • Marked as answer by adhanju Tuesday, April 14, 2020 7:37 PM
    Thursday, August 2, 2018 1:19 AM

All replies

  • Hi,

    Maybe this post is useful to you, it tells more about "how to nest two workflows inside of a single workflow so the two workflows function in parallel":

    https://stackoverflow.com/questions/33699545/nest-two-workflows-in-a-single-workflow-to-run-parallel

    Best regards,

    Allen Bai


    Please remember to mark the replies as answers if they helped. If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com.


    Click here to learn more. Visit the dedicated forum to share, explore and talk to experts about Microsoft Teams.

    Wednesday, August 1, 2018 7:30 AM
  • Thanks.

    Was able to implement workaround to avoid this issue.

    Instead of waiting 5 seconds, the script would wait random seconds in each iteration.

    Wednesday, August 1, 2018 9:19 PM
  • Hi,

    I am glad that you have solved your issue.

    You could mark your reply as an answer. It will help others who meet the similar question in this forum.

    Best regards,

    Allen Bai


    Please remember to mark the replies as answers if they helped. If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com.


    Click here to learn more. Visit the dedicated forum to share, explore and talk to experts about Microsoft Teams.

    • Marked as answer by adhanju Tuesday, April 14, 2020 7:37 PM
    Thursday, August 2, 2018 1:19 AM