积极答复者
文件组备份与恢复

问题
-
有一个主文件组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中的一个损坏,周三晚上之前的数据恢复应该没有问题吧?
答案
-
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.- 已标记为答案 Hong-Gang Chen - MSFTModerator 2010年1月27日 7:09
全部回复
-
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.- 已标记为答案 Hong-Gang Chen - MSFTModerator 2010年1月27日 7:09