数据库是在完整恢复模式下 (简单恢复模式没有问题)
==============================
就是程序里有两个按钮点备分就备分 还原就还原
===========================
在帮助里查到的是
USE master;
GO
ALTER DATABASE AdventureWorks SET RECOVERY FULL;
GO
-- Create a logical backup device for the full AdventureWorks backup.
EXEC sp_addumpdevice 'disk', 'MyAdvWorks_FullRM', 
'C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\BACKUP\MyAdvWorks_FullRM.bak';
GO-- Back up the full AdventureWorks database:
BACKUP DATABASE AdventureWorks
   TO MyAdvWorks_FullRM WITH FORMAT;
GO
--Create a pure log backup:
BACKUP LOG AdventureWorks TO MyAdvWorks_FullRM;
GO
--Create tail-log backup:
BACKUP LOG AdventureWorks TO MyAdvWorks_FullRM 
   WITH NORECOVERY;
GO
--Restore the full backup (from backup set 1):
RESTORE DATABASE AdventureWorks FROM MyAdvWorks_FullRM WITH NORECOVERY;
--Restore the pure log backup (from backup set 2):
RESTORE LOG AdventureWorks FROM MyAdvWorks_FullRM WITH FILE=2, NORECOVERY;
--restore the tail-log backup (from backup set 3):
RESTORE LOG AdventureWorks FROM MyAdvWorks_FullRM WITH FILE=3, NORECOVERY;
GO
--recover the database:
RESTORE DATABASE AdventureWorks WITH RECOVERY;
GO
=====================================================
这上面是备份与恢复合在一起的,
把备份与恢复拆开问题就出来了
不知道为什么,而且只能恢复一次, 第2次在企业管理器里还原 就会提示尚未备份数据库日志的尾部什么什么的.... 记得2000的时候没这么多问题啊..要昏了

解决方案 »

  1.   

    是这个错误提示:
    ==============================怎么解决啊
    System.Data.SqlClient.SqlError: 尚未备份数据库 "test" 的日志尾部。如果该日志包含您不希望丢失的工作,请使用 BACKUP LOG WITH NORECOVERY 备份该日志。请使用 RESTORE 语句的 WITH REPLACE 或 WITH STOPAT 子句来只覆盖该日志的内容。 (Microsoft.SqlServer.Smo)
      

  2.   

    对于使用完全恢复模式或大容量日志恢复模式的数据库,在大多数情况下,Microsoft SQL Server 2005 都要求您在还原数据库前备份日志尾部。除非 RESTORE 语句包含 WITH REPLACE 或 WITH STOPAT 子句,否则,在没有先备份日志尾部的情况下还原数据库时将导致错误。http://msdn2.microsoft.com/zh-cn/library/ms178615(SQL.90).aspx
    http://msdn2.microsoft.com/zh-cn/library/ms179314(SQL.90).aspx
      

  3.   

    --restore database d5 from bak6 with replace    --删除现有数据库,从备份中重建数据库
      

  4.   

    -------------------------------------------------------------------------
    restore headeronly from bak1
    restore database d1 from bak1 with file=2         --从完全备份中恢复
    ----------------------------------------------------------------------
    restore headeronly from bak2              --从差异备份中恢复
    restore database d2 from bak2 with file=1,norecovery    
    restore database d2 from bak2 with file=5,recovery
    ----------------------------------------------------------------------
    restore headeronly from bak3              --从日志备份中恢复
    restore database d3 from bak3 with file=1,norecovery
    restore log    d3 from bak3 with file=2,norecovery
    restore log    d3 from bak3 with file=3,norecovery
    restore log    d3 from bak3 with file=4,norecovery
    restore log    d3 from bak3 with file=5,recovery
    ----------------------------------------------------------------------
    restore database d3 from bak3 with file=1,norecovery      --恢复到指定时间
    restore log    d3 from bak3 with file=2,norecovery
    restore log    d3 from bak3 with file=3,norecovery
    restore log    d3 from bak3 with file=4,recovery,stopat='2003-08-15 11:29:00.000'
    ----------------------------------------------------------------------
    restore database d5 filegroup='FG2' from bak5 with file=4,norecovery --还原文件组备份
    restore log d5 from bak5 with file=5,norecovery
    restore log d5 from bak5 with file=7,recovery
    ----------------------------------------------------------------------
    restore headeronly from bak6                 --还原文件备份
    restore database d5 file='d5_data3' from bak6 with file=6,norecovery
    restore log d5 from bak6 with file=7,norecovery
    restore log d5 from bak6 with file=9,recovery
    ----------------------------------------------------------------------
    restore database d5 from bak6 with replace    --删除现有数据库,从备份中重建数据库