server| Backup 1, into Enterprise Manager-> Management->sql Server Agent-> operations;
2, the new job, the name of the job to take, for example: Data backup, the owner Select SA, of course, you can also choose other users, provided that the user has the right to execute the job;
3, click the Step tab, enter the step panel. To create a new step, the step name can be filled out casually, such as Step 1, type and database defaults, and no modification is required. The following statement is written to the command:
Backup database [DB name] to DISK = n ' F:\data\ database backup ' with Noinit, nounload, NAME = n ' database backup ', NOSKIP, STATS = 10, Noformat
Note: You need to modify the place, database name, disk= (here need to fill in the path and the name of your database backup) name= can be easily filled in.
4, click the schedule tag, into the dispatch panel, new scheduling, name casually fill in, select Recurring, point change can choose you want to perform the task of arbitrary scheduling. such as every day, every 2 days, every week, monthly, etc. Set yourself up according to your needs;
5, make sure, do not forget one thing, in the work you have just established the right button to start work, if your work is no problem, will be prompted to perform successfully, and have a corresponding backup file on your disk appear;
6, another important problem is that your SQL Server Agent server has been started.
If we need to generate a new backup based on the daily date, so that we can distinguish between backup files. At this point, we need to modify the SQL statement just now. Reference Example:
declare @filename nvarchar (100)
Set @filename = ' F:\AddIn\ backup \data ' +convert (char (), GETDATE (), 112)
Print @filename
Backup DATABASE [addin] to DISK = @filename with Noinit, nounload, NAME = N ' addin backup ', noskip, STATS = ten, Noformat
Or as follows:
DECLARE @BACKFILENAME VARCHAR (200)
DECLARE @DATE CHAR (10)
DECLARE @FILENAME VARCHAR (200)
DECLARE @NAME VARCHAR (200)
SET @DATE =convert (CHAR), GETDATE (), 120)
SET @FILENAME = ' F:\SQLServerBackup\DefectStoreDKH_ '
SET @BACKFILENAME = @FILENAME + @DATE
SET @NAME = ' Defectstoredkh backup '
BACKUP DATABASE [Defectstoredkh]
To DISK = @BACKFILENAME with INIT, nounload, NAME = @NAME, noskip, STATS = ten, Noformat