MS SQL Server database backup solution
The following has been tried and work wellIn task scheduler:
sqlcmd -i "E:\db_backup\ADbk.sql"
where E:\db_backup\ADbk.sql is the backup script to run, which contains the codes:
DECLARE @MyFileName varchar(50)
SELECT @MyFileName = (SELECT 'E:\db_backup\ADbk_' + datename(dw,GetDate()) + '.bak')
BACKUP DATABASE TO DISK = @MyFileName WITH NOFORMAT, INIT, NAME = N'AD-Full Database Backup'
GO
This will include day of the week in the backup file name. Thus 7 copies of backup files always kept.
Note
INIT = overwire existing file
NOINIT = append to existing file
页:
[1]