SQL Server 2005 automatic Backup database method sharing (illustrated tutorials) _mysql

Source: Internet
Author: User
Tags getdate management studio sql server management sql server management studio
The specific steps are as follows:
First, open SQL Server Management Studio in the Start menu, expand the SQL Servers on the left side of the window;

Second, SQL Server Agent, right click to select "Start" (not started);

Third, select "Job-> new Job";

Enter the name of the job in "General";

Five, in the "step" in the new step, select T-SQL, the command entered the following statement (red part to change according to their actual situation, D:\bak\ to their own backup path, DatabaseName modified to the name of the database you want to back up)
Copy Code code as follows:

DECLARE @DBPATH NVARCHAR (200)
SET @DBPATH =convert (Varchar,getdate (), 120)
SET @DBPATH =replace (@DBPATH, '-', ')
SET @DBPATH =replace (@DBPATH, ', ')
SET @DBPATH =replace (@DBPATH, ': ', ')
SET @DBPATH = ' D:\DBBACKUP\ ' + @DBPATH + '. Bak '
BACKUP DATABASE [DATABASENAME] to DISK = @DBPATH with Noinit,nounload,noskip,stats=10,noformat

To add a plan in the plan, fill out the plan name, select the type of plan, set the frequency, time, etc. when the setup is complete, click OK.

Sqlserver2005 Automatic backup Diagram tutorial

First, open SQL Server Management Studio Enterprise Manager

Second, SQL Server Agent, right-click to select "Start"

Tips: Note that the SQL Server Agent here modifies the startup type to Automatic

Third, a new job

①. Right à new job

②. Fill in the name, owner information

③. Click the Step tab and click "New" to add a new step

④. Complete the basic information of the steps, such as: Name T-SQL (BACKUP statement)

Tips: The following statement to complete the backup database:

Declare @DataStr NVARCHAR (200)

Set @DataStr = Convert (NVARCHAR), GETDATE (), 120)

Set @DataStr = REPLACE (@DataStr, ': ', ' _ ')

Set @DataStr = REPLACE (@DataStr, ', ' _ ')

Set @DataStr = REPLACE (@DataStr, '-', ' _ ')

Set @DataStr = ' e:\databasebak\370501_#_#_ ' + @DataStr + '. Bak '

BACKUP DATABASE [370501] to DISK = @DataStr with Noinit, Nounload, noskip, STATS = ten, Noformat

T-SQL Feature Description:

The role of T-SQL here is to back up a backup file named: 370501_#_#_ 2010_08_05_15_23_01.bak, and place this file in the E:\DataBaseBak directory

⑤, click the Plan tab, click Add to add a program

⑥. Fill in the name and the execution frequency of the Plan in the dialog box that pops up

⑦. Click OK save current plan à click OK save current job, auto back up database complete

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.