2013-11-22 55 views
10

我的備份失敗:由於錯誤2601,未能將提交表刷新到dbid 12中的磁盤。請查看錯誤日誌以獲取更多信息。正在使用哪些表更改跟蹤

我的數據庫啓用了更改跟蹤。我如何確定哪些表具有啓用?我看了50+,並找不到它的。 SQL 2008 R2

感謝

+1

也許這是更適合[服務器故障(http://serverfault.com/)? –

回答

26

要查找已啓用了更改跟蹤的表,執行以下腳本對跟蹤數據庫

SELECT s.name AS Schema_name, t.name AS Table_name 
FROM sys.change_tracking_tables ctt 
JOIN sys.tables t 
    ON t.object_id = ctt.object_id 
JOIN sys.schemas s 
    ON s.schema_id = t.schema_id 
ORDER BY s.name, t.name 

enter image description here

您可以找到有關有用的系統的詳細信息觀點變更跟蹤在這裏:

sys.change_tracking_tables (Transact-SQL)

sys.change_tracking_databases (Transact-SQL)

0

這裏的布倫特奧扎爾查詢,讓您通過更改跟蹤維護,存儲改變了隱藏的表的列表,涉及CT的表中的行和空間佔用這些隱藏的表。

enter image description here

SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED; 
GO 

SELECT 
    sct1.name AS CT_schema, 
    sot1.name AS CT_table, 
    ps1.row_count AS CT_rows, 
    ps1.reserved_page_count*8./1024. AS CT_reserved_MB, 
    sct2.name AS tracked_schema, 
    sot2.name AS tracked_name, 
    ps2.row_count AS tracked_rows, 
    ps2.reserved_page_count*8./1024. AS tracked_base_table_MB, 
    change_tracking_min_valid_version(sot2.object_id) AS min_valid_version 
FROM sys.internal_tables it 
JOIN sys.objects sot1 ON it.object_id=sot1.object_id 
JOIN sys.schemas AS sct1 ON sot1.schema_id=sct1.schema_id 
JOIN sys.dm_db_partition_stats ps1 ON it.object_id = ps1. object_id AND ps1.index_id in (0,1) 
LEFT JOIN sys.objects sot2 ON it.parent_object_id=sot2.object_id 
LEFT JOIN sys.schemas AS sct2 ON sot2.schema_id=sct2.schema_id 
LEFT JOIN sys.dm_db_partition_stats ps2 ON sot2.object_id = ps2. object_id AND ps2.index_id in (0,1) 
WHERE it.internal_type IN (209, 210); 
GO