移动数据库文件Move Database Files

适用对象: yesSQL ServeryesAzure SQL 数据库noAzure SQL 数据仓库no并行数据仓库APPLIES TO: yesSQL Server noAzure SQL Database noAzure SQL Data Warehouse noParallel Data Warehouse

SQL ServerSQL Server中,可以通过在 ALTER DATABASE 语句的 FILENAME 子句中指定新的文件位置来移动系统数据库和用户数据库。In SQL ServerSQL Server, you can move system and user databases by specifying the new file location in the FILENAME clause of the ALTER DATABASE statement. 数据、日志和全文目录文件也可以通过此方法进行移动。Data, log, and full-text catalog files can be moved in this way. 这在下列情况下可能很有用:This may be useful in the following situations:

  • 故障恢复。Failure recovery. 例如,由于硬件故障,数据库处于可疑模式或被关闭。For example, the database is in suspect mode or has shut down, because of a hardware failure.

  • 预先安排的重定位。Planned relocation.

  • 为预定的磁盘维护操作而进行的重定位。Relocation for scheduled disk maintenance.

本节内容In This Section

主题Topic 描述Description
移动用户数据库Move User Databases 说明将用户数据库文件和全文目录文件移动到新位置的过程。Describes the procedures for moving user database files and full-text catalog files to a new location.
移动系统数据库Move System Databases 说明将系统数据库文件移动到新位置的过程。Describes the procedures for moving system database files to a new location.

另请参阅See Also

ALTER DATABASE (Transact-SQL) ALTER DATABASE (Transact-SQL)
CREATE DATABASE (SQL Server Transact-SQL) CREATE DATABASE (SQL Server Transact-SQL)
数据库分离和附加 (SQL Server)Database Detach and Attach (SQL Server)