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.