A Method for backing up data of ASP. NET + SQL Server websites

Source: Internet
Author: User
Tags mssqlserver

For small and medium-sized websites that use the ASP. NET + SQL Server structure, I use this method to back up data:

It is scheduled to run in windows at every Saturday.
Execute a bat script in the task plan:

Autobackup. bat

1 Net Stop IISADMIN / Y
2 Net Stop MSSQLServer
3 Net Stop MDaemon
4 Net Stop Webadmin
5
6 " C: \ Program Files \ WinRAR \ winrar.exe " A-hp123456-M0-agYYYY-MM-DD_HH . Mm-EP2-r-x @ D: \ Timed backup \ Exclude . LST-ibck D: \ Timed backup \ Webdata . RAR @ D: \ Timed backup \ Backup . LST
7
8 Net   Start Webadmin
9 Net   Start MDaemon
10 Net   Start MSSQLServer
11 Net   Start IISADMIN
12 Net   Start Httpfilter
13 Net   Start W3svc

The bat step is to stop related services, then use WinRAR to back up data, and then open the corresponding service.
Net stop IISADMIN/y indicates that the IISADMIN and services dependent on it are stopped.
Net stop MSSQLServer stop SQL Server to back up its data files. Data files are stored in the app_data directory of the website.
Net stop MDaemon is a mail system service.

The specific parameters of WinRAR include a TXT document under the installation directory of RAR, which provides detailed instructions. Among them, backup. lst and exclude. lst are the directories to be backed up and excluded files and directories. Wildcards are supported. You can set the password of the compressed package.-hp123456 indicates that the password is set to 123456.

Backup. lst

D: \ Config
D: \ MDaemon
D: \ Community
D: \ Io
D: \ Portal

Exclude. lst

* . PDB

The last step is to start related services. Because the dependent services cannot be started, more services are required than the Disabled Services.

Comments:
Advantages: it is easy to use the combination of task plan, RAR and bat. The backup data is comprehensive.
Disadvantage: to suspend the database, the website may be unavailable for about 10 minutes, affecting the user's use.

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.