Need help with SSIS script task

  • Hi,

    I need to implement a logic in the package.

    The package has to restore a database from the production backup into another server everyday. We are currently taking weekly one full backup and daily differential backup.

    In the package whenever it run it has to check the backup date, if the full backup is available with package run date then it has to restore with the full backup. If the full backup date is older and if differential backup is available then it has restore with that old full backup + diff backup.

    How to implement this logic in SSIS package. Is the script task works for this? How to write the code to implement such logic

  • You'll need to use variables to store the date of each backup and then use those variables together with precedence constraints to route your logic accordingly. You don't need to use a script task for this, but more to the point, you don't need to use SSIS for this - a stored procedure can encapsulate all of the logic that you need.

    Regards

    Lempster

  • Thank you

  • You're welcome!

  • Hi Lempster,

    To give you some more clarification, why I am using SSIS package

    Currently the backups are residing in one server but database has to restore in another server.

    I have to get that backup files to separate server and then restore database from that backup then run some DML after everything is done then delete the backup files from the local machine.

    Current my plan keep the full backup in the local machine until next full backup with out deleting but needs to check the full backup date. If the full backup date is recent than the backup date on local machine then delete the old backup and keep this ..

    Is it possible through Stored procedure?

    If you have any of sample code, please provide to me.

    Thank you

  • ramana3327 (1/26/2015)


    Currently the backups are residing in one server but database has to restore in another server.

    I have to get that backup files to separate server and then restore database from that backup then run some DML after everything is done then delete the backup files from the local machine.

    Current my plan keep the full backup in the local machine until next full backup with out deleting but needs to check the full backup date. If the full backup date is recent than the backup date on local machine then delete the old backup and keep this ..

    Is it possible through Stored procedure?

    If you have any of sample code, please provide to me.

    Thank you

    Yes, you can still do all of that in a stored procedure, but you'll need to set up Linked Servers between instances on different servers.

    Regards

    Lempster

  • Ok. Thank you

Viewing 7 posts - 1 through 6 (of 6 total)

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