Backup of server data is troublesome. Manual backup is a pain point if you need to back up data on a daily or regular basis. Here I will introduce a method for creating automatic backup through SQL server job scheduling:
1. Choose Enterprise Manager> Manage> SQL server proxy> job;
2. Create a job and obtain the job name as needed. For example, for data backup, select sa as the owner. You can also select another user, provided that the user has the permission to execute the job;
3. Click the step tab to go to the step panel. Create a step. You can enter the step name as needed, such as step 1. The default type and database do not need to be modified. Write the following statement in the command:
Backup database [database name] to disk = n' F: database backup 'with noinit, NOUNLOAD, NAME = n' database backup', NOSKIP, STATS = 10, NOFORMAT
Note: The database Name, DISK = (here you need to enter the path and the Name of your database backup), and the Name = can be entered at will.
4. Click the scheduling tab to go to the scheduling panel. Create a scheduling task and enter the name as needed. Click "show" and select "schedule" for the task to be executed. Such as every day, every 2 days, every week, and every month. Set as needed;
5. Do not forget one thing after you confirm it. Right-click the job you just created and start the job. If there is no problem with your job, a message indicating that the job is successfully executed will be displayed, corresponding backup files appear on your disk;
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, we can differentiate the backup files. At this time, we need to modify the SQL statement just now. Reference instance:
Declare @ filename nvarchar (100) set @ filename = 'F: database backup rbdata' convert (char (10), getdate (), 112) print @ filename backup database [addin] to disk = @ filename with noinit, NOUNLOAD, NAME = n' BACKUP ', NOSKIP, STATS = 10, NOFORMAT