olahallengren / sql-server-maintenance-solution

SQL Server Maintenance Solution
https://ola.hallengren.com
MIT License
2.88k stars 740 forks source link

Removing old backup files when database is dropped #66

Open victorsh1968 opened 6 years ago

victorsh1968 commented 6 years ago

Hi,

I want to suggest to add this feature in the dba management procedures, to remove as well old backup files when a database have been removed, otherwise we'll have a lot of backup files which no one will delete anymore from the server.

Thank you. Victor S DBA

BlitzErik commented 6 years ago

Just playing devil's advocate here -- what if the database is dropped by accident? Wouldn't you really want backups then?

victorsh1968 commented 6 years ago

Hi, i think that i can provide an answer to your question, I'm working on a heavy environment which have a lot of database duplication processes daily, please don't ask why.., so i have a lot of duplicates and dropped databases all the time and i wanted to have some kind of internal option to deletes old backups, maybe something that i can configure as optional that backups for databases that doesn't exists more than X days will be drop automatically.

Thanks, Victor

On Sun, 17 Jun 2018, 14:08 BlitzErik notifications@github.com wrote:

Just playing devil's advocate here -- what if the database is dropped by accident? Wouldn't you really want backups then?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/olahallengren/sql-server-maintenance-solution/issues/66#issuecomment-397871302, or mute the thread https://github.com/notifications/unsubscribe-auth/ALLV_j3_KRoAcGyaIU5wKdjVbGhHHRfFks5t9jiXgaJpZM4UqtZD .

ethanklitz commented 6 years ago

I'll add a +1 to the issue as I also have environments where this would be really nice

Also +1000 to @BlitzErik's point. I'd see this as a separate cleanup procedure or at the very least behind a @CleanupOrphans

sm8680 commented 6 years ago

Food for thought. If this comes to fruition. I’d recommend that it would be parameter based (Yes/No with No being the defult). For in non production environments this would be ideal. For production environments I may want an old backup file for various reasons.