ASP实现SQL备份、恢复
1、备份
<%
SQL="backup database 数据库名 to disk='"&Server.MapPath("backup")&"\\"&"backuptext.dat"&"'"
set cnn=Server.createobject("adodb.connection")
cnn.open "driver={SQL Server};Server=服务器名;uid=sa;pwd="
cnn.execute SQL
on error resume next
if err<>0 then
response.write "错误:"&err.Descripting
else
response.write "数据备份成功!"
end if
%>绿色c hinaip ower. comAYrCJ6B
2、恢复
<%
SQL="Restore database 数据库名 from disk='"&Server.MapPath("backup")&"\\"&"backuptext.dat"&"'"
set cnn=Server.createobject("adodb.connection")
cnn.open "driver={SQL Server};Server=服务器名;uid=sa;pwd="
cnn.execute SQL
on error resume next
if err<>0 then
response.write "错误:"&err.Descripting
else
response.write "数据恢复成功!"
end if
%>
<%
SQL="backup database 数据库名 to disk='"&Server.MapPath("backup")&"\\"&"backuptext.dat"&"'"
set cnn=Server.createobject("adodb.connection")
cnn.open "driver={SQL Server};Server=服务器名;uid=sa;pwd="
cnn.execute SQL
on error resume next
if err<>0 then
response.write "错误:"&err.Descripting
else
response.write "数据备份成功!"
end if
%>绿色c hinaip ower. comAYrCJ6B
2、恢复
<%
SQL="Restore database 数据库名 from disk='"&Server.MapPath("backup")&"\\"&"backuptext.dat"&"'"
set cnn=Server.createobject("adodb.connection")
cnn.open "driver={SQL Server};Server=服务器名;uid=sa;pwd="
cnn.execute SQL
on error resume next
if err<>0 then
response.write "错误:"&err.Descripting
else
response.write "数据恢复成功!"
end if
%>
相关推荐
xwb 2020-07-19
Ida 2020-06-17
projava 2020-11-14
URML 2020-11-11
sushuanglei 2020-11-12
huolan 2020-06-25
LeoHan 2020-06-13
@server=‘LinkServer‘, --链接服务器别名。@datasrc=‘192.168.1.1‘ --要访问的的数据库所在的服务器的ip. ‘******‘ --要访问的数据库,用户的密码
zhangwentaohh 2020-06-01
bluet00 2020-05-10
书弋江山 2020-04-19
wxthillwill 2020-04-09
fengdos 2020-04-08
步行者 2020-03-26
hxw0 2020-03-06
点滴技术生活 2020-02-22
86211943 2019-12-20
末点 2020-01-12
gaozhennan 2020-01-12