简体   繁体   English

无法删除文件组,因为它不为空 错误

[英]The filegroup cannot be removed because it is not empty Error

I have a file group within a database that has no logical files that cannot be removed.我在数据库中有一个文件组,其中没有无法删除的逻辑文件。 The error message states that the file group is not empty.错误消息指出文件组不为空。

I have verified that no partitions exist using the queries below.我已使用以下查询验证不存在分区。

SELECT * FROM sys.partition_functions
SELECT * FROM SYS.PARTITION_RANGE_VALUES
SELECT * FROM SYS.PARTITION_SCHEMES

I have also run the queries below in a effort to find anything associated with the file group, but found nothing我还运行了以下查询以查找与文件组相关的任何内容,但什么也没找到

SELECT
    au.*,
    ds.name AS [data_space_name],
    ds.type AS [data_space_type],
    p.rows,
    o.name AS [object_name]
FROM sys.allocation_units au
    INNER JOIN sys.data_spaces ds
        ON au.data_space_id = ds.data_space_id
    INNER JOIN sys.partitions p
        ON au.container_id = p.partition_id
    INNER JOIN sys.objects o
        ON p.object_id = o.object_id
ORDER BY ds.name;

SELECT *
FROM sys.filegroups fg
LEFT OUTER JOIN sysfilegroups sfg
    ON fg.name = sfg.groupname
LEFT OUTER JOIN sysfiles f
    ON sfg.groupid = f.groupid
LEFT OUTER JOIN sys.allocation_units i
    ON fg.data_space_id = i.data_space_id
WHERE i.data_space_id IS NULL;

select * from sys.allocation_units 
where data_space_id = (select data_space_id from sys.data_spaces where name = 'HL7');

In addition, I have been able to backup the database and restore to a different SQL Server and duplicate this problem.此外,我已经能够备份数据库并恢复到不同的 SQL 服务器并重复此问题。

What else can be checked to find out what is preventing the file group from being removed?还有什么可以检查以找出阻止文件组被删除的原因?

I had a similar situation recently.我最近也有类似的情况。 I ran我跑了

DBCC SHRINKFILE (N'myfile', EMPTYFILE)

after which I was able to remove the file.之后我能够删除该文件。

Frankly I didn't expect it to work, since in my case the filegroup has no other files in it.坦率地说,我没想到它会起作用,因为在我的情况下,文件组中没有其他文件。 So even though the operation should所以即使操作应该

Migrates all data from the specified file to other files in the same filegroup将指定文件中的所有数据迁移到同一文件组中的其他文件

There was no file to migrate the data to .没有文件可将数据迁移. But it worked.但它奏效了。 No errors or warnings.没有错误或警告。 Right after I removed the file without issue.在我毫无问题地删除文件之后。 Guessing that there was some messed up entries that bothered REMOVE FILE but not SHRINKFILE.猜测有一些混乱的条目会困扰 REMOVE FILE 而不是 SHRINKFILE。

Give it a go and post your results here.给它一个 go 并在此处发布您的结果。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 错误,因为ArrayLen的参数可能为空 - Error because argument for ArrayLen may be empty 通过将数据迁移到同一文件组中的其他文件来清空空文件的性能影响 - Performance Impact of Empty file by migrating the data to other files in the same filegroup 使用filestream将文件添加到sql文件组时,文件系统不支持错误 - file system not supported error while adding a file to sql filegroup with filestream 错误:无法将ntext数据类型选择为DISTINCT,因为它不可比较 - Error: The ntext data type cannot be selected as DISTINCT because it is not comparable Scala、Quill、Postgres - 由于“ON CONFLICT”错误而无法插入数据库 - Scala, Quill, Postgres - cannot insert into database because of an “ON CONFLICT” error exif_imagetype错误,文件名不能为空 - exif_imagetype error, filename cannot be empty 无法删除 PostgreSQL 角色。 错误:`无法删除,因为某些对象依赖于它` - Cannot drop PostgreSQL role. Error: `cannot be dropped because some objects depend on it` 由于CASE,蜂巢中的表空了 - Table empty in hive because of a CASE 如何解决由于错误1215而无法添加外键约束的MySQL错误? - How do I solve the MySQL error where I Cannot add foreign key constraint because of ERROR 1215? HTTP 错误 500.19 - 内部服务器错误无法访问请求的页面,因为该页面的相关配置数据无效 - HTTP Error 500.19 - Internal Server Error The requested page cannot be accessed because the related configuration data for the page is invalid
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM