gpt4 book ai didi

SQL 服务器 2005 : Attach database using sp_attach_db with full text catalog

转载 作者:搜寻专家 更新时间:2023-10-30 23:22:53 25 4
gpt4 key购买 nike

在 SQL Server 2005 SP3 中使用“sp_attach_db”命令将数据库和全文目录从服务器 A 附加到服务器 B 时出现问题。所有的数据库文件(数据,日志,全文目录)已经从服务器A复制到服务器B。我猜这确实是可能的,我的语法不正确,但我似乎找不到任何例子或任何地方的良好文档。这是我正在使用的一些伪语法...

exec sp_attach_db '<database_name>', '<database data file>', '<database full text catalog folder>', '<database log file>'

或者某种程度上的例子....

exec sp_attach_db 'database', 'C:\Database\Data\database_data.mdf', 'C:\Database\Data\FTData', 'C:\Databases\Logs\database_log.ldf'

我从这个命令中收到“无法打开物理文件”的错误,附加命令失败。如果我从 sp_attach_db 命令中删除全文目录文件夹,数据库会安装,但会警告我找不到全文目录。我错过了什么!?

最佳答案

使用CREATE DATABASE ... FOR ATTACH; .参见示例 H:

Attaching a full-text catalog that has been moved
The following example attaches the full-text catalog AdvWksFtCat along with the AdventureWorks2008R2 data and log files. In this example, the full-text catalog is moved from its default location to a new location c:\myFTCatalogs. The data and log files remain in their default locations.

USE master;
GO
--Detach the AdventureWorks2008R2 database
sp_detach_db AdventureWorks2008R2;
GO
-- Physically move the full text catalog to the new location.
--Attach the AdventureWorks2008R2 database and specify the new location of the full-text catalog.
CREATE DATABASE AdventureWorks2008R2 ON
(FILENAME = 'c:\...\Data\AdventureWorks2008R2_Data.mdf'),
(FILENAME = 'c:\...\Data\AdventureWorks2008R2_log.ldf'),
(FILENAME = 'c:\myFTCatalogs\AdvWksFtCat')
FOR ATTACH;
GO

关于SQL 服务器 2005 : Attach database using sp_attach_db with full text catalog,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4019060/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com