教您如何实现sybase自动备份

sybase自动备份的方法我们经常会用到,下面就为您详细介绍sybase自动备份的实现过程,希望对您学习sybase自动备份方面能有所帮助。

 
 
 
  1. Imports System.IO
  2. Module Module1
  3. Sub Main()
  4. Dim str_Path As String
  5. Dim str_FileName As String
  6. Dim str_Name As String
  7. Dim i As Integer, weeknum As Integer
  8. Dim f_file As System.IO.File
  9. Dim F_write As System.IO.StreamWriter
  10. Dim str_temp As String
  11. str_FileName = gbackupdump_data.txt
  12. If File.Exists(str_FileName) = True Then
  13. File.Delete(str_FileName)
  14. End If
  15. F_write = File.CreateText(str_FileName)
  16. F_write.WriteLine(use master)
  17. F_write.WriteLine(go)
  18. weeknum = Weekday(Now())
  19. '每隔一天转储的文件名相同
  20. Select Case weeknum
  21. Case 1, 2, 4, 6
  22. F_write.WriteLine(select getdate())
  23. F_write.WriteLine(go)
  24. F_write.WriteLine(dump database  bsjdw to 'g:\backup\dumpback\bsjdw_data0.dump')
  25. F_write.WriteLine(go)
  26. F_write.WriteLine(select getdate())
  27. F_write.WriteLine(go)
  28. F_write.WriteLine(dump database  system to 'g:\backup\dumpbacksystem_data0.dump')
  29. F_write.WriteLine(go)
  30. F_write.WriteLine(select getdate())
  31. F_write.WriteLine(go)
  32. Case 3, 5, 7
  33. F_write.WriteLine(select getdate())
  34. F_write.WriteLine(go)
  35. F_write.WriteLine(dump database  bsjdw to 'g:\backupdumpbackbsjdw_data1.dump')
  36. F_write.WriteLine(go)
  37. F_write.WriteLine(select getdate())
  38. F_write.WriteLine(go)
  39. F_write.WriteLine(dump database  system to 'gbackupdumpbacksystem_data1.dump')
  40. F_write.WriteLine(go)
  41. F_write.WriteLine(select getdate())
  42. F_write.WriteLine(go)
  43. End Select
  44. F_write.WriteLine(exit)
  45. F_write.Close()
  46. Dim ti As Date
  47. Dim te As Date
  48. ti = Now
  49. Dim logfilename As String
  50. logfilename = datafile + Trim(Str(Year(Now()))) + Trim(Str(Month(Now()))) + Trim(Str(Day(Now()))) + .txt
  51. Shell(cmd k isql -Usa -PSjb81! -i + str_FileName +gbackupdumpbackdumplog + logfilename, AppWinStyle.NormalFocus)
  52. te = Now
  53. Try
  54. Dim myProcesses() As Process
  55. Dim instance As Process
  56. Do
  57. myProcesses = Process.GetProcessesByName(cmd)
  58. Dim j As Integer
  59. j = 0
  60. For Each instance In myProcesses
  61. If instance.StartTime = ti And instance.StartTime = te Then
  62. j = 1
  63. End If
  64. Next
  65. If j = 0 Then
  66. Exit Do
  67. End If
  68. Loop
  69. myProcesses.Clear(myProcesses, 0, myProcesses.Length)
  70. Catch
  71. End Try
  72. Exit Sub
  73. End Sub
  74. End Module

当前题目:教您如何实现sybase自动备份
浏览路径:http://www.csdahua.cn/qtweb/news44/367794.html

网站建设、网络推广公司-快上网,是专注品牌与效果的网站制作,网络营销seo公司;服务项目有等

广告

声明:本网站发布的内容(图片、视频和文字)以用户投稿、用户转载内容为主,如果涉及侵权请尽快告知,我们将会在第一时间删除。文章观点不代表本网站立场,如需处理请联系客服。电话:028-86922220;邮箱:631063699@qq.com。内容未经允许不得转载,或转载时需注明来源: 快上网