sql server 为何无法还原

解决方案 »

  1.   

    ??
    服务器: 消息 3101,级别 16,状态 1,行 1
    因为数据库正在使用,所以未能获得对数据库的排它访问权。
    服务器: 消息 3013,级别 16,状态 1,行 1
    RESTORE DATABASE 操作异常终止。
    -----------------------
    试一下:
    USE Master
     
    DECLARE tables_cursor CURSOR
       FOR
    select spid from master..sysprocesses where dbid=db_id('test')
    OPEN tables_cursor
    DECLARE @tablename sysname
    FETCH NEXT FROM tables_cursor INTO @tablename
    WHILE (@@FETCH_STATUS <> -1)
    BEGIN
       exec ('kill '+ @tablename)
       FETCH NEXT FROM tables_cursor INTO @tablename
    END
    Close tables_cursor
    DEALLOCATE tables_cursor
    -------
    再执行还原操作!
      

  2.   

    select spid from master..sysprocesses where dbid=db_id('你的数据库名')