移動資料庫檔案Move Database Files

適用範圍:Applies to: 是SQL ServerSQL Server (所有支援的版本) yesSQL ServerSQL Server (all supported versions) 適用範圍:Applies to: 是SQL ServerSQL Server (所有支援的版本) yesSQL ServerSQL Server (all supported versions)

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)