How can I backup a SQL database to a destination automatically every day and delete the Backup automatically older than 5 days?
Asked
Active
Viewed 509 times
0
-
Microsoft SQL Express – Navid2132 Mar 18 '19 at 13:46
-
Please read StackOverflow's how-to ask https://stackoverflow.com/help/how-to-ask before posting here – sureshprasanna70 Mar 18 '19 at 13:47
-
i want to create a .bat data and run it with windows task scheduler – Navid2132 Mar 18 '19 at 13:47
-
By *"delete the database automatically older than 5 days"* I assume you actually mean the backup, and not the actual database. – Thom A Mar 18 '19 at 13:53
-
yes exactly i mean the backup – Navid2132 Mar 18 '19 at 13:55
-
Have you tried anything so far? Have you had a search on your preferred search engine? I'm confident there lots of examples on how to achieve this (probably with PowerShell), so why didn't those work? Could you describe why they didn't do what you want, or what errors you received? – Thom A Mar 18 '19 at 13:57
-
i have tried with Microsoft SQL Sever Express and it dosent work with free version the paid version costet allot with free version i couldnt do the tast – Navid2132 Mar 18 '19 at 14:13
-
Possible duplicate of [SQL Server Automated Backups](https://stackoverflow.com/questions/493886/sql-server-automated-backups) – SMor Mar 18 '19 at 14:23
2 Answers
0
Back up SQL database BACK UP SQL, Delete old database Delete old database.

Hasan Mahmood
- 978
- 7
- 10
-
-
@sam2132, yes, that should be. this is basically for SQL Server Agent service, please install SQL Server Agent to do this. – Hasan Mahmood Mar 18 '19 at 14:26
-
>>>please install SQL Server Agent<<< SQL Server Agent is already installed by Expess Edition, but it CANNOT BE STARTED. This effectively means that to USE SQL Agent you need to install any other edition, NOT Express edition – sepupic Mar 18 '19 at 14:37
-
i know how to do with agent but it coast allot money thats y i want to find a script run it with windows task schudel freely – Navid2132 Mar 18 '19 at 14:42
0
This link from Microsoft should be exactly what you are looking for as it explains exactly how to configure backups with no Sql Server agent using the express edition - https://support.microsoft.com/en-us/help/2019698/how-to-schedule-and-automate-backups-of-sql-server-databases-in-sql-se

rvsc48
- 126
- 3
-
Link only answers may not be helpful in the future as links can be broken or the content of the link may change. It is always appreciated to add a summary along with the link. – Faruq Mar 18 '19 at 15:58