最近做的一个项目因为服务器是在特殊机房上的,因为安全方面的考虑,不能给我们开发者提供FTP服务,所以每次更新版本都得自己跑一趟,而他的机房有很远,所以我一直想能不能开发一个维护版本的系统呢,对数据库和代码进行在线更新,就不用自己跑了,于是就有了下面的尝试,在线恢复和备份SQL Server:
前台代码:
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="SqlDbMgmt.aspx.cs" Inherits="SysSourceMgmt.SqlDbMgmt" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "<http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd>">
<html xmlns="<http://www.w3.org/1999/xhtml>">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
<table>
<tr>
<td style="width: 100px">
<span style="font-size: 9pt">操 作 数 据 库</span>
</td>
<td>
<asp:DropDownList ID="DropDownList1" runat="server" Font-Size="9pt" Width="124px">
</asp:DropDownList>
<asp:TextBox ID="txtDbName" runat="server"></asp:TextBox>
</td>
<td style="width: 100px">
</td>
</tr>
<tr>
<td style="width: 100px">
<span style="font-size: 9pt">备份名称和位置</span>
</td>
<td style="width: 100px">
<asp:TextBox ID="TextBox1" runat="server" Font-Size="9pt" Width="117px"></asp:TextBox>
</td>
<td style="width: 100px">
<span style="font-size: 9pt; color: #ff3300">(如D:\beifen)</span>
</td>
</tr>
<tr>
<td colspan="3">
<asp:Button ID="Button1" runat="server" Font-Size="9pt" OnClick="Button1_Click" Text="备份数据库" />
</td>
</tr>
</table>
</div>
<div style="width: 100%; height: 100px">
<table>
<tr>
<td style="width: 100px; height: 21px">
<span style="font-size: 9pt">操 作 数 据 库</span>
</td>
<td>
<asp:DropDownList ID="DropDownList2" runat="server" Font-Size="9pt" Width="124px">
</asp:DropDownList>
</td>
<td style="width: 100px; height: 21px">
</td>
</tr>
<tr>
<td style="width: 100px">
<span style="font-size: 9pt">操 作 数 据 库</span>
</td>
<td style="width: 100px">
<asp:FileUpload ID="FileUpload1" runat="server" Font-Size="9pt" Width="190px" />
</td>
<td style="width: 100px">
</td>
</tr>
<tr>
<td colspan="3">
<asp:Button ID="Button2" runat="server" Font-Size="9pt" OnClick="Button2_Click" Text="还原数据库" />
<asp:Button ID="Button3" runat="server" Font-Size="9pt" OnClick="Button3_Click" Text="强制还原数据库" />
</td>
</tr>
</table>
</div>
</form>
</body>
</html>