备份和还原全文目录和索引Back Up and Restore Full-Text Catalogs and Indexes

适用对象:是SQL Server 否Azure SQL 数据库 否Azure Synapse Analytics (SQL DW) 否并行数据仓库APPLIES TO: yesSQL Server noAzure SQL Database noAzure Synapse Analytics (SQL DW) noParallel Data Warehouse

本主题说明如何备份和还原在 SQL ServerSQL Server中创建的全文索引。This topic explains how to back up and restore full-text indexes created in SQL ServerSQL Server. SQL ServerSQL Server中,全文目录是一个逻辑概念,并不驻留在文件组中。In SQL ServerSQL Server, the full-text catalog is a logical concept and does not reside in a filegroup. 因此,若要备份 SQL ServerSQL Server中的全文目录,必须识别包含属于该目录的全文索引的每个文件组。Therefore, to back up a full-text catalog in SQL ServerSQL Server, you must identify every filegroup that contains a full-text index that belongs to the catalog. 然后您必须逐个备份这些文件组。Then you must back up those filegroups, one by one.

重要

可以在升级 SQL Server 2005 (9.x)SQL Server 2005 (9.x) 数据库时导入全文目录。It is possible to import full-text catalogs when upgrading a SQL Server 2005 (9.x)SQL Server 2005 (9.x) database. 每个导入的全文目录在其自身的文件组中都是一个数据库文件。Each imported full-text catalog is a database file in its own filegroup. 若要备份导入的目录,只需备份其文件组即可。To back up an imported catalog, simply back up its filegroup. 有关详细信息,请参阅 联机丛书中的备份和还原全文目录 SQL Server 2005 (9.x)SQL Server 2005 (9.x)For more information, see Backing Up and Restoring Full-Text Catalogs, in SQL Server 2005 (9.x)SQL Server 2005 (9.x) Books Online.

备份全文目录的全文索引Backing Up the Full-Text Indexes of a Full-Text Catalog

查找全文目录的全文索引Finding the Full-Text Indexes of a Full-Text Catalog

你可以通过使用以下 SELECT 语句检索全文索引的属性,此语句将从 sys.fulltext_indexessys.fulltext_catalogs 目录视图选择一些列。You can retrieve the properties of the full-text indexes by using the following SELECT statement, which selects columns from the sys.fulltext_indexes and sys.fulltext_catalogs catalog views.

USE AdventureWorks2012;  
GO  
DECLARE @TableID int;  
SET @TableID = (SELECT OBJECT_ID('AdventureWorks2012.Production.Product'));  
SELECT object_name(@TableID), i.is_enabled, i.change_tracking_state,   
   i.has_crawl_completed, i.crawl_type, c.name as fulltext_catalog_name   
   FROM sys.fulltext_indexes i, sys.fulltext_catalogs c   
   WHERE i.fulltext_catalog_id = c.fulltext_catalog_id;  
GO  

查找包含全文索引的文件组或文件Finding the Filegroup or File That Contains a Full-Text Index

创建全文索引时,该全文索引将放在以下某个位置:When a full-text index is created, it is placed in one of the following locations:

  • 用户指定的文件组。A user-specified filegroup.

  • 与基表或视图相同的文件组(对于未分区表而言)。The same filegroup as base table or view, for a nonpartitioned table.

  • 主文件组(对于分区表而言)。The primary filegroup, for a partitioned table.

备注

有关创建全文索引的详细信息,请参阅创建和管理全文索引CREATE FULLTEXT INDEX (Transact-SQL)For information about creating a full-text index, see Create and Manage Full-Text Indexes and CREATE FULLTEXT INDEX (Transact-SQL).

若要查找表或视图的全文索引所属的文件组,请使用以下查询,其中 object_name 为表或视图的名称:To find the filegroup of full-text index on a table or view, use the following query, where object_name is the name of the table or view:

SELECT name FROM sys.filegroups f, sys.fulltext_indexes i   
   WHERE f.data_space_id = i.data_space_id   
      and i.object_id = object_id('object_name');  
GO  
  

备份包含全文索引的文件组Backing Up the Filegroups That Contain Full-Text Indexes

在找到包含全文目录索引的文件组后,您需要备份找到的每个文件组。After you find the filegroups that contain the indexes of a full-text catalog, you need back up each of the filegroups. 在备份过程中,不会删除或添加全文目录。During the backup process, full-text catalogs may not be dropped or added.

文件组的首次备份必须是完整文件备份。The first backup of a filegroup must be a full file backup. 在创建文件组的完整文件备份之后,您可以仅备份文件组中的更改,方法是:创建一系列基于完整文件备份的一个或多个差异文件备份。After you have created a full file backup for a filegroup, you could back up only the changes in a filegroup by creating a series of one or more differential file backups that are based on the full file backup.

备份文件和文件组To back up files and filegroups

还原全文索引Restoring a Full-Text Index

还原备份的文件组将还原全文索引文件,以及此文件组中的其他文件。Restoring a backed-up filegroup restores the full-text index files, as well as the other files in the filegroup. 默认情况下,文件组将还原至该文件组在备份时所在的磁盘位置。By default, the filegroup is restored to the disk location on which the filegroup was backed up.

如果在创建备份时全文索引表处于联机状态并且正在运行填充,则在还原之后将继续填充。If a full-text indexed table was online and a population was running when the backup was created, the population is resumed after the restore.

还原文件组To restore a filegroup

另请参阅See Also

管理和监视服务器实例的全文搜索 Manage and Monitor Full-Text Search for a Server Instance
升级全文搜索Upgrade Full-Text Search