SQL Server Database Time Auto Backup

xiaoxiao2021-03-06  23

This article is original, reproduced, please indicate the address:

http://blog.9cbs.net/caoshangfei/archive/2005/01/24/266096.aspx

The backup of server data is a troublesome thing, if you want to manually back up every day or often, it is very painful. Here I introduce a method for establishing automatic backups through the job scheduling of SQL Server:

1. Enter Enterprise Manager -> Management -> SQL Server Agent -> Job;

2, new job, job name is just taken, for example: Data backup, owner chooses SA, of course, you can also choose other users, provided that the user has permission to perform jobs;

3. Click on the step tab to enter the step panel. New steps, step names can be filled in, such as step 1, type, and database default, do not need to be modified. Write the following statement in the command:

Backup Database [Database Name] to disk = n'f: / data / database backup 'with noinit, nounload, name = n' database backup ', NOSKIP, Stats = 10, NOFORMAT

Note: Name = where you need to modify the place, database name, disk = (here you need to fill in the path and the name of your database backup), you can fill in. 4, click the scheduling label, enter the dispatch panel, create new scheduling, name casually, select Repeated appearance, point change can select the random scheduling you want to perform the task. Such as every day, every 2 days, every week, monthly, etc. Set it yourself as needed; 5, after the determination, don't forget one thing, right click on your job, start the job, if your work is not problem, will prompt to perform success, and have a corresponding backup file There is an appearance on your disk; 6, there is an important question is that your SQL Server Agent server has started. If we need to generate a new backup according to the daily dates so that we distinguish the backup file. At this time, we need to modify the SQL statement just now. Reference Example: Declare @filename nvarchar (100) set @ filename = 'f: / address (char (10), getdate (), 112) Print @filename backup database [addin] to disk = @ FILENAME with NOINIT, NOUNLOAD, Name = N'Addin Backup ', NOSKIP, Stats = 10, Noformat If everyone still has problems, I hope everyone will mess with me.

转载请注明原文地址:https://www.9cbs.com/read-65146.html

New Post(0)