Does somebody know how to drop orphaned “FULLTEXT” datafile from database?
Recreating FTS with same name and/or with the same location didn’t help (as
expected)
Database was detached from 2K and attached to 2K5
select file_id, name, path, fulltext_catalog_id from sys.fulltext_catalogs
65537CN3_Catalog_3_stage_FTCY:\FTS\CN3\CN3_Catalog_3_stage_FTC7
select file_id, name, file_guid, type_desc, physical_name, state_desc
from sys.database_files where type_desc = 'FULLTEXT'
65537sysft_CN3_Catalog_3_stage_FTCEE7215FD-C2D3-45C8-8136-5B77D2210B73FULLTEXTY:\FTS\CN3\CN3_Catalog_3_stage_FTCONLINE
65538sysft_CN3_Catalog_3_stage_FTCD60287F6-A0CE-4854-83CA-74F4F23C78A2FULLTEXTY:\FTI\CN3_Catalog_3_stage_FTCONLINE
select file_id, name, file_guid, type_desc, physical_name AS
CurrentLocation, state_desc
from sys.master_files
where type_desc = 'FULLTEXT'
and database_id = 8;
65537sysft_CN3_Catalog_3_stage_FTCEE7215FD-C2D3-45C8-8136-5B77D2210B73FULLTEXTY:\FTS\CN3\CN3_Catalog_3_stage_FTCONLINE
In this case even if I drop FTC CN3_Catalog_3_stage_FTC
All records with file_id = 65537 will disappear, but 65538 will not.
And database backup will fail. :-)
If I execute
ALTER DATABASE my_db REMOVE FILE CN3_Catalog_2_stage_FTC;
Msg 5020, Level 16, State 1, Line 1
The primary data or log file cannot be removed from a database
http://support.microsoft.com/kb/923355/en-us
doesn’t help ether because FTS catalog not even listed in
sys.fulltext_catalogs
In SQL 2K in such cases running
sp_fulltext_service 'clean_up'
always helped, but not in SQL 2K5.
Let me know if you have an idea how to fix it,
Thank you,
OK
The answer is do not run OFFLINE on any file or filegroup your stuck.
Microsoft is is stuck and does not understand to bring it online.
What we need to do is first dremove the filegroup
ALTER DATABASE YourDatabaseName remove FILEGROUp [filegroup];
Then run the remove command
ALTER DATABASE YourDatabaseName remove FILE [logical_filename];
You will still see the filegroup offline status.
Now do a detach of the database and try to reattach the using the gui and then click on the script and then you will have the files that are being attach to create the database.
Remove the file you do not need and you will get a database that does not have an offline file.
No comments:
Post a Comment