6 个解决方案
#1
不知道运行SQLSEVER的BACKUP命令是否有用,在ASP页面是运行一个数据库的命令,命令字符串内容写上BACKUP命令。就是Conn.Execute .....
执行的字符串就是BACKUP命令,这样试试吧,我不确定有用。
下面是SQLSERVER关于备份命令的帮助,压缩和恢复就不贴了,看一下帮助吧。
备份整个数据库、事务日志,或者备份一个或多个文件或文件组。有关数据库备份和恢复操作的更多信息,请参见备份和还原数据库。
语法
备份整个数据库:
BACKUP DATABASE { database_name | @database_name_var }
TO < backup_device > [ ,...n ]
[ WITH
[ BLOCKSIZE = { blocksize | @blocksize_variable } ]
[ [ , ] DESCRIPTION = { 'text' | @text_variable } ]
[ [ , ] DIFFERENTIAL ]
[ [ , ] EXPIREDATE = { date | @date_var }
| RETAINDAYS = { days | @days_var } ]
[ [ , ] PASSWORD = { password | @password_variable } ]
[ [ , ] FORMAT | NOFORMAT ]
[ [ , ] { INIT | NOINIT } ]
[ [ , ] MEDIADESCRIPTION = { 'text' | @text_variable } ]
[ [ , ] MEDIANAME = { media_name | @media_name_variable } ]
[ [ , ] MEDIAPASSWORD = { mediapassword | @mediapassword_variable } ]
[ [ , ] NAME = { backup_set_name | @backup_set_name_var } ]
[ [ , ] { NOSKIP | SKIP } ]
[ [ , ] { NOREWIND | REWIND } ]
[ [ , ] { NOUNLOAD | UNLOAD } ]
[ [ , ] RESTART ]
[ [ , ] STATS [ = percentage ] ]
]
执行的字符串就是BACKUP命令,这样试试吧,我不确定有用。
下面是SQLSERVER关于备份命令的帮助,压缩和恢复就不贴了,看一下帮助吧。
备份整个数据库、事务日志,或者备份一个或多个文件或文件组。有关数据库备份和恢复操作的更多信息,请参见备份和还原数据库。
语法
备份整个数据库:
BACKUP DATABASE { database_name | @database_name_var }
TO < backup_device > [ ,...n ]
[ WITH
[ BLOCKSIZE = { blocksize | @blocksize_variable } ]
[ [ , ] DESCRIPTION = { 'text' | @text_variable } ]
[ [ , ] DIFFERENTIAL ]
[ [ , ] EXPIREDATE = { date | @date_var }
| RETAINDAYS = { days | @days_var } ]
[ [ , ] PASSWORD = { password | @password_variable } ]
[ [ , ] FORMAT | NOFORMAT ]
[ [ , ] { INIT | NOINIT } ]
[ [ , ] MEDIADESCRIPTION = { 'text' | @text_variable } ]
[ [ , ] MEDIANAME = { media_name | @media_name_variable } ]
[ [ , ] MEDIAPASSWORD = { mediapassword | @mediapassword_variable } ]
[ [ , ] NAME = { backup_set_name | @backup_set_name_var } ]
[ [ , ] { NOSKIP | SKIP } ]
[ [ , ] { NOREWIND | REWIND } ]
[ [ , ] { NOUNLOAD | UNLOAD } ]
[ [ , ] RESTART ]
[ [ , ] STATS [ = percentage ] ]
]
#2
备份SQLServer数据库:
<%
if request.form("post")=1 then
dim msvr,muid,mpwd,mdb,mto
msvr=Request.Form("txtsvr")
muid=Request.Form("txtuid")
mpwd=Request.Form("txtpwd")
mdb=Request.Form("txtdb")
mto=Request.Form("txtto")
if mpwd="" then mpwd="''"
on error resume next
set dmosvr=server.CreateObject("SQLDMO.SQLServer")
dmosvr.connect msvr,muid,mpwd
if err.number>0 then Response.Redirect("http:sqlbk_err.asp?err="&err.number)
mdevname="Backup_"&muid&"_"&mdb
set dmodev=server.CreateObject("SQLDMO.BackupDevice")
dmodev.name=mdevname
dmodev.type=2
dmodev.PhysicalLocation=mto
dmosvr.BackupDevices.Add dmodev
if err.number>0 then Response.Redirect("http:sqlbk_err.asp?err="&err.number)
set dmobak=server.CreateObject("SQLDMO.Backup")
dmobak.database=mdb
dmobak.devices=mdevname
%>
<HTML>
<HEAD>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
</HEAD>
<body>
<p align="center"><strong>开始备份数据库:<%=mdb%></strong></p>
<%
dmobak.sqlbackup dmosvr
if err.number>0 then Response.Redirect("http:sqlbk_err.asp?err="&err.number)
dmosvr.backupdevices(mdevname).remove
set dmobak=nothing
set dmodev=nothing
dmosvr.disconnect
set dmosvr=nothing
%>
<p align="center"><strong>数据库: '<%=mdb%>' 备份成功!</strong></p>
</BODY>
</HTML>
<%response.end
end if%>
<TABLE>
<FORM METHOD=POST ACTION="">
<input type=hidden value="1" name="post">
<TR>
<TD>服务器地址:</TD>
<TD><INPUT TYPE="text" NAME="txtsvr"></TD>
</TR>
<TR>
<TD>用户名:</TD>
<TD><INPUT TYPE="text" NAME="txtuid"></TD>
</TR>
<TR>
<TD>密码:</TD>
<TD><INPUT TYPE="password" NAME="txtpwd"></TD>
</TR>
<TR>
<TD>数据库:</TD>
<TD><INPUT TYPE="text" NAME="txtdb"></TD>
</TR>
<TR>
<TD>备份文件存放地址:</TD>
<TD><INPUT TYPE="text" NAME="txtto"></TD>
</TR>
<TR>
<TD colspan=2 align=center><INPUT TYPE="submit" value="备份数据库"></TD>
</TR>
</FORM></TABLE>
<%
if request.form("post")=1 then
dim msvr,muid,mpwd,mdb,mto
msvr=Request.Form("txtsvr")
muid=Request.Form("txtuid")
mpwd=Request.Form("txtpwd")
mdb=Request.Form("txtdb")
mto=Request.Form("txtto")
if mpwd="" then mpwd="''"
on error resume next
set dmosvr=server.CreateObject("SQLDMO.SQLServer")
dmosvr.connect msvr,muid,mpwd
if err.number>0 then Response.Redirect("http:sqlbk_err.asp?err="&err.number)
mdevname="Backup_"&muid&"_"&mdb
set dmodev=server.CreateObject("SQLDMO.BackupDevice")
dmodev.name=mdevname
dmodev.type=2
dmodev.PhysicalLocation=mto
dmosvr.BackupDevices.Add dmodev
if err.number>0 then Response.Redirect("http:sqlbk_err.asp?err="&err.number)
set dmobak=server.CreateObject("SQLDMO.Backup")
dmobak.database=mdb
dmobak.devices=mdevname
%>
<HTML>
<HEAD>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
</HEAD>
<body>
<p align="center"><strong>开始备份数据库:<%=mdb%></strong></p>
<%
dmobak.sqlbackup dmosvr
if err.number>0 then Response.Redirect("http:sqlbk_err.asp?err="&err.number)
dmosvr.backupdevices(mdevname).remove
set dmobak=nothing
set dmodev=nothing
dmosvr.disconnect
set dmosvr=nothing
%>
<p align="center"><strong>数据库: '<%=mdb%>' 备份成功!</strong></p>
</BODY>
</HTML>
<%response.end
end if%>
<TABLE>
<FORM METHOD=POST ACTION="">
<input type=hidden value="1" name="post">
<TR>
<TD>服务器地址:</TD>
<TD><INPUT TYPE="text" NAME="txtsvr"></TD>
</TR>
<TR>
<TD>用户名:</TD>
<TD><INPUT TYPE="text" NAME="txtuid"></TD>
</TR>
<TR>
<TD>密码:</TD>
<TD><INPUT TYPE="password" NAME="txtpwd"></TD>
</TR>
<TR>
<TD>数据库:</TD>
<TD><INPUT TYPE="text" NAME="txtdb"></TD>
</TR>
<TR>
<TD>备份文件存放地址:</TD>
<TD><INPUT TYPE="text" NAME="txtto"></TD>
</TR>
<TR>
<TD colspan=2 align=center><INPUT TYPE="submit" value="备份数据库"></TD>
</TR>
</FORM></TABLE>
#3
备份可以用,其他的没有用过
#4
去下个动网的例子好好研究把,他的很全.
#5
最好是写存储过程
然后用ASP调用就好了~~
那样就简单多了
然后用ASP调用就好了~~
那样就简单多了
#6
右击要备份的数据库,选择“所有任务”,选择备份数据库,选择参数后确定。
没做过压缩
没做过压缩
#1
不知道运行SQLSEVER的BACKUP命令是否有用,在ASP页面是运行一个数据库的命令,命令字符串内容写上BACKUP命令。就是Conn.Execute .....
执行的字符串就是BACKUP命令,这样试试吧,我不确定有用。
下面是SQLSERVER关于备份命令的帮助,压缩和恢复就不贴了,看一下帮助吧。
备份整个数据库、事务日志,或者备份一个或多个文件或文件组。有关数据库备份和恢复操作的更多信息,请参见备份和还原数据库。
语法
备份整个数据库:
BACKUP DATABASE { database_name | @database_name_var }
TO < backup_device > [ ,...n ]
[ WITH
[ BLOCKSIZE = { blocksize | @blocksize_variable } ]
[ [ , ] DESCRIPTION = { 'text' | @text_variable } ]
[ [ , ] DIFFERENTIAL ]
[ [ , ] EXPIREDATE = { date | @date_var }
| RETAINDAYS = { days | @days_var } ]
[ [ , ] PASSWORD = { password | @password_variable } ]
[ [ , ] FORMAT | NOFORMAT ]
[ [ , ] { INIT | NOINIT } ]
[ [ , ] MEDIADESCRIPTION = { 'text' | @text_variable } ]
[ [ , ] MEDIANAME = { media_name | @media_name_variable } ]
[ [ , ] MEDIAPASSWORD = { mediapassword | @mediapassword_variable } ]
[ [ , ] NAME = { backup_set_name | @backup_set_name_var } ]
[ [ , ] { NOSKIP | SKIP } ]
[ [ , ] { NOREWIND | REWIND } ]
[ [ , ] { NOUNLOAD | UNLOAD } ]
[ [ , ] RESTART ]
[ [ , ] STATS [ = percentage ] ]
]
执行的字符串就是BACKUP命令,这样试试吧,我不确定有用。
下面是SQLSERVER关于备份命令的帮助,压缩和恢复就不贴了,看一下帮助吧。
备份整个数据库、事务日志,或者备份一个或多个文件或文件组。有关数据库备份和恢复操作的更多信息,请参见备份和还原数据库。
语法
备份整个数据库:
BACKUP DATABASE { database_name | @database_name_var }
TO < backup_device > [ ,...n ]
[ WITH
[ BLOCKSIZE = { blocksize | @blocksize_variable } ]
[ [ , ] DESCRIPTION = { 'text' | @text_variable } ]
[ [ , ] DIFFERENTIAL ]
[ [ , ] EXPIREDATE = { date | @date_var }
| RETAINDAYS = { days | @days_var } ]
[ [ , ] PASSWORD = { password | @password_variable } ]
[ [ , ] FORMAT | NOFORMAT ]
[ [ , ] { INIT | NOINIT } ]
[ [ , ] MEDIADESCRIPTION = { 'text' | @text_variable } ]
[ [ , ] MEDIANAME = { media_name | @media_name_variable } ]
[ [ , ] MEDIAPASSWORD = { mediapassword | @mediapassword_variable } ]
[ [ , ] NAME = { backup_set_name | @backup_set_name_var } ]
[ [ , ] { NOSKIP | SKIP } ]
[ [ , ] { NOREWIND | REWIND } ]
[ [ , ] { NOUNLOAD | UNLOAD } ]
[ [ , ] RESTART ]
[ [ , ] STATS [ = percentage ] ]
]
#2
备份SQLServer数据库:
<%
if request.form("post")=1 then
dim msvr,muid,mpwd,mdb,mto
msvr=Request.Form("txtsvr")
muid=Request.Form("txtuid")
mpwd=Request.Form("txtpwd")
mdb=Request.Form("txtdb")
mto=Request.Form("txtto")
if mpwd="" then mpwd="''"
on error resume next
set dmosvr=server.CreateObject("SQLDMO.SQLServer")
dmosvr.connect msvr,muid,mpwd
if err.number>0 then Response.Redirect("http:sqlbk_err.asp?err="&err.number)
mdevname="Backup_"&muid&"_"&mdb
set dmodev=server.CreateObject("SQLDMO.BackupDevice")
dmodev.name=mdevname
dmodev.type=2
dmodev.PhysicalLocation=mto
dmosvr.BackupDevices.Add dmodev
if err.number>0 then Response.Redirect("http:sqlbk_err.asp?err="&err.number)
set dmobak=server.CreateObject("SQLDMO.Backup")
dmobak.database=mdb
dmobak.devices=mdevname
%>
<HTML>
<HEAD>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
</HEAD>
<body>
<p align="center"><strong>开始备份数据库:<%=mdb%></strong></p>
<%
dmobak.sqlbackup dmosvr
if err.number>0 then Response.Redirect("http:sqlbk_err.asp?err="&err.number)
dmosvr.backupdevices(mdevname).remove
set dmobak=nothing
set dmodev=nothing
dmosvr.disconnect
set dmosvr=nothing
%>
<p align="center"><strong>数据库: '<%=mdb%>' 备份成功!</strong></p>
</BODY>
</HTML>
<%response.end
end if%>
<TABLE>
<FORM METHOD=POST ACTION="">
<input type=hidden value="1" name="post">
<TR>
<TD>服务器地址:</TD>
<TD><INPUT TYPE="text" NAME="txtsvr"></TD>
</TR>
<TR>
<TD>用户名:</TD>
<TD><INPUT TYPE="text" NAME="txtuid"></TD>
</TR>
<TR>
<TD>密码:</TD>
<TD><INPUT TYPE="password" NAME="txtpwd"></TD>
</TR>
<TR>
<TD>数据库:</TD>
<TD><INPUT TYPE="text" NAME="txtdb"></TD>
</TR>
<TR>
<TD>备份文件存放地址:</TD>
<TD><INPUT TYPE="text" NAME="txtto"></TD>
</TR>
<TR>
<TD colspan=2 align=center><INPUT TYPE="submit" value="备份数据库"></TD>
</TR>
</FORM></TABLE>
<%
if request.form("post")=1 then
dim msvr,muid,mpwd,mdb,mto
msvr=Request.Form("txtsvr")
muid=Request.Form("txtuid")
mpwd=Request.Form("txtpwd")
mdb=Request.Form("txtdb")
mto=Request.Form("txtto")
if mpwd="" then mpwd="''"
on error resume next
set dmosvr=server.CreateObject("SQLDMO.SQLServer")
dmosvr.connect msvr,muid,mpwd
if err.number>0 then Response.Redirect("http:sqlbk_err.asp?err="&err.number)
mdevname="Backup_"&muid&"_"&mdb
set dmodev=server.CreateObject("SQLDMO.BackupDevice")
dmodev.name=mdevname
dmodev.type=2
dmodev.PhysicalLocation=mto
dmosvr.BackupDevices.Add dmodev
if err.number>0 then Response.Redirect("http:sqlbk_err.asp?err="&err.number)
set dmobak=server.CreateObject("SQLDMO.Backup")
dmobak.database=mdb
dmobak.devices=mdevname
%>
<HTML>
<HEAD>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
</HEAD>
<body>
<p align="center"><strong>开始备份数据库:<%=mdb%></strong></p>
<%
dmobak.sqlbackup dmosvr
if err.number>0 then Response.Redirect("http:sqlbk_err.asp?err="&err.number)
dmosvr.backupdevices(mdevname).remove
set dmobak=nothing
set dmodev=nothing
dmosvr.disconnect
set dmosvr=nothing
%>
<p align="center"><strong>数据库: '<%=mdb%>' 备份成功!</strong></p>
</BODY>
</HTML>
<%response.end
end if%>
<TABLE>
<FORM METHOD=POST ACTION="">
<input type=hidden value="1" name="post">
<TR>
<TD>服务器地址:</TD>
<TD><INPUT TYPE="text" NAME="txtsvr"></TD>
</TR>
<TR>
<TD>用户名:</TD>
<TD><INPUT TYPE="text" NAME="txtuid"></TD>
</TR>
<TR>
<TD>密码:</TD>
<TD><INPUT TYPE="password" NAME="txtpwd"></TD>
</TR>
<TR>
<TD>数据库:</TD>
<TD><INPUT TYPE="text" NAME="txtdb"></TD>
</TR>
<TR>
<TD>备份文件存放地址:</TD>
<TD><INPUT TYPE="text" NAME="txtto"></TD>
</TR>
<TR>
<TD colspan=2 align=center><INPUT TYPE="submit" value="备份数据库"></TD>
</TR>
</FORM></TABLE>
#3
备份可以用,其他的没有用过
#4
去下个动网的例子好好研究把,他的很全.
#5
最好是写存储过程
然后用ASP调用就好了~~
那样就简单多了
然后用ASP调用就好了~~
那样就简单多了
#6
右击要备份的数据库,选择“所有任务”,选择备份数据库,选择参数后确定。
没做过压缩
没做过压缩