赛捷软件论坛's Archiver

stone 发表于 2011-12-8 00:38

编写脚本自动备份SQL数据库

<P>问题:<BR>SQL 2008 Express版本不能自动备份怎么办?</P><P>解决方案:<BR>通过Windows的计划去实现SQL的备份,做成Backup.BAT文件被调用即可。代码如下:</P><P>echo ------------------------------ &gt;&gt;C:&#92;backup.log</P><P>echo Backup Start at %date% %time% &gt;&gt;C:&#92;backup.log</P><P>reg add "HKEY_CURRENT_USER&#92;Control Panel&#92;International" /v sShortDate /t REG_SZ /d yyyyMMdd /f&gt;nul</P><P>NET USE Z: /DELETE /Y</P><P>NET USE Z: <A target=_blank href="file://&#92;&#92;192.168.0.237&#92;ACCPAC_bak">&#92;&#92;192.168.0.237&#92;ACCPAC_bak</A> /PERSISTENT:YES</P><P>net stop "SQL Server (SQLEXPRESS)" &gt;&gt;C:&#92;backup.log</P><P>md "Z:&#92;%date%" &gt;&gt;C:&#92;backup.log</P><P>xcopy C:&#92;ACCPAC_SQL_DATA "Z:&#92;%date%" /e /y /r &gt;&gt;C:&#92;backup.log</P><P>net start "SQL Server (SQLEXPRESS)" &gt;&gt;C:&#92;backup.log</P><P>echo Backup End at %date% %time% &gt;&gt;C:&#92;backup.log</P><P>echo ------------------------------ &gt;&gt;C:&#92;backup.log</P><P>del Z:&#92;backup.log /f</P><P>copy C:&#92;backup.log Z:&#92;backup.log<BR></P>

ezjjc 发表于 2012-3-6 17:01

非常高兴遇到这么好的帖子 谢谢











[img]http://www.discuz.net/static/image/common/sigline.gif[/img]
[size=2][url=http://zhuishu.com/Shu/Book/24/24305/]萌娘三国演义[/url]http://zhuishu.com/Shu/Book/24/24305/[/size]

www.ladyzh.com 发表于 2012-3-13 18:47

好多啊,哈哈,谢谢您











[img]http://www.discuz.net/static/image/common/sigline.gif[/img]
[size=2]

[url=http://www.xifan5.com]淘宝网购物[/url] [url=http://www.xifan5.com]时尚女装[/url] [url=http://www.xifan5.com]韩版女装[/url] [url=http://www.ttzhan.com]网络营销[/url]   [url=http://wenda.baidf.com]肿瘤知识[/url] [url=http://www.admin81.com]站长工具[/url]   [url=http://bbs.ttzhan.com]站长论坛[/url]  [url=http://www.ladyzh.com]男人装[/url]  [url=http://www.ladyzh.com]女人装[/url] [/size]

页: [1]

Powered by Discuz! Archiver 7.2  © 2001-2009 Comsenz Inc.