• I have no idea how the "points" works on this website. It seems to just be "posts" unlike on the Oracle forums where you receive points for correct/helpful answers o:

    If they all have the default instance then you can use the original version of the code I provided. However, you will have to change the backup from "WITH INIT" to "WITH NOINIT" if you will do regular transaction log backups. This will append to the file instead of overwriting.

    You will also want to create the following .bat file to delete the old (otherwise it will append forever & you'll run out of space). Schedule to run once per day in the morning:

    rem

    rem Log the output to a file

    rem

    :clean_main

    call :cleanup >> cleanup.log

    rem

    rem Delete .bak files older than 6 days.

    rem

    :cleanup

    forfiles /M *.bak /D -6 /c "cmd /c echo Deleting @file && del /Q @file"

    :end

    You will need to place this script in the folder that the transaction log backups will be stored. It will keep 6 days (e.g. if today is Tuesday it will delete Wednesday's file before tomorrow) worth of backups so you should keep your transaction log backups in a different folder to your database backups...just in case you have weekly backups (it would get deleted before a new one is taken) or daily backups & don't need that many days of backups.

    If you do daily backups then this script could be used for both. e.g. if you keep 3 days of daily backups then you can also keep 3 days of transaction log backups by changing the 6 to a 3.

    It outputs a log. After the first 7-10 days when you've seen from the log that it has been deleting files successfully then you can remove this part of the .bat script.

    Note: this script may not work for all of your servers becase of the forfiles command. According to here you can download it from here[/url] for older OS versions. but there's a slight syntax change I think. What OSs do your SQL Servers run on?


    Dird