关于数据文件存储的内容请教

huangjing81 2013-04-17 02:47:10
近日对一个数据库进行收缩归档时发现,某个文件组未包含任何堆或索引,但是该文件组内的物理文件很大且在收缩信息显示可用空间为40%。
请问文件内除了表和索引等数据外,还有其他什么数据也存放在文件里么?

...全文
195 10 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
10 条回复
切换为时间正序
请发表友善的回复…
发表回复
唐诗三百首 2013-04-18
  • 打赏
  • 举报
回复
请问LZ的数据库是不是有启用复制(Replication)或CHANGE_TRACKING功能呢?
Vidor 2013-04-17
  • 打赏
  • 举报
回复
select * from sys.allocation_units where data_space_id = 2 再关联sys.partitions/sys.objects查就是了
huangjing81 2013-04-17
  • 打赏
  • 举报
回复
最后的那个结果中未能找到data_space_id=2的记录,求解!
huangjing81 2013-04-17
  • 打赏
  • 举报
回复
以下为索引与文件组对应关系 select i.name as index_name,o.name as tablename,fg.data_space_id from sys.indexes i inner join sys.all_objects o on i.object_id =o.object_id inner join sys.filegroups fg on i.data_space_id =fg.data_space_id where o.type='u' ============================================================== index_name tablename data_space_id PK_ts_class ts_display_type 1 PK__sysdiagrams__02925FBF sysdiagrams 1 UK_principal_name sysdiagrams 1 NULL t_tracking_bak 1 PK_t_SearchInfo20130413 t_SearchInfo-20130414 1 PK_t_index_db t_index_db 1 PK_t_tracking t_tracking 1 PI_list_zx_1 t_tracking 1 pk_dtproperties dtproperties 1 PK_t_usp_attachment t_usp_attachment 1 idx_t_usp_attachment t_usp_attachment 1 PK_ts_instancy ts_instancy_type 1 IX_t_note_2 t_newNote 1 PK_t_notes t_newNote 1 IX_t_note t_newNote 1 IX_t_note_3 t_newNote 1 PI_List_zx1 t_newNote 1 xx1 t_newNote 1 xx2 t_newNote 1 xx3 t_newNote 1 ix_t_note_4 t_newNote 1 idx_t_note_4del t_newNote 1 NULL t_newNote_data 1 PK_t_note_data_new t_newNote_data 1 NULL t_record 4 PK_t_record1 t_record 4 PI_List_zx11 t_record 4 PI_List_zx21 t_record 4 xx11 t_record 4 xx91 t_record 1 xx31 t_record 4 xx41 t_record 4 xx51 t_record 4 xx71 t_record 4 xx81 t_record 4 zxIndex11 t_record 4 zxIndex21 t_record 4 zxIndex31 t_record 4 NULL t_flow_line 5 PK_t_flow_line1 t_flow_line 5 xx_1 t_flow_line 5 PK_ts_notice_type ts_notice_type 1 PK_t_note_ex t_note_ex 1 NULL t_accepter 3 x_t_accepter t_accepter 1 PK_t_accepter1 t_accepter 3 PK_t_pagesecurity1 t_pagesecurity 1 ix_t_pagesecurity t_pagesecurity 1 PK_tc_serial tc_serial 1 PK_t_SearchInfo t_SearchInfo 1 PK_t_SearchInfo_New t_SearchInfo_New 1 PK_oper1 oper 8 IX_oper1 oper 8 PI_List_zx11 oper 8 xx111 oper 8 ix_oper2 oper 1 PK_tr_grant tr_grant 1 PK_t_history t_history 6 xx1 t_history 6 PK_t_UserSyncEmployeeNo t_UserSyncEmployeeNo 1 PK_t_SearchInfo_NewID t_SearchInfo_NewID 1 NULL temp_note 1 xxssss temp_note 1 NULL t_SearchInfo_Notify 1 PK_t_note_team t_note_team 1 PK_t_admin_log t_admin_log 1 PK_t_attachment t_attachment 1 IX_t_attachment t_attachment 1
huangjing81 2013-04-17
  • 打赏
  • 举报
回复
以下是执行结果 有问题的为filegroup 2 Fileid FileGroup TotalExtents UsedExtents Name FileName 1 1 2363584 1462810 Notes_Data F:\Temp\notes_201202\notes.mdf 3 2 721043 426894 notes_1_Data F:\Temp\notes_201202\notes_1.mdf 5 2 671679 413966 Notes_2_Data F:\Temp\notes_201202\Notes_2_Data.ndf 6 2 696454 414676 Notes_3_Data F:\Temp\notes_201202\Notes_3_Data.ndf 7 2 693347 423665 notes_4_Data F:\Temp\notes_201202\notes_4_Data.ndf 9 2 699341 422731 Notes_5_Data F:\Temp\notes_201202\Notes_5_Data.ndf 11 3 124011 110606 Note_accepter_Data F:\Temp\notes_201202\Note_accepter_Data.ndf 12 4 1139612 1137305 Notedeal_record_Data F:\Temp\notes_201202\Notedeal_record_Data.ndf 13 5 159613 158418 Note_flow_line_Data F:\Temp\notes_201202\Note_flow_line_Data.ndf 14 6 1775431 1769717 Note_history_Data F:\Temp\notes_201202\Note_history_Data.ndf 15 8 211155 209850 Note_oper_record_Data F:\Temp\notes_201202\Note_oper_record_Data.ndf 16 9 409954 290612 Note_pagesecurity_Data F:\Temp\notes_201202\Note_pagesecurity_Data.ndf
唐诗三百首 2013-04-17
  • 打赏
  • 举报
回复
请执行以下SQL,把结果贴出来看看.. 注明有问题的文件组是哪个喔.

use [数据库名]
go

dbcc showfilestats
huangjing81 2013-04-17
  • 打赏
  • 举报
回复
引用 3 楼 ap0405140 的回复:
查询文件组包含的对象, SQL code?1234select object_name(a.[object_id]) from sys.indexes a inner join sys.filegroups b on a.data_space_id=b.data_space_id where b.name='[文件组名]'
就是通过这种方式查出没有任何堆或索引包含在那个文件组里面,所以搞不懂那个文件组里面的数据到底是些什么数据
唐诗三百首 2013-04-17
  • 打赏
  • 举报
回复
查询文件组包含的对象,

select object_name(a.[object_id])
 from sys.indexes a
 inner join sys.filegroups b on a.data_space_id=b.data_space_id
 where b.name='[文件组名]'
huangjing81 2013-04-17
  • 打赏
  • 举报
回复
应该不是这个原因,这个文件组里面包含3个文件,每个文件有接近50G大小。我想谁也不会把初始大小设置成那么大吧
發糞塗牆 2013-04-17
  • 打赏
  • 举报
回复
是不是你的文件初始化很大,然后自增长又用了百分比,然后一下子就增长很大拉?

34,838

社区成员

发帖
与我相关
我的任务
社区描述
MS-SQL Server相关内容讨论专区
社区管理员
  • 基础类社区
  • 二月十六
  • 卖水果的net
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧