none
文件组备份与恢复 RRS feed

  • 问题

  • 有一个主文件组Primary,及FG1 和 FG2文件组,现在FG1文件组备份出来后,不再需要,如果需要的时候再还原。
    做法及步骤:
    1.设置恢复模型为FULL
    2.单独备份主文件组,FG1,FG2,作为一个初始备份。
    3.移除文件组FG1,如果以后要用到再恢复出来。
    4.设定JOB来备份Primary 和FG2.

    问题:1.第3步中如何清空FG1后的数据再移除文件及文件组,表很多,如果逐个删除比较麻烦,能否一次性清除所有数据?另外,能否找到位于某文件组中的所有对象?
          2.因为日志文件不重要,故在第4步备份Primary 和FG2后,隔一段时间会截断事物日志,如果某天Primary 和FG2中的某一个损坏,截断后对与恢复Primary 和FG2是有很大的影响?比如说我周一做了一个Primary 和FG2的备份,周三晚上截断了事物日志,周四早上Primary 和FG2中的一个损坏,周三晚上之前的数据恢复应该没有问题吧?
       
    2010年1月22日 9:04

答案

  • Use following code to find tables then drop them, replace n for i.data_space_id with your file group id :

    SELECT o.[name], o.[type], i.[name], i.[index_id], f.[name]
    FROM sys.indexes i
    INNER JOIN sys.filegroups f
    ON i.data_space_id = f.data_space_id
    INNER JOIN sys.all_objects o
    ON i.[object_id] = o.[object_id]
    WHERE i.data_space_id = n and o.type <> 'S'

    2. You need log backups to bring db online after restoring file group. You can only recover to point before truncating log in your case.
    2010年1月22日 19:56

全部回复

  • Use following code to find tables then drop them, replace n for i.data_space_id with your file group id :

    SELECT o.[name], o.[type], i.[name], i.[index_id], f.[name]
    FROM sys.indexes i
    INNER JOIN sys.filegroups f
    ON i.data_space_id = f.data_space_id
    INNER JOIN sys.all_objects o
    ON i.[object_id] = o.[object_id]
    WHERE i.data_space_id = n and o.type <> 'S'

    2. You need log backups to bring db online after restoring file group. You can only recover to point before truncating log in your case.
    2010年1月22日 19:56
  • rmiao,
     
       你好,我已经按你的方法将不再使用的文件组中的对象全部清除了,然后清除了文件组FG1中的文件及FG1文件组,Primary与 FG2文件组可以正常的备份恢复。
       还有一个问题就是,现在假定因工作需要,需要用到 FG1文件组中的数据,我尝试了在在线状态下的恢复,恢复可以正常进行,也提示恢复成功,但是 FG1 中的表式是不可访问的,该如何才能访问了,提示对象存在,但恢复也没有出现异常啊? 是否我需要修改数据库的状态之后再进行恢复呢 ?谢谢!
    2010年1月25日 5:36
  • Need restore log to bring fg1 online.
    2010年1月25日 15:44
  • 你好,现在的情况是数据库在正常使用状态下,如果需要回复FG1文件组,平且使得FG1文件组可用,所以不存在恢复日志的问题。
    2010年1月26日 6:12
  • But you can't access objects in FG1 as you know.
    2010年1月26日 14:13