Home > Database > Mysql Tutorial > 利用WinRar命令行定时自动备份Sql2005数据库

利用WinRar命令行定时自动备份Sql2005数据库

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-06-07 17:22:47
Original
1079 people have browsed it

利用WinRar命令行定时自动备份Sql2005数据库批处理

利用WinRar命令行定时自动备份Sql2005数据库批处理如下:
 
@echo off
net stop "SQL Server (MSSQLSERVER)"
cd C:\progra~1\winrar
 C:\progra~1\winrar\winrar.exe a -ag -k -r -s -ibck -inul "E:\sql server\bak\SQL.rar" "E:\sql server\feifei"
 net start "SQL Server (MSSQLSERVER)"
exit

将代码保存为批处理.
 设置系统计划任务,定时运行这个批处理,这样即可达到定时备份sql数据库目的;
 
/*---------------参数说明-------------------*/
 net stop "SQL Server (MSSQLSERVER)"
关闭SQL2005系统服务
 cd C:\progra~1\winrar:Winrar安装目录;
 winrar.exe:运行winrar;
 a :备份所有文件;
 -ag :当创建压缩文件时,,以格式“YYYYMMDDHHMMSS”附加当前日期字符串,文件名SQL2010-11-03.rar;
 -k :锁定压缩文件;
 -s :创建固实压缩文件;
 -ibck :后台运行;
 -inul :禁用错误提示,避免无法压缩数据库文件时,不执行后续的数据库服务的开启;
 E:\sql server\bak\SQL.rar: 备份的路径和基本名称(-ag参数会自动在SQL后加上系统当前时间);
 E:\sql server\feifei: 要备份的文件目录;
 net start "SQL Server (MSSQLSERVER)":开启sql服务;
 /*---------------说明结束-------------------*/

linux

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template