采飛揚(yáng)ASP備份MSSQL數(shù)據(jù)庫(kù)程序 V1.0
[重要通告]如您遇疑難雜癥,本站支持知識(shí)付費(fèi)業(yè)務(wù),掃右邊二維碼加博主微信,可節(jié)省您寶貴時(shí)間哦!
采飛揚(yáng)ASP備份MSSQL數(shù)據(jù)庫(kù)程序 V1.0
XML/HTML代碼
- <%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
- <!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>
- <meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
- <title>采飛揚(yáng)ASP備份MSSQL數(shù)據(jù)庫(kù)程序 V1.0--QQ:79998575</title>
- </head>
- <style>
- BODY { FONT-SIZE: 9pt; COLOR: #000000; FONT-FAMILY: "Courier New"; scrollbar-face-color:#E4E4F3; scrollbar-highlight-color:#FFFFFF; scrollbar-3dlight-color:#E4E4F3; scrollbar-darkshadow-color:#9C9CD3; scrollbar-shadow-color:#E4E4F3; scrollbar-arrow-color:#4444B3; scrollbar-track-color:#EFEFEF;}TABLE { FONT-SIZE: 9pt; FONT-FAMILY: "Courier New"; BORDER-COLLAPSE: collapse; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-style: solid; border-right-style: none; border-bottom-style: none; border-left-style: solid; border-top-color: #d8d8f0; border-right-color: #d8d8f0; border-bottom-color: #d8d8f0; border-left-color: #d8d8f0;}.tr { font-family: "Courier New"; font-size: 9pt; background-color: #e4e4f3; text-align: center;}.td { font-family: "Courier New"; font-size: 9pt; background-color: #f9f9fd;}.warningColor { font-family: "Courier New"; font-size: 9pt; color: #ff0000;}input {
- font-family: "Courier New";
- BORDER-TOP-WIDTH: 1px;
- BORDER-LEFT-WIDTH: 1px;
- FONT-SIZE: 12px;
- BORDER-BOTTOM-WIDTH: 1px;
- BORDER-RIGHT-WIDTH: 1px;
- color: #000000;
- }textarea { font-family: "Courier New"; BORDER-TOP-WIDTH: 1px; BORDER-LEFT-WIDTH: 1px; FONT-SIZE: 12px; BORDER-BOTTOM-WIDTH: 1px; BORDER-RIGHT-WIDTH: 1px; color: #000000;}.liuyes {
- background-color: #CCCCFF;
- }
- A:link { FONT-SIZE: 9pt; COLOR: #000000; FONT-FAMILY: "Courier New"; TEXT-DECORATION: none;}tr { font-family: "Courier New"; font-size: 9pt; line-height: 18px;}td { font-family: "Courier New"; font-size: 9pt; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-style: none; border-right-style: solid; border-bottom-style: solid; border-left-style: none; border-top-color: #d8d8f0; border-right-color: #d8d8f0; border-bottom-color: #d8d8f0; border-left-color: #d8d8f0;}.trHead { font-family: "Courier New"; font-size: 9pt; background-color: #e4e4f3; line-height: 3px;}.inputLogin { font-family: "Courier New"; font-size: 9pt; border: 1px solid #d8d8f0; background-color: #f9f9fd; vertical-align: bottom;}</style>
- <body>
- <form method="post" name="myform" action="?action=backupdatabase">
- <table width="686" border="1" align="center">
- <tr>
- <td width="613" height="30" align="center" bgcolor="#330066"><font color="#FFFFFF">采飛揚(yáng)ASP備份MSSQL數(shù)據(jù)庫(kù)程序 V1.0 </font></td>
- </tr>
- <tr>
- <td>選擇操作:
- <input type="radio" name="act" id="act_backup"value="backup" />
- <label for=act_backup>備份</label>
- <input type="radio" name="act" id="act_restore" value="restore" />
- <label for=act_restore>恢復(fù)</label></td>
- </tr>
- <tr>
- <td><label>SQL服務(wù)器:
- <input type="text" name="sqlserver" value="localhost" />
- </label></td>
- </tr>
- <tr>
- <td><label>用戶名:
- <input name="sqlname" type="text" value="sa" />
- 密 碼:
- <input type="text" name="sqlpassword" />
- </label></td>
- </tr>
- <tr>
- <td><label>數(shù)據(jù)庫(kù)名:
- <input type="text" name="databasename" value="<%=request("databasename")%>" />
- </label></td>
- </tr>
- <tr>
- <td>文件路徑:
- <input name="bak_file" type="text" value="<% =server.MapPath("\")&"\"&"jzpu.bak"%>" size="60" />
- (備份或恢復(fù)的文件路徑)</td>
- </tr>
- <tr>
- <td><% Response.write "本文件絕對(duì)路徑:" %>
- <font color="#FF0000">
- <% =server.mappath(Request.ServerVariables("SCRIPT_NAME")) %>
- </font></td>
- </tr>
- <tr>
- <td><input name=submit1 type="submit" class="liuyes" id=submit1 size="10" value="確 定" />
- <input name="Submit" type="reset" class="liuyes" size="10" value="重 置" /></td>
- </tr>
- </table>
- </form>
- <table width="686" border="1" align="center">
- <tr>
- <td>提示信息:<%
- if request("action")="" then
- response.write "<font color=#ff0000>不用我多說什么了吧!</font>"
- end if
- 'SQL Server 數(shù)據(jù)庫(kù)的備份與恢復(fù)!
- if request("action")="backupdatabase" Then
- dim sqlserver,sqlname,sqlpassword,sqlLoginTimeout,databasename,bak_file,act
- sqlserver = trim(request("sqlserver"))
- sqlname = trim(request("sqlname"))
- sqlpassword =trim(request("sqlpassword"))
- sqlLoginTimeout = 15
- databasename = trim(request("databasename"))
- bak_file = trim(request("bak_file"))
- bak_file = replace(bak_file,"$1",databasename)
- act = lcase(request("act"))
- if databasename = "" then
- response.write "<font color=#ff0000>沒有輸入數(shù)據(jù)庫(kù)名稱!</font>"
- else
- if act = "backup" then
- Set srv=Server.CreateObject("SQLDMO.SQLServer")
- srv.LoginTimeout = sqlLoginTimeout
- srv.Connect sqlserver,sqlname, sqlpassword
- Set bak = Server.CreateObject("SQLDMO.Backup")
- bak.Database=databasename
- bak.Devices=Files
- bak.Action = 0
- bak.Initialize = 1
- 'bak.Replace = True
- bak.Files=bak_file
- bak.SQLBackup srv
- if err.number>0 then
- response.write err.number&"<font color=red><br>"
- response.write err.description&"</font>"
- end if
- Response.write "<font color=green>備份成功!</font>"
- elseif act="restore" then
- '恢復(fù)時(shí)要在沒有使用數(shù)據(jù)庫(kù)時(shí)進(jìn)行!
- Set srv=Server.CreateObject("SQLDMO.SQLServer")
- srv.LoginTimeout = sqlLoginTimeout
- srv.Connect sqlserver,sqlname, sqlpassword
- Set rest=Server.CreateObject("SQLDMO.Restore")
- rest.Action=0 ' full db restore
- rest.Database=databasename
- rest.Devices=Files
- rest.Files=bak_file
- rest.ReplaceDatabase=True 'Force restore over existing database
- if err.number>0 then
- response.write err.number&"<font color=red><br>"
- response.write err.description&"</font>"
- end if
- rest.SQLRestore srv
- Response.write "<font color=green>恢復(fù)成功!</font>"
- else
- Response.write "<font color=red>請(qǐng)選擇備份或恢復(fù)!</font>"
- end if
- end if
- end if
- %></td>
- </tr>
- </table>
- </body>
- </html>
問題未解決?付費(fèi)解決問題加Q或微信 2589053300 (即Q號(hào)又微信號(hào))右上方掃一掃可加博主微信
所寫所說,是心之所感,思之所悟,行之所得;文當(dāng)無敷衍,落筆求簡(jiǎn)潔。 以所舍,求所獲;有所依,方所成!
賞
支付寶贊助
微信贊助
免責(zé)聲明,若由于商用引起版權(quán)糾紛,一切責(zé)任均由使用者承擔(dān)。
您必須遵守我們的協(xié)議,如您下載該資源,行為將被視為對(duì)《免責(zé)聲明》全部?jī)?nèi)容的認(rèn)可->聯(lián)系老梁投訴資源 LaoLiang.Net部分資源來自互聯(lián)網(wǎng)收集,僅供用于學(xué)習(xí)和交流,請(qǐng)勿用于商業(yè)用途。如有侵權(quán)、不妥之處,請(qǐng)聯(lián)系站長(zhǎng)并出示版權(quán)證明以便刪除。
敬請(qǐng)諒解! 侵權(quán)刪帖/違法舉報(bào)/投稿等事物聯(lián)系郵箱:service@laoliang.net
意在交流學(xué)習(xí),歡迎贊賞評(píng)論,如有謬誤,請(qǐng)聯(lián)系指正;轉(zhuǎn)載請(qǐng)注明出處: » 采飛揚(yáng)ASP備份MSSQL數(shù)據(jù)庫(kù)程序 V1.0