Script which will backup the transaction

  • How to write a Script which will backup the transaction log each hour for some databases in a server and delete the backup files of older than 1 week ?

    --sntiwary

     

  • though not a "script'...check out the database maintainance plan wizard. This might get the job done for you...

  • I would do this with a couple of jobs. First create a backup device for your log, then create a job that will run your trans log backups (Look at "BACKUP" in SQL Books Online). Set the job to run at the frequency you want. Then create a second job to delete the backup files using the command line commands.

     




    Gary Johnson
    Microsoft Natural Language Group
    DBA, Sr. DB Engineer

    This posting is provided "AS IS" with no warranties, and confers no rights. The opinions expressed in this post are my own and may not reflect that of my employer.

  • You can write a VBScript which runs back up ( OSQL ) and Delete commands and finally put this script on automation in SQL Agent Job.


    bondada

  • Simplest and supported through EM gui is to create maintenance plan which allows you to specify tan log backup every hour from and to, Then you specify how many days /weeks etc to keep them. The maint plan will allow creation of scheduled job which refers to maint plan. This job will run every hour etc etc and cleanup backups as per maint plan specs, also allows for log to be generated to user nominated location advising on success or otherwise of each tran log backup run.

Viewing 5 posts - 1 through 4 (of 4 total)

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