Original: SQL Server database timed automatic backup
SQL Server Database scheduled automatic backup-daily scheduled backups, 8 days of backup retention
Use SQL Server Agent new job to back up regularly
1) in the database Library "SQL Server Agent", "Jobs", right-click "New Job"
2) On the General tab, set the name (custom)
3) Tap New on the Steps tab, then set the step name (custom) in the General tab of the Pop-up window, choose Type as Transact-SQL script (T-SQL), select database for the database you want to back up, add the following command, Then click "Analyze" to see if the command is successful.
EXECsp_configure'Show advanced Options',1 Reconfigure withOVERRIDEEXECsp_configure'xp_cmdshell',1 Reconfigure withOVERRIDEDECLARE @DelStr nvarchar( -)SET @DelStr='Del D:\WebSiteBack\TMSoftwareTest_DbBack\TMSoftwareTest'+left(REPLACE(REPLACE(REPLACE(REPLACE(CONVERT(VARCHAR(Ten),GETDATE()-8, -),' ',"'),':',"'),'-',"'),'.',"'),8)+ '*.bak' EXECxp_cmdshell@DelStr DECLARE @fileName nvarchar( -) SET @fileName='D:\WebSiteBack\TMSoftwareTest_DbBack\TMSoftwareTest'+REPLACE(REPLACE(REPLACE(REPLACE(CONVERT(VARCHAR(Ten),GETDATE(), -),' ',"'),':',"'),'-',"'),'.',"')+ '. bak' BACKUP DATABASE [tmsoftwaretest] to DISK = @fileName withNoinit, Nounload, NAME=N'tmsoftwaretest Backup', Noskip, STATS= Ten, Noformat
Instructions (daily scheduled backups, 8 days of backup Records):
Back up the statement of the database, in SQL Enterprise Manager, right-click on the database you want to back up, "Tasks", "Backup", pop-up interface, select "Script" under "Save Action Script to" New Query window ", Generate script
4) Click "New" in the "Schedule" tab and set the parameters in the popup window as follows:
5) Click "OK" to find the newly created job below.
① first ensure that the SQL Server Agent service Proxy in Configuration Manager is turned on (start, All programs, locate your SQL folder under Configuration Tools, SQL Server Configuration Manager, SQL Server 2005 Service "(My Own is SQL2005)," SQL Server Agent (B) "Select Right-click Start and set the startup mode to Automatic);
② Select SQL Server agent for the database, right-click Start
③ Select the job you just created, right-click Start Job
Other references: http://www.cnblogs.com/zhangq723/archive/2012/03/13/2394102.html
Http://wenku.baidu.com/link?url=XN36A7oXiYexrRyehjmX78_jK1M4b0yP3jezlHKEMrA2RP_ H1e0aibq9g9bg-vyd2t9ph-six8lifwp75vnxndzpnqx_l6b_n3pg8xns9ri
SQL Server database scheduled automatic backup