0

我正在研究数据库的文件组备份。我想让 PRIMARY 文件组中的所有表都被备份和恢复,而 SECONDARY 文件组中的表不是。当表刚刚被编辑时,我的查询工作正常,但是当它们被截断时,SECONDARY 文件组中的表被恢复。

当我对 SECONDARY 文件组中的表进行“DELETE FROM”修改时,它会在恢复后保持这种状态。但是当我在同一张表上执行“TRUNCATE TABLE”时,所有内容都会在还原后返回。我怀疑 SECONDARY 文件组中的表仍然由 PRIMARY 备份,但这没有太大意义,因为删除行没有恢复。

--- Create PRIMARY file group backup ---

Use master

BACKUP DATABASE database_name   
    FILEGROUP = 'PRIMARY'
    TO DISK = 'some_location' 

--- Restore PRIMARY file group --- 
 USE master
 RESTORE DATABASE database_name
    FILEGROUP = 'PRIMARY'
    FROM DISK = 'some_location'
    WITH PARTIAL, RECOVERY, REPLACE

 --- Restore the other filegroup using a recovery-only database restore --- 
 USE master
 RESTORE DATABASE database_name
    FILEGROUP = 'SECONDARY'
    WITH RECOVERY
4

0 回答 0