简体   繁体   English

SQL Server 2005:使用 sp_attach_db 或 CREATE DATABASE 与多个文件组和全文目录连接数据库

[英]SQL Server 2005: Attach database using sp_attach_db or CREATE DATABASE with multiple filegroups and full text catalog

Having issues attaching a Database with multiple filegroups and a full text catalog from server A to server B with either "sp_attach_db" or CREATE DATABASE in SQL Server 2005 SP3.在 SQL Server 2005 SP3 中使用“sp_attach_db”或 CREATE DATABASE 将具有多个文件组和全文目录的数据库附加到服务器 B 时出现问题。 All the database files (primary data, secondary data, log, full-text catalog) have been copied from server A to server B.所有数据库文件(主数据、辅助数据、日志、全文目录)已从服务器 A 复制到服务器 B。

I had a similar issue ( SQL Server 2005: Attach database using sp_attach_db with full text catalog ) but this example only had a primary data file, primary log file and a full text catalog我有一个类似的问题( SQL Server 2005: Attach database using sp_attach_db with full text catalog )但这个例子只有一个主数据文件、主日志文件和一个全文目录

Now I am faced with adding in more filegroups and when I try to run the example command below it fails现在我面临添加更多文件组的问题,当我尝试运行下面的示例命令时它失败了

CREATE DATABASE DBNAME ON 
    (FILENAME = 'C:\Databases\DBNAME\Data\DBNAME_data.mdf'), 
    (FILENAME = 'C:\Databases\DBNAME\Data\DBNAME_indexes.ndf'), 
    (FILENAME = 'C:\Databases\DBNAME\Data\DBNAME1_data.ndf'), 
    (FILENAME = 'C:\Databases\DBNAME\Logs\DBNAME_log.ldf'), 
    (FILENAME = 'C:\Databases\DBNAME\Data\FTData') 
FOR ATTACH;
GO

Error Message:错误信息:

Msg 5120, Level 16, State 101, Line 1
Unable to open the physical file "C:\Databases\DBNAME\Data\FTData". Operating system error 5: "5(Access is denied.)".

I have used this Microsoft page ( http://msdn.microsoft.com/en-us/library/ms176061.aspx ) as my guide but it doesn't have an example like this.我已使用此 Microsoft 页面 ( http://msdn.microsoft.com/en-us/library/ms176061.aspx ) 作为我的指南,但它没有这样的示例。 I know this has to be possible, what am I missing??我知道这必须是可能的,我错过了什么?

Figured out what I needed to do.弄清楚我需要做什么。 Whether this is the right way or a work-around way I am not sure.我不确定这是正确的方法还是解决方法。 This is what I did....first I removed the fulltext catalog from the create database list since it was having issues with it (no matter how I had it) and was able to create/attach the database (though I did get a warning)这就是我所做的......首先我从创建数据库列表中删除了全文目录,因为它存在问题(无论我如何拥有它)并且能够创建/附加数据库(尽管我确实得到了一个警告)

CREATE DATABASE DBNAME ON 
    (FILENAME = 'C:\Databases\DBNAME\Data\DBNAME_data.mdf'), 
    (FILENAME = 'C:\Databases\DBNAME\Data\DBNAME_indexes.ndf'), 
    (FILENAME = 'C:\Databases\DBNAME\Data\DBNAME1_data.ndf'), 
    (FILENAME = 'C:\Databases\DBNAME\Logs\DBNAME_log.ldf')
FOR ATTACH;
GO

Then I got the logical name and path to the fulltext catalog from this...然后我从中得到了全文目录的逻辑名称和路径......

SELECT * FROM SYS.DATABASE_FILES  WHERE TYPE_DESC = 'FULLTEXT'

Then brought the database offline, repathed the fulltext catalog and then brought the database back online with this...然后使数据库脱机,重新路径全文目录,然后使用此命令使数据库重新联机...

ALTER DATABASE DBNAME SET OFFLINE
ALTER DATABASE DBNAME MODIFY FILE ( NAME = sysft_cat_full_text , FILENAME = 'C:\Databases\DBNAME\Data\FTData\cat_full_text')
ALTER DATABASE DBNAME SET ONLINE

So far I have not had to rebuild the catalogs yet到目前为止,我还没有重建目录

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM