restore database jkxt from jkxt_bak with nonrecovery
关键定写错了呀nonrecovery应该是norecovery另外,你在恢复时还要用到sp_addumpdevice系统存储过程,具体用法请看SQL SERVER的在线帮助。

解决方案 »

  1.   

    你能不能用
    DMO
    很方便
    请参考SQL SERVER连机帮助
      

  2.   

    如 gmc007(江西的佬表) 所言..
      

  3.   

    我改过来了但现在出现的问题是:
    [Microsoft][ODBC SQL Server Driver][SQL Server]在sysdevices 中没有备份设备'jkxt_bak'的条目。请更新sysdevices后重新运行语句这是怎么回事啊???
    请大家告诉我一下
    谢谢
      

  4.   

    restore database xxx from disk='filename' with replace
      

  5.   

    backup database xxx to disk='filename' with init
      

  6.   

    关键定写错了
    nonrecovery改为norecovery
      

  7.   

    Dim cnn As ADODB.Connection
    Dim rs As ADODB.Recordset
    Dim sql As String
    Set cnn = New ADODB.Connection
    cnn.Open "Provider=MSDASQL.1;Persist Security Info=False;Data Source=jkxt"
    cnn.Execute " restore database jkxt from disk='d:\VB\监控系统\客户端\jkxt.bak'with replace"我现在已经将恢复代码改为上面的语句了(备份代码没有改动),但提示的错误是:
    [Microsoft][ODBC SQL Server Driver][SQL Server]因为数据库正在使用,所以未能获得对数据库的排他访问权。我该怎么 做能成功呢???请朋友们告诉我一下谢谢啊
      

  8.   

    1.在恢复数据库前要关闭所有与数据库的相关连接,包你的客户,服务器端程序,企业管理器,查询分析器等等。2.你的VB程序连接的数据库也不是能是要恢复的数据库,可以连接到其它的数据库如Master.即 "Provider=MSDASQL.1;Persist Security Info=False;Data Source=master"3. 执行恢复命令:
    cnn.Execute " restore database jkxt from disk='d:\VB\监控系统\客户端\jkxt.bak'with replace"
      

  9.   

    restore database xxx from disk='filename' with replace
                         ^^^^^^^^^你在恢复数据库以前先cnn.close
    就是关闭所有连接,你最好重新建立一个连接专门用于恢复/备份数据库
    drop database xxx
    restore database ....
      

  10.   

    shell "scm -silent 1 -action 2"
    sleep 10000
    cnn.execute "user master"
    cnn.execute "restore ..."
    private Declare Sub Sleep Lib "kernel32" Alias "Sleep" (ByVal dwMilliseconds As Long)Private Sub regain_Click(Index As Integer)
    Dim cnn As ADODB.Connection
    Dim rs As ADODB.Recordset
    Dim sql As String
    Shell "scm -silent 1 -action 2  -service mssqlserver "'Specfied sqlserver service
    sleep 20000
    Set cnn = New ADODB.Connection
    cnn.Open "Provider=MSDASQL.1;Persist Security Info=False;Data Source=jkxt"
    cnn.Execute "use master"
    cnn.Execute " restore database jkxt from disk='d:\VB\监控系统\客户端\jkxt.bak'with replace"
    MsgBox "恭喜、恭喜,你已经成功恢复数据库~!~", vbOKOnly + vbExclamation, "恢复成功"
    End Sub
     
     
      

  11.   

    private Declare Sub Sleep Lib "kernel32" Alias "Sleep" (ByVal dwMilliseconds As Long)Private Sub regain_Click(Index As Integer)
    Dim cnn As ADODB.Connection
    Dim rs As ADODB.Recordset
    Dim sql As String
    Shell "scm -silent 1 -action 2  -service mssqlserver "'Specfied sqlserver service
    sleep 20000
    Set cnn = New ADODB.Connection
    cnn.Open "Provider=MSDASQL.1;Persist Security Info=False;Data Source=jkxt"
    cnn.Execute "use master"
    cnn.Execute " restore database jkxt from disk='d:\VB\监控系统\客户端\jkxt.bak'with replace"
    MsgBox "恭喜、恭喜,你已经成功恢复数据库~!~", vbOKOnly + vbExclamation, "恢复成功"
    End Sub
      

  12.   

    private Declare Sub Sleep Lib "kernel32" Alias "Sleep" (ByVal dwMilliseconds As Long)把这行放在最顶上,即:Option Explicit的下面一行
      

  13.   

    Restarting a Paused Profiler Trace May Return General Network Error Q272706
    --------------------------------------------------------------------------------
    The information in this article applies to:Microsoft SQL Server 2000 (all editions)--------------------------------------------------------------------------------
    SYMPTOMS
    If the server against which a trace is being run is restarted, while the trace is paused, the profiler returns the following series of error messages in a dialog box: Failed to restart a trace.
    [Microsoft][ODBC SQL Server Driver][Shared Memory]ConnectionWrite
    (WrapperWrite()). (State 01000) (Code 55)
    [Microsoft][ODBC SQL Server Driver][Shared Memory]General network error. Check your network documentation. (State 08S01) (Code 11) 
    The information window also displays the following: 
    Error retrieving trace information from the server 
    as well as: 
    Connections: 0 
    However, it may not not be apparent to the user that the network error messages are occurring because of a server restart.Following the reporting of the error messages, the Pause and Stop Execution buttons are dimmed. Only the Start execution button is enabled. Restarting the trace works successfully, with the exception that all previously obtained trace results are cleared from the window and a new trace (and the resulting output) are begun from scratch. CAUSE
    This behavior is considered to be by design. Several different ideas were considered in order to make this behavior more intuitive, including having the profiler detect for a dead connection before attempting to restart the trace. Ultimately, it was decided to have the ODBC driver propagate the exact error messages to the user interface (UI). The current behavior enables the user to be made aware of the fact that something has gone wrong with the connection. However, the user needs to take care to save any existing results before restarting the trace. Both saving to a table and saving to a file work properly. Additional query words: Keywords : kbDSupport kbSQLServ2000 
    Issue type : kbprb 
    Technology : kbSQLServSearch kbAudDeveloper kbSQLServ2000Search kbSQLServ2000 
      

  14.   

    哦,我发了消息给你!另外,请认真看 fling_boy(andy--笨小孩) 的回答!
      

  15.   

    关于备份你这样试试!
    我们的系统这样做能够正常备份!
             cn.Open "Provider=SQLOLEDB.1;Persist Security Info=False;User ID=sa;Initial Catalog=master;Data Source=127.0.0.1 "
            s_restore = "restore database wzgl from disk='" + Trim(Text1.Text) + "'"
            cn.Execute s_restore
      

  16.   

    xinshou1979330 (新手) :
         结果还是用了我的方法,为什么给我的分要少?
         你自己怎么要回自己的问题?
      

  17.   

    Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)<-----------------》这行在通用声明中
    Dim cnn As ADODB.Connection
    Dim s_restore As String
    Shell "scm -silent 1 -action 2  -service mssqlserver " 'Specfied sqlserver service
    Sleep 20000
    Set cnn = New ADODB.Connection
    cnn.Open "Provider=MSDASQL.1;Persist Security Info=False;User ID=sa;Initial Catalog=master;Data Source=jkxt"
            s_restore = "restore database jkxt from disk='d:\VB\监控系统\客户端\jkxt.bak'"
            cnn.Execute s_restore
    cnn.Close
    MsgBox "恭喜、恭喜,你已经成功恢复数据库~!~", vbOKOnly + vbExclamation, "恢复成功"
    以上是我目前恢复的代码
    “昨天的话可以把所有的连接全部初始化!”这句话是什么意思?
    谢谢
    ----------------------------------------------------------------
    原贴内容:
    你的数据库连的是哪个?
    master还是自己的?
    建议一下:一般在恢复完成后,建议用户重新登录一下你们的管理系统!
    昨天的话可以把所有的连接全部初始化!