一、数据备份
备份有两中形式完全备份和差异备份
完全备份:是对数据库进行完整备份,周期比较长,如1周等
差异备份:是对更新备份的数据进行备份,周期比较短,如1小时
命令介绍: backup database [数据库名] to disk=[保存路径和名称] with [其他属性]
代码注释:serverip :sqlserver所在机器的 ip
jtsg:sqlserver中数据的名称
public cn as adodb.connection
set cn = new adodb.connection
strcon = "provider=sqloledb.1;password=sa;persist security info=true;user id=sa;initial catalog=jtsg;data source=" + serverip + ";" + _
"use procedure for prepare=1;auto translate=true;" + _
"use encryption for data=false;tag with column collation when possible=false"
cn.connectionstring = strcon
on error resume next
cn.open
if cn.errors.count > 0 then
for i = 0 to cn.errors.count - 1
if cn.errors(i).number = -2147467259 then
msgbox "网络不通或服务器未开,请确认后再试", vbokonly + vbinformation, "提醒"
unload me
exit sub
exit for
end if
next i
end if
private sub backupall()
cn.execute "backup database jtsg to disk='" + app.path + "\backup\myjtsgall.bak' with name='jtsg backup all',description='full backup of jtsg'"
msgbox "数据完全备份已经完成", vbokonly + vbinformation, "提醒"
end sub
private sub backupdif()
cn.execute "backup database jtsg to disk='" + app.path + "\backup\myjtsgdif.bak' with differential ,noinit,name='jtsg backup dif',description='differential backup of jtsg'"
msgbox "数据差异备份已经完成", vbokonly + vbinformation, "提醒"
end sub
private sub restoredata()
cn.execute "restore database jtsg from disk='" + app.path + "\backup\myjtsgall.bak' with file=1"
msgbox "数据恢复已经完成", vbokonly + vbinformation, "提醒"
end sub
Java Asp PHP .Net XML C/C++ CGI VB Jsp J2ee J2se J2me EJB Servlet Tomcat Resin Struts Weblogic Eclipse ANT GUI JMS Web servise IDEA Webphere Hibernate Spring Jboss Applet Swing Socket Javamail Perl Ajax P2P 安全 模式 框架 测试 开源 游戏
Windows XP Windows 2000 Windows 2003 Windows Me Windows 9.x Linux UNIX 注册表 操作系统 服务器 应用服务器