0

I have SSIS package which executes several minutes. It copies data to my PROD database. Package is launched from Sql Server Job. I'd like to take my web site offline during executing of the package. How do I can turn off my web site before execution and then turn on it back automatically?

I use Sql Server 2008 and IIS6.

Thanks

Egor4eg
  • 2,678
  • 1
  • 22
  • 41

1 Answers1

2

Here is a possible option:

Within the SSIS package:

  • Create a batch file named StopWebsite.bat with the following command:

    iisreset /stop computername

  • Create another batch file named StartWebsite.bat with the following command:

    iisreset /start computername

  • In the SSIS package, place an Execute Process Task in the Control Flow tab. Call the first batch file StopWebsite.bat from the Execute Process task. This will stop the Internet Information Services (IIS).

  • Place all your other tasks after the first Execute Process Task.

  • After all your other tasks in the Control Flow tab, place another Execute Process Task. Call the second batch file StartWebsite.bat. This will start the IIS.

  • Note that you need to place the batch files in a location where the SSIS package can access them from the production environment.

Within the SQL Server job:

  • If you don't want to do this in the SSIS package. You need to have three steps in your SQL Server Job.

  • Step 1 would execute the command iisreset /stop computername as job of type Operating System (CmdExec)

  • Step 2 would call the SSIS package.

  • Step 3 would execute the command iisreset /start computername as job of type Operating System (CmdExec)

  • If you run into permissions issue, make sure that the account (usually it is SQL Server Agent Account) in which the step is being executed has permissions to restart IIS on the remote server. You could also try to use a proxy account that would make use of a domain account credentials, in the following link screenshots 8 - 14 explains how to create a proxy account on job type SSIS Package Execution. You might need to do something similar on the Operating System (CmdExec) job type. How do I create a step in my SQL Server Agent Job which will run my SSIS package?

Replace computername with your actual computer name or IP address of the machine where your website is hosted.

I would say option #2 is easier to maintain.

Hope that helps.

Community
  • 1
  • 1