Ensure that the workspace was created under the correct FileGroups for proper data storage and the reduction of disk contention. Using the DBTUNE configuration that you modified previously, you can run the following script examples in SQL Server Management Studio.
Set the current database:
USE [nisdb]
GO
List FileGroups and data files:
EXEC sp_helpdb nisdb
GO
List FileGroup data files:
EXEC sp_helpfilegroup 'PRIMARY'
GO
List tables by FileGroup:
SELECT USER_NAME(o.uid) [Owner],
OBJECT_NAME(i.id) [Table Name],
FILEGROUP_NAME(groupid) AS [Filegroup Name]
FROM sysindexes i inner join sysobjects o
ON i.id = o.id
WHERE i.indid IN (0, 1) AND OBJECTPROPERTY(i.id, 'IsMSShipped') = 0 AND
USER_NAME(o.uid) = 'nis'
ORDER BY 1,3,2
GO
List indexes by table and FileGroup:
select 'owner'=user_name(o.uid)
,'table_name'=object_name(i.id),i.indid
,'index_name'=i.name ,i.groupid
,'filegroup'=f.name ,'file_name'=d.physical_name
,'dataspace'=s.name from sys.sysindexes i
,sys.sysobjects o,sys.filegroups f
,sys.database_files d, sys.data_spaces s
where objectproperty(i.id,'IsUserTable') = 1
and i.id = o.id
and f.data_space_id = i.groupid
and f.data_space_id = d.data_space_id
and f.data_space_id = s.data_space_id
and user_name(o.uid) = 'nis'
order by object_name(i.id),i.name,f.name
GO
Если какие-либо таблицы или индексы хранятся в неверной FileGroup, ее можно изменить с помощью ALTER TABLE и ALTER INDEX (см. SQL Server Books в сети Интернет).
В SQL ServerManagement Studio, вы можете создать заново DDL скрипт таблиц и индексов; затем, в рамках создания скрипта, вы можете изменить параметры FileGroup и заново создать таблицы и индексы в правильных FileGroups. Это особенно полезно, когда таблицы пусты, и вы можете повторно создавать объекты базы данных.