November 11, 2021 at 1:30 pm
Hi there
We are currently using SQL Server Express 2019 which is limited in aspects including the Maintenance Plan Wizard.
I would like to set up an automatic job which runs every night and backups our daabases.
I have thought of using a sqlcmd script and executing tha through windows scheduler. But has anyone done this method
before or recommend an alternative to using Maintenance Plan?
November 11, 2021 at 6:29 pm
That's what I do on my SQL Express server.
First step is a batch file to delete backups older than X days
forfiles.exe /p "C:\Program Files\Microsoft SQL Server\MSSQL14.MSSQLSERVER\MSSQL\Backup\SQL_PROD" /s /m *.* /d -21 /c "cmd /c del @file"
Then batch file to call a stored procedure that does the backups.
sqlcmd -Q "exec USP_MyDB_Backups" -S ServerName -d DB_Containing_SP
November 11, 2021 at 8:30 pm
Task scheduler or a full blown sql server which has batch files to connect to the sql express instance and back it up run via the agent.
November 12, 2021 at 12:09 pm
Hi,
if you like powershell, take a look at this page:
https://docs.dbatools.io/Backup-DbaDatabase
It is quite simple and easy to use. Just build your script and use the windows scheduler.
Kind regards,
Andreas
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply